/**
  * Method to attach a JForm object to the field.
  *
  * @param	object	$element	The JXMLElement object representing the <field /> tag for the
  * 								form field object.
  * @param	mixed	$value		The form field default value for display.
  * @param	string	$group		The field name group control value. This acts as as an array
  * 								container for the field. For example if the field has name="foo"
  * 								and the group value is set to "bar" then the full field name
  * 								would end up being "bar[foo]".
  *
  * @return	boolean	True on success.
  * @since	1.6
  */
 public function setup(&$element, $value, $group = null)
 {
     // Make sure there is a valid JFormField XML element.
     if (!$element instanceof GantrySimpleXMLElement || (string) $element->getName() != 'fields') {
         return false;
     }
     if (!parent::setup($element, $value, $group)) {
         return false;
     }
     $this->fields = $this->form->getSubFields($this->element);
     foreach ($this->fields as $field) {
         if ($field->variance) {
             $this->variance = true;
         }
     }
     return true;
 }
Пример #2
0
 /**
  * Method to attach a JForm object to the field.
  *
  * @param	object	$element	The JXMLElement object representing the <field /> tag for the
  * 								form field object.
  * @param	mixed	$value		The form field default value for display.
  * @param	string	$group		The field name group control value. This acts as as an array
  * 								container for the field. For example if the field has name="foo"
  * 								and the group value is set to "bar" then the full field name
  * 								would end up being "bar[foo]".
  *
  * @return	boolean	True on success.
  * @since	1.6
  */
 public function setup(&$element, $value, $group = null)
 {
     global $gantry;
     // Make sure there is a valid JFormField XML element.
     if (!$element instanceof GantrySimpleXMLElement || (string) $element->getName() != 'field') {
         return false;
     }
     if (!parent::setup($element, $value, $group)) {
         return false;
     }
     $multiple = (string) $element['multiple'];
     // Set the multiple values option.
     $this->multiple = $multiple == 'true' || $multiple == 'multiple';
     // Allow for field classes to force the multiple values option.
     if (isset($this->forceMultiple)) {
         $this->multiple = (bool) $this->forceMultiple;
     }
     return true;
 }