From 0283be6eab9ff615b014e31510e7a63967abf751 Mon Sep 17 00:00:00 2001 From: Yuri Salimovskiy Date: Thu, 22 Dec 2022 11:20:42 +0200 Subject: [PATCH 01/59] variable modifier updates --- docs/development/addon-setup-php-file.md | 9 ++++ docs/development/modifiers.md | 68 ++++++++++++++++++++++++ docs/templates/variable-modifiers.md | 8 +++ 3 files changed, 85 insertions(+) create mode 100644 docs/development/modifiers.md diff --git a/docs/development/addon-setup-php-file.md b/docs/development/addon-setup-php-file.md index 364ef1297..4dd928399 100755 --- a/docs/development/addon-setup-php-file.md +++ b/docs/development/addon-setup-php-file.md @@ -114,6 +114,15 @@ As of 3.1.0 fieldtypes can specify their compatibility. When editing a Channel F | relationship | [Relationships](https://docs.expressionengine.com/latest/fieldtypes/relationships.html) | | text | [Email Address](fieldtypes/email-address.md), [Rich Text Editor](fieldtypes/rte.md), [Text Input](fieldtypes/text.md), [Textarea](fieldtypes/textarea.md),[URL](fieldtypes/url.md) | +### `modifiers` + + 'modifiers' => array( + 'modifier_name', + 'another_modifier_name' + ) + +This property lists the [variable modifiers](development/modifiers.md) that the add-on provides + ### `services` 'services' => array( diff --git a/docs/development/modifiers.md b/docs/development/modifiers.md new file mode 100644 index 000000000..f767cc4c3 --- /dev/null +++ b/docs/development/modifiers.md @@ -0,0 +1,68 @@ + + +# Developing Variable Modifiers + +The add-ons can provide their own [variable modifiers](templates/variable-modifiers.md) + +Each variable modifier needs be created as a separate file in `Modifiers` directory within add-on's own folder and registered in `addon.setup.php`. + +The file name (which will also be PHP class name) should be the modifier's name with first letter capitalized. + +All modifier files are required to implement `ExpressionEngine\Service\Template\Variables\ModifierInterface`. + +Each widget should have `namespace` definition, which should consist of the add-on's namespace as defined in `addon.setup.php` followed by `\Modifiers`. + +Lastly, the modifier's name should be registered in `addon.setup.php` + +TIP: **Tip:** Modifiers provided by add-on can be called by their name as well as by their name prefixed with add-on's name and underscore. For example below we can use `{title:hacker}` and `{title:seo_hacker}` to achieve same result + +### Example + +Let's create `:hacker` modifier which would make text look geeky by converting some letters to numbers that look similarly. The modifier would be part of "Seeo" add-on. + + array( + 'hacker' + ), + +And now, let's call it in template. + + {exp:channel:entries entry_id="1"} +
+ {title} - Hello +
+
+ {title:hacker} - H3110 +
+
+ {title:seeo_hacker} - H3110 +
+ {/exp:channel:entries} \ No newline at end of file diff --git a/docs/templates/variable-modifiers.md b/docs/templates/variable-modifiers.md index 7e053b71d..1f6ece232 100755 --- a/docs/templates/variable-modifiers.md +++ b/docs/templates/variable-modifiers.md @@ -22,6 +22,14 @@ Most template variables can be modified for common formatting and output needs w NOTE: **Note:** Some add-ons and components may have modifiers not listed here. For instance the [File Fieldtype](fieldtypes/file.md) has its own file information-related modifiers. The modifiers listed here are just those universally available. +## Modifiers syntax + +The modifiers are being applied by adding modifier name after variable name, separated by semicolon, e.g. `var_name:trim`. + +It is possible to apply several modifiers at the same time by chaing those, e.g. `var_name:trim:url_encode`. The modifiers would be applied left to right (so in this case, the variable's content will first be trimmed and then URL-encoded). + +When applying several modifiers, there could be conflict in parameter names. To avoid that, the parameters could be prefixed with modifier name followed by semicolon. E.g. `{excerpt:limit characters='20'}` could be written as `{excerpt:limit limit:characters='20'}`. This allows writing constructions such as `{excerpt:limit:trim limit:characters='20' trim::characters='\n\r'}`. Prefixed parameter has higher precedence over non-prefixed one. + ## Modifiers [TOC=3] From 486b2375864d3e1a780f8c48edea2f645a37442c Mon Sep 17 00:00:00 2001 From: Yuri Salimovskiy Date: Mon, 26 Dec 2022 11:51:11 +0200 Subject: [PATCH 02/59] typo --- docs/templates/variable-modifiers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/templates/variable-modifiers.md b/docs/templates/variable-modifiers.md index 1f6ece232..968a1df05 100755 --- a/docs/templates/variable-modifiers.md +++ b/docs/templates/variable-modifiers.md @@ -28,7 +28,7 @@ The modifiers are being applied by adding modifier name after variable name, sep It is possible to apply several modifiers at the same time by chaing those, e.g. `var_name:trim:url_encode`. The modifiers would be applied left to right (so in this case, the variable's content will first be trimmed and then URL-encoded). -When applying several modifiers, there could be conflict in parameter names. To avoid that, the parameters could be prefixed with modifier name followed by semicolon. E.g. `{excerpt:limit characters='20'}` could be written as `{excerpt:limit limit:characters='20'}`. This allows writing constructions such as `{excerpt:limit:trim limit:characters='20' trim::characters='\n\r'}`. Prefixed parameter has higher precedence over non-prefixed one. +When applying several modifiers, there could be conflict in parameter names. To avoid that, the parameters could be prefixed with modifier name followed by semicolon. E.g. `{excerpt:limit characters='20'}` could be written as `{excerpt:limit limit:characters='20'}`. This allows writing constructions such as `{excerpt:limit:trim limit:characters='20' trim:characters='\n\r'}`. Prefixed parameter has higher precedence over non-prefixed one. ## Modifiers From 150b9b00cfe0bc7266e8448c572f28ea7001afa7 Mon Sep 17 00:00:00 2001 From: Yuri Salimovskiy Date: Thu, 5 Jan 2023 14:11:02 +0200 Subject: [PATCH 03/59] let tabs display data in entry manager --- docs/development/fieldtypes/fieldtypes.md | 6 +++++ docs/development/tab-files.md | 30 +++++++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/docs/development/fieldtypes/fieldtypes.md b/docs/development/fieldtypes/fieldtypes.md index 0de4e271b..e9dda73b8 100644 --- a/docs/development/fieldtypes/fieldtypes.md +++ b/docs/development/fieldtypes/fieldtypes.md @@ -219,6 +219,12 @@ Display the field data as column in the Entry Manager | \$entry | `Array` | Current `ChannelEntry` object | | Returns | `String` | The string to display in Entry Manager column | +#### `EE_Fieldtype::getTableColumnConfig()` + +Sets [table column configuration](development/services/table.html#setting-the-columns) for Entry Manager + +Returns `Array` + #### `EE_Fieldtype::validate($data)` Validates the field input diff --git a/docs/development/tab-files.md b/docs/development/tab-files.md index 5ff23ad0e..a2e400bb8 100644 --- a/docs/development/tab-files.md +++ b/docs/development/tab-files.md @@ -17,7 +17,9 @@ lang: php [TOC] ## Overview -Add-ons can also add tabs which are visible on in [Publish Layouts](control-panel/channels.md#publish-layouts). Respectivley these tabs would also be visible on the Entry Publish/Edit page if selected in the publish layout. Two things are required for your add-on to have this functionality: +Add-ons can also add tabs which are visible on in [Publish Layouts](control-panel/channels.md#publish-layouts). Respectivley these tabs would also be visible on the Entry Publish/Edit page if selected in the publish layout. Tabs can also optionally display the associated data as columns in Entry Manager. + +Two things are required for your add-on to have this functionality: - [`tabs()` method](/development/add-on-update-file.md#add-publish-tabs-with-your-add-on-tabs) added to the Update File - The Tab File (`tab.[addon_name].php`) @@ -75,6 +77,13 @@ class Amazing_add_on_tab } + // This function is needed to display data as Entry Manager column + public function renderTableCell($data, $field_id, $entry) + { + $entry_meta = $this->getEntryMeta($entry->entry_id); + return json_encode($entry_meta); + } + } ``` @@ -201,4 +210,21 @@ Called during a `ChannelEntry` entity's `afterSave` event, this allows you to in | \$entry_ids | `array` | Channel ID where the entry is being created or edited | | Returns | `Void` | | -Called during a `ChannelEntry` entity's `beforeDelete` event, this allows you to sync your records if any are tied to channel entry_ids. \ No newline at end of file +Called during a `ChannelEntry` entity's `beforeDelete` event, this allows you to sync your records if any are tied to channel entry_ids. + +### `renderTableCell($data, $field_id, $entry)` + +Display the tab data as column in the Entry Manager + +| Parameter | Type | Description | +| --------- | -------- | ----------------------------------------- | +| \$data | `Array` | Ignored by tab files | +| \$field_id| `Int` | Ignored by tab files | +| \$entry | `Array` | Current `ChannelEntry` object | +| Returns | `String` | The string to display in Entry Manager column | + +#### `getTableColumnConfig()` + +Sets [table column configuration](development/services/table.html#setting-the-columns) for Entry Manager + +Returns `Array` \ No newline at end of file From 04a0bed12b7e8f5a9fe7ae38f0c23c7df3491b71 Mon Sep 17 00:00:00 2001 From: Yuri Salimovskiy Date: Wed, 18 Jan 2023 15:48:35 +0200 Subject: [PATCH 04/59] search module docs --- docs/add-ons/search/advanced.md | 59 ++++++++++++++++++++++++++++++++- docs/add-ons/search/simple.md | 16 +++++++++ 2 files changed, 74 insertions(+), 1 deletion(-) diff --git a/docs/add-ons/search/advanced.md b/docs/add-ons/search/advanced.md index 48f012909..652ee127d 100755 --- a/docs/add-ons/search/advanced.md +++ b/docs/add-ons/search/advanced.md @@ -267,6 +267,63 @@ With this parameter, you can specify the css class you want the form to have, en With this parameter, you can specify the css id you want the form to have. +### `orderby=` + + orderby="entry_date" + +The "orderby" parameter sets the display order of the entries. The available values for this property are `entry_date`, `most_comments`, `recent_comment`, `title`, `status`, `entry_id`, `url_title`, `edit_date`, `comment_total`, `expiration_date`, `view_count_one`, `view_count_two`, `view_count_three`, `view_count_four`.` + +If this parameter is not set, it will default to ordering by entry date. + +### `sort=` + + sort="asc" + + sort="desc" + +The sort order can be "asc" (ascending order or "oldest item first") or "desc" (descending order or "newest item first"). If you do not use a sort order the default is desc. + ## Variables -A full discussion of the available variables is not feasible there is a great deal of interdependence between the various form fields, variables, and javascript functions. The Parameters can be used to modify how the search behaves. If you wish to modify the search form itself, simply use the default form as a base and customize it from there. +### `channel_names` + +Pre-populated string containing list of `