From 1fcd32ad872a29e34b08bafd8c2b19e86c595189 Mon Sep 17 00:00:00 2001 From: William Mortada Date: Mon, 10 Oct 2022 13:49:10 +0100 Subject: [PATCH] Improve metadata for LocationType and add standalone path to edit form --- CRM/Admin/Form/LocationType.php | 7 +++++++ CRM/Admin/Page/LocationType.php | 4 ++-- CRM/Core/DAO/LocationType.php | 13 ++++++++++++- CRM/Core/xml/Menu/Admin.xml | 5 +++++ xml/schema/Core/LocationType.xml | 5 +++++ 5 files changed, 31 insertions(+), 3 deletions(-) diff --git a/CRM/Admin/Form/LocationType.php b/CRM/Admin/Form/LocationType.php index 433d592bb7..dfadc78188 100644 --- a/CRM/Admin/Form/LocationType.php +++ b/CRM/Admin/Form/LocationType.php @@ -25,6 +25,13 @@ class CRM_Admin_Form_LocationType extends CRM_Admin_Form { */ public $submitOnce = TRUE; + public function preProcess(): void { + CRM_Utils_Request::retrieve('action', 'String', $this); + CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0); + $this->set('BAOName', 'CRM_Core_BAO_LocationType'); + parent::preProcess(); + } + /** * Build the form object. */ diff --git a/CRM/Admin/Page/LocationType.php b/CRM/Admin/Page/LocationType.php index 0b8b902276..cb4ef709eb 100644 --- a/CRM/Admin/Page/LocationType.php +++ b/CRM/Admin/Page/LocationType.php @@ -50,7 +50,7 @@ class CRM_Admin_Page_LocationType extends CRM_Core_Page_Basic { self::$_links = [ CRM_Core_Action::UPDATE => [ 'name' => ts('Edit'), - 'url' => 'civicrm/admin/locationType', + 'url' => 'civicrm/admin/locationType/edit', 'qs' => 'action=update&id=%%id%%&reset=1', 'title' => ts('Edit Location Type'), ], @@ -66,7 +66,7 @@ class CRM_Admin_Page_LocationType extends CRM_Core_Page_Basic { ], CRM_Core_Action::DELETE => [ 'name' => ts('Delete'), - 'url' => 'civicrm/admin/locationType', + 'url' => 'civicrm/admin/locationType/edit', 'qs' => 'action=delete&id=%%id%%', 'title' => ts('Delete Location Type'), ], diff --git a/CRM/Core/DAO/LocationType.php b/CRM/Core/DAO/LocationType.php index bdb2be23c2..2ea97c4c6b 100644 --- a/CRM/Core/DAO/LocationType.php +++ b/CRM/Core/DAO/LocationType.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/LocationType.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:074707b1abfcd12cace2a46004becaaa) + * (GenCodeChecksum:11ee4614aa4a1cfdf4b7a2c65ab760e0) */ /** @@ -30,6 +30,17 @@ class CRM_Core_DAO_LocationType extends CRM_Core_DAO { */ public static $_log = TRUE; + /** + * Paths for accessing this entity in the UI. + * + * @var string[] + */ + protected static $_paths = [ + 'add' => 'civicrm/admin/locationType/edit?action=add&reset=1', + 'update' => 'civicrm/admin/locationType/edit?action=update&id=[id]&reset=1', + 'delete' => 'civicrm/admin/locationType/edit?action=delete&id=[id]&reset=1', + ]; + /** * Location Type ID * diff --git a/CRM/Core/xml/Menu/Admin.xml b/CRM/Core/xml/Menu/Admin.xml index 030b2b03d9..f1b20277b1 100644 --- a/CRM/Core/xml/Menu/Admin.xml +++ b/CRM/Core/xml/Menu/Admin.xml @@ -162,6 +162,11 @@ Customize Data and Screens 60 + + civicrm/admin/locationType/edit + Edit Location Type + CRM_Admin_Form_LocationType + civicrm/admin/options/website_type Website Types diff --git a/xml/schema/Core/LocationType.xml b/xml/schema/Core/LocationType.xml index 36d8739e02..3a8ffaa3ee 100644 --- a/xml/schema/Core/LocationType.xml +++ b/xml/schema/Core/LocationType.xml @@ -6,6 +6,11 @@ civicrm_location_type 1.1 true + + civicrm/admin/locationType/edit?action=add&reset=1 + civicrm/admin/locationType/edit?action=update&id=[id]&reset=1 + civicrm/admin/locationType/edit?action=delete&id=[id]&reset=1 + id Location Type ID -- 2.25.1