From 9ecf80312da1daa33a2677a3d2d4796c44242be9 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Wed, 22 Oct 2014 10:30:41 -0400 Subject: [PATCH] settings: Refactor method. * CRM/Admin/Form/Setting/MemberDashboard.php (CRM_Admin_Form_Setting_MemberDashboard) [fetchProfiles]: New method. [buildQuickForm]: Use it. --- CRM/Admin/Form/Setting/MemberDashboard.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/CRM/Admin/Form/Setting/MemberDashboard.php b/CRM/Admin/Form/Setting/MemberDashboard.php index b9c4ca6..fb6584c 100644 --- a/CRM/Admin/Form/Setting/MemberDashboard.php +++ b/CRM/Admin/Form/Setting/MemberDashboard.php @@ -27,8 +27,10 @@ class CRM_Admin_Form_Setting_MemberDashboard extends CRM_Admin_Form_Setting { return CRM_Core_BAO_Setting::getItem(MEMBERDASHBOARD_SETTINGS_GROUP); } - public function buildQuickForm() { - // Fetch the names and ids of all unreserved profiles. + /** + * Fetch the names and ids of all unreserved profiles. + */ + function fetchProfiles() { $sql = 'SELECT id, title FROM civicrm_uf_group WHERE is_reserved=0'; $dao = CRM_Core_DAO::executeQuery($sql); $profiles = array(); @@ -37,8 +39,12 @@ class CRM_Admin_Form_Setting_MemberDashboard extends CRM_Admin_Form_Setting { $profiles[$dao->id] = $dao->title; } + return $profiles; + } + + public function buildQuickForm() { $this->add('select', 'memberdashboard_info_profile_id', - 'Member Info Profile', $profiles); + 'Member Info Profile', $this->fetchProfiles()); $this->applyFilter('__ALL__', 'trim'); $this->addButtons(array( array( -- 2.25.1