From 150b9b00cfe0bc7266e8448c572f28ea7001afa7 Mon Sep 17 00:00:00 2001 From: Yuri Salimovskiy Date: Thu, 5 Jan 2023 14:11:02 +0200 Subject: [PATCH 1/3] 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 6ba552dba94cb0c328f27bb6f0e19371199521f8 Mon Sep 17 00:00:00 2001 From: Tom Jaeger Date: Fri, 3 Feb 2023 15:13:16 -0500 Subject: [PATCH 2/3] Update tab-files.md quick fix --- docs/development/tab-files.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/development/tab-files.md b/docs/development/tab-files.md index a2e400bb8..39de4acff 100644 --- a/docs/development/tab-files.md +++ b/docs/development/tab-files.md @@ -77,7 +77,7 @@ class Amazing_add_on_tab } - // This function is needed to display data as Entry Manager column + // This function is needed to display data as an Entry Manager column public function renderTableCell($data, $field_id, $entry) { $entry_meta = $this->getEntryMeta($entry->entry_id); @@ -227,4 +227,4 @@ Display the tab data as column in the Entry Manager Sets [table column configuration](development/services/table.html#setting-the-columns) for Entry Manager -Returns `Array` \ No newline at end of file +Returns `Array` From a062b653b1727ba45a44bdc95b0839b33003ebea Mon Sep 17 00:00:00 2001 From: Brad Akin Date: Tue, 9 May 2023 15:13:37 -0400 Subject: [PATCH 3/3] spelling --- docs/development/tab-files.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/development/tab-files.md b/docs/development/tab-files.md index 39de4acff..dc9eac73a 100644 --- a/docs/development/tab-files.md +++ b/docs/development/tab-files.md @@ -17,7 +17,7 @@ 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. Tabs can also optionally display the associated data as columns in Entry Manager. +Add-ons can also add tabs which are visible on in [Publish Layouts](control-panel/channels.md#publish-layouts). Respectively 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