diff --git a/CRM/Eck/Page/Entity/TabHeader.php b/CRM/Eck/Page/Entity/TabHeader.php index 95a5ec4..eae204e 100644 --- a/CRM/Eck/Page/Entity/TabHeader.php +++ b/CRM/Eck/Page/Entity/TabHeader.php @@ -96,6 +96,14 @@ public static function process(&$page) { ] + $default; Civi::service('angularjs.loader')->addModules($module); + $tabs['tags'] = [ + 'title' => ts('Tags'), + 'link' => CRM_Utils_System::url( + 'civicrm/eck/entity/tag', + "reset=1&type={$entityType['name']}&id={$entityID}" + ), + ] + $default; + // see if any other modules want to add any tabs // note: status of 'valid' flag of any injected tab, needs to be taken care in the hook implementation. CRM_Utils_Hook::tabset( diff --git a/CRM/Eck/Page/Entity/Tag.php b/CRM/Eck/Page/Entity/Tag.php new file mode 100644 index 0000000..3ecd594 --- /dev/null +++ b/CRM/Eck/Page/Entity/Tag.php @@ -0,0 +1,67 @@ +_action); + $controller->setEmbedded(TRUE); + $controller->reset(); + $controller->set('entityTable', $entity_types[$this->_entityType]['table_name']); + $controller->set('entityID', $this->_entityId); + $controller->process(); + $controller->run(); + } + + public function preProcess() { + $this->_entityType = CRM_Utils_Request::retrieve('type', 'String', $this, TRUE); + $this->_entityId = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE); + $this->assign('entityType', $this->_entityType); + $this->assign('entityId', $this->_entityId); + + /** + * TODO: + * Check permission for editing ECK entity tags. + * @see CRM_Contact_Page_View::checkUserPermission() + * For now, allow editing for all users. + */ + $this->assign('permission', 'edit'); + + $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse'); + $this->assign('action', $this->_action); + } + + /** + * the main function that is called when the page loads + * it decides the which action has to be taken for the page. + * + * @return null + */ + public function run() { + $this->preProcess(); + + $this->browse(); + + return parent::run(); + } + +} diff --git a/templates/CRM/Eck/Page/Entity/Tag.tpl b/templates/CRM/Eck/Page/Entity/Tag.tpl new file mode 100644 index 0000000..972635c --- /dev/null +++ b/templates/CRM/Eck/Page/Entity/Tag.tpl @@ -0,0 +1,17 @@ +{*-------------------------------------------------------+ +| CiviCRM Entity Construction Kit | +| Copyright (C) 2022 SYSTOPIA | +| Author: J. Schuppe (schuppe@systopia.de) | ++--------------------------------------------------------+ +| This program is released as free software under the | +| Affero GPL license. You can redistribute it and/or | +| modify it under the terms of this license which you | +| can read by viewing the included agpl.txt or online | +| at www.gnu.org/licenses/agpl.html. Removal of this | +| copyright header is strictly prohibited without | +| written permission from the original author(s). | ++--------------------------------------------------------*} + +{crmScope extensionKey='de.systopia.eck'} + {include file="CRM/Tag/Form/Tag.tpl"} +{/crmScope} diff --git a/xml/Menu/eck.xml b/xml/Menu/eck.xml index 8e7729d..a5a3f2c 100644 --- a/xml/Menu/eck.xml +++ b/xml/Menu/eck.xml @@ -32,4 +32,10 @@