Skip to content

Commit

Permalink
Version 1.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronef committed Jun 22, 2020
2 parents a6de120 + 1068dcc commit e96df94
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 12 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
# (MODX)EvolutionCMS.snippets.ddGetParentId changelog


## Version 1.3.1 (2020-06-22)
* \* Attention! (MODX)EvolutionCMS.libraries.ddTools >= 0.40.1 is required (not tested in older versions).
* \* Compatibility with new versions of (MODX)EvolutionCMS.libraries.ddTools.
* \* README, CHANGELOG: Style changes.
* \* README:
* \- Home.
* \+ Links.
* \* Composer.json → `require``dd/evolutioncms-libraries-ddtools`:
* \* Renamed from `dd/modxevo-library-ddtools`.
* \* Version format fixed.


## Version 1.3 (2020-03-02)
* \+ Empty items after parsing `result_itemTpl` will be ignored (you can calling third-party snippets in the template and set your own display conditions).
* \+ Composer.json → Require.
Expand All @@ -16,4 +28,5 @@
* \+ The first release.


<link rel="stylesheet" type="text/css" href="https://DivanDesign.ru/assets/files/ddMarkdown.css" />
<style>ul{list-style:none;}</style>
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ Gets document parent ID(s) of the required level.
## Requires
* PHP >= 5.4
* [(MODX)EvolutionCMS](https://github.com/evolution-cms/evolution) >= 1.1
* [(MODX)EvolutionCMS.libraries.ddTools](https://code.divandesign.biz/modx/ddtools) >= 0.30
* [(MODX)EvolutionCMS.libraries.ddTools](https://code.divandesign.biz/modx/ddtools) >= 0.40.1


## Documentation


### Installation

Elements → Snippets: Create a new snippet with the following data

1. Snippet name: `ddGetParentId`.
2. Description: `<b>1.3</b> Gets document parent ID(s) of the required level.`.
2. Description: `<b>1.3.1</b> Gets document parent ID(s) of the required level.`.
3. Category: `Core`.
4. Parse DocBlock: `no`.
5. Snippet code (php): Insert content of the `ddGetParentId_snippet.php` file from the archive.
Expand All @@ -28,6 +29,7 @@ Elements → Snippets: Create a new snippet with the following data
* Desctription: Document Id.
* Valid values: `integer`
* Default value: `[*id*]` (current document)

* `level`
* Desctription: Parent level
* `1` — the immediate parent
Expand All @@ -37,12 +39,14 @@ Elements → Snippets: Create a new snippet with the following data
* etc.
* Valid values: `integer`
* Default value: `1`

* `result_itemsNumber`
* Desctription: The number of parents that will be returned.
* Valid values:
* `integer`
* `'all'`
* Default value: `1`

* `result_itemTpl`
* Desctription: Template for output.
Empty items after parsing the template will be ignored (you can calling third-party snippets in the template and set your own display conditions).
Expand All @@ -52,20 +56,29 @@ Elements → Snippets: Create a new snippet with the following data
* `string_chunkName`
* `string` — use inline templates starting with `@CODE:`
* Default value: `'@CODE:[+id+]'`

* `result_itemsGlue`
* Desctription: The string that combines items while rendering.
* Valid values: `string`
* Default value: `''`

* `result_toPlaceholder`
* Desctription: Returns value to the placeholder.
* Valid values:
* `0`
* `1`
* Default value: `0`

* `result_toPlaceholder_name`
* Desctription: Placeholder name.
* Valid values: `string`
* Default value: `'ddParent'`


## [Home page →](http://code.divandesign.biz/modx/ddgetparentid)
## Links

* [Home page](https://code.divandesign.biz/modx/ddgetparentid)
* [Telegram chat](https://t.me/dd_code)


<link rel="stylesheet" type="text/css" href="https://DivanDesign.ru/assets/files/ddMarkdown.css" />
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "dd/evolutioncms-snippets-ddgetparentid",
"type": "modxevo-snippet",
"version": "1.3",
"version": "1.3.1",
"description": "Gets document parent ID(s) of the required level.",
"keywords": [
"modx",
Expand All @@ -14,6 +14,6 @@
],
"require": {
"php": ">=5.4.0",
"dd/modxevo-library-ddtools": ">=0.30"
"dd/evolutioncms-libraries-ddtools": ">=0.40.1"
}
}
16 changes: 9 additions & 7 deletions ddGetParentId_snippet.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<?php
/**
* ddGetParentId
* @version 1.3 (2020-03-02)
* @version 1.3.1 (2020-06-22)
*
* @see README.md
*
* @link http://code.divandesign.biz/modx/ddgetparentid
* @link https://code.divandesign.biz/modx/ddgetparentid
*
* @copyright 2011–2020 DivanDesign {@link http://www.DivanDesign.biz }
* @copyright 2011–2020 DD Group {@link https://DivanDesign.biz }
*/

global $modx;

//Include (MODX)EvolutionCMS.libraries.ddTools
require_once(
$modx->getConfig('base_path') .
Expand All @@ -20,14 +22,14 @@
$snippetResult = '';

//Bacward compatibility
extract(\ddTools::verifyRenamedParams(
$params,
[
extract(\ddTools::verifyRenamedParams([
'params' => $params,
'compliance' => [
'result_itemTpl' => 'tpl',
'result_toPlaceholder' => 'toPlaceholder',
'result_toPlaceholder_name' => 'placeholderName',
]
));
]));

$id =
isset($id) ?
Expand Down

0 comments on commit e96df94

Please sign in to comment.