From 46312a4d781cd9d8691b5aa088ee9271f3787484 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 9 Jul 2013 20:22:39 -0700 Subject: [PATCH] CRM-12865 - Define regions and CSS classes for profile forms With this revision, the following can be used: * civicrm/profile * CSS: form#Search .crm-profile-name-{NAME} * Region: profile-search-{NAME} * civicrm/profile/create: * CSS: form#Edit .crm-profile-name-{NAME} * Region: profile-form-{NAME} * civicrm/profile/edit: * CSS: form#Edit .crm-profile-name-{NAME} * Region: profile-form-{NAME} * civicrm/profile/view: * CSS: .crm-profile-view .crm-profile-name-{NAME} * Region: profile-view-{NAME} * civicrm/event/register: * CSS: .crm-event-register-form-block .crm-profile-name-{NAME} * civicrm/contribute/transact: * CSS: .crm-contribution-main-form-block .crm-profile-name-{NAME} ---------------------------------------- * CRM-12865: Define hook/CSS/region names for profile forms http://issues.civicrm.org/jira/browse/CRM-12865 --- CRM/Profile/Form.php | 6 +++++- CRM/Profile/Page/Dynamic.php | 1 + CRM/Profile/Page/Listings.php | 4 ++++ templates/CRM/Profile/Form/Dynamic.tpl | 5 +++++ templates/CRM/Profile/Page/Dynamic.tpl | 4 ++++ templates/CRM/Profile/Page/Listings.tpl | 9 ++++++++- 6 files changed, 27 insertions(+), 2 deletions(-) diff --git a/CRM/Profile/Form.php b/CRM/Profile/Form.php index 4adf3181eb..e96653dbbe 100644 --- a/CRM/Profile/Form.php +++ b/CRM/Profile/Form.php @@ -256,13 +256,17 @@ class CRM_Profile_Form extends CRM_Core_Form { } $this->_isContactActivityProfile = CRM_Core_BAO_UFField::checkContactActivityProfileType($this->_gid); - //get values for captch and dupe update. + //get values for ufGroupName, captch and dupe update. + $this->assign('ufGroupName', 'unknown'); // override later (if possible) if ($this->_gid) { $dao = new CRM_Core_DAO_UFGroup(); $dao->id = $this->_gid; if ($dao->find(TRUE)) { $this->_isUpdateDupe = $dao->is_update_dupe; $this->_isAddCaptcha = $dao->add_captcha; + if (!empty($dao->name)) { + $this->assign('ufGroupName', $dao->name); + } } $dao->free(); } diff --git a/CRM/Profile/Page/Dynamic.php b/CRM/Profile/Page/Dynamic.php index d66d1b547c..3847e71b05 100644 --- a/CRM/Profile/Page/Dynamic.php +++ b/CRM/Profile/Page/Dynamic.php @@ -333,6 +333,7 @@ class CRM_Profile_Page_Dynamic extends CRM_Core_Page { } $name = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'name'); + $this->assign('ufGroupName', $name); if (strtolower($name) == 'summary_overlay') { $template->assign('overlayProfile', TRUE); diff --git a/CRM/Profile/Page/Listings.php b/CRM/Profile/Page/Listings.php index e7993ab1f0..3f2b4a447a 100644 --- a/CRM/Profile/Page/Listings.php +++ b/CRM/Profile/Page/Listings.php @@ -283,6 +283,7 @@ class CRM_Profile_Page_Listings extends CRM_Core_Page { $this->preProcess(); $this->assign('recentlyViewed', FALSE); + $this->assign('ufGroupName', 'unknown'); // override later (if possible) if ($this->_gid) { $ufgroupDAO = new CRM_Core_DAO_UFGroup(); @@ -297,6 +298,9 @@ class CRM_Profile_Page_Listings extends CRM_Core_Page { if ($ufgroupDAO->title) { CRM_Utils_System::setTitle($ufgroupDAO->title); } + if ($ufgroupDAO->name) { + $this->assign('ufGroupName', $ufgroupDAO->name); + } } $this->assign('isReset', TRUE); diff --git a/templates/CRM/Profile/Form/Dynamic.tpl b/templates/CRM/Profile/Form/Dynamic.tpl index ea15467627..389f91f0c1 100644 --- a/templates/CRM/Profile/Form/Dynamic.tpl +++ b/templates/CRM/Profile/Form/Dynamic.tpl @@ -23,6 +23,9 @@ | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ *} +
+{crmRegion name=profile-form-`$ufGroupName`} + {* Profile forms when embedded in CMS account create (mode=1) or cms account edit (mode=8) or civicrm/profile (mode=4) pages *} {if ($context eq 'multiProfileDialog')} @@ -374,3 +377,5 @@ cj(document).ready(function(){ {/literal} +{/crmRegion} +
{* end crm-profile-NAME *} diff --git a/templates/CRM/Profile/Page/Dynamic.tpl b/templates/CRM/Profile/Page/Dynamic.tpl index 4166e61305..8664b5124e 100644 --- a/templates/CRM/Profile/Page/Dynamic.tpl +++ b/templates/CRM/Profile/Page/Dynamic.tpl @@ -29,6 +29,8 @@ {include file="CRM/Profile/Page/Overlay.tpl"} {else}
+
+ {crmRegion name=profile-view-`$ufGroupName`} {foreach from=$profileFields item=field key=rowName}
@@ -40,6 +42,8 @@
{/foreach} + {/crmRegion} +
{/if} {/if} diff --git a/templates/CRM/Profile/Page/Listings.tpl b/templates/CRM/Profile/Page/Listings.tpl index dc1971a2c9..21c579906e 100644 --- a/templates/CRM/Profile/Page/Listings.tpl +++ b/templates/CRM/Profile/Page/Listings.tpl @@ -23,6 +23,10 @@ | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ *} + +
+{crmRegion name=profile-search-`$ufGroupName`} + {* make sure there are some fields in the selector *} {if ! empty( $columnHeaders ) || $isReset } @@ -89,4 +93,7 @@ {ts}No fields in this Profile have been configured to display as a result column in the search results table. Ask the site administrator to check the Profile setup.{/ts}
{/if} -
\ No newline at end of file + + +{/crmRegion} +{* crm-profile-name-NAME *} -- 2.25.1