INFRA-132 - Copyright header - Drupal.WhiteSpace.ScopeIndent.IncorrectExact
[civicrm-core.git] / CRM / Admin / Form / Tag.php
index 861bb978ab6c3f77c34849aeafbf2c06b9cf5114..e1c9a276be5f47fda98de0762e8781ad6df4484e 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
@@ -23,7 +23,7 @@
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  *
@@ -44,7 +44,6 @@ class CRM_Admin_Form_Tag extends CRM_Admin_Form {
    * Build the form object
    *
    * @return void
-   * @access public
    */
   public function buildQuickForm() {
     $this->setPageTitle($this->_isTagSet ? ts('Tag Set') : ts('Tag'));
@@ -76,6 +75,14 @@ class CRM_Admin_Form_Tag extends CRM_Admin_Form {
 
       if (!$this->_isTagSet) {
         $this->add('select', 'parent_id', ts('Parent Tag'), $allTag, FALSE, array('class' => 'crm-select2'));
+
+        // Tagsets are not selectable by definition so only include the selectable field if NOT a tagset.
+        $selectable = $this->add('checkbox', 'is_selectable', ts('Selectable?'));
+        // Selectable should be checked by default when creating a new tag
+        if ($this->_action == CRM_Core_Action::ADD) {
+          $selectable->setValue(1);
+        }
+
       }
 
       $this->assign('isTagSet', $this->_isTagSet);
@@ -85,18 +92,15 @@ class CRM_Admin_Form_Tag extends CRM_Admin_Form {
       $this->add('text', 'name', ts('Name'),
         CRM_Core_DAO::getAttribute('CRM_Core_DAO_Tag', 'name'), TRUE
       );
-      $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array('CRM_Core_DAO_Tag', $this->_id));
+      $this->addRule('name', ts('Name already exists in Database.'), 'objectExists', array(
+          'CRM_Core_DAO_Tag',
+          $this->_id,
+        ));
 
       $this->add('text', 'description', ts('Description'),
         CRM_Core_DAO::getAttribute('CRM_Core_DAO_Tag', 'description')
       );
 
-      $selectable = $this->add('checkbox', 'is_selectable', ts('Selectable?'));
-      // Selectable should be checked by default when creating a new tag
-      if ($this->_action == CRM_Core_Action::ADD) {
-        $selectable->setValue(1);        
-      }
-
       $isReserved = $this->add('checkbox', 'is_reserved', ts('Reserved?'));
 
       $usedFor = $this->addSelect('used_for', array('multiple' => TRUE, 'option_url' => NULL));
@@ -127,7 +131,6 @@ class CRM_Admin_Form_Tag extends CRM_Admin_Form {
   /**
    * Process the form submission
    *
-   * @access public
    *
    * @return void
    */
@@ -171,4 +174,3 @@ class CRM_Admin_Form_Tag extends CRM_Admin_Form {
   }
 
 }
-