Example #1
0
 /**
  * Method to attach a JForm object to the field.
  *
  * @param    object    $element      The RokCommon_XMLElement 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 RokCommon_XMLElement XML element.
     if (!$element instanceof RokCommon_XMLElement || (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->customized = true;
         }
     }
     return true;
 }
 /**
  * Method to instantiate the form field object.
  *
  * @param   object  $form  The form to attach to the form field object.
  *
  * @since   11.1
  */
 public function __construct($form = null)
 {
     parent::__construct($form);
     // Detect the field type if not set
     if (!isset($this->type)) {
         $parts = JString::splitCamelCase(get_class($this));
         if ($parts[0] == 'J') {
             $this->type = JString::ucfirst($parts[count($parts) - 1], '_');
         } else {
             $this->type = JString::ucfirst($parts[0], '_') . JString::ucfirst($parts[count($parts) - 1], '_');
         }
     }
 }
Example #3
0
 /**
  * Method to get certain otherwise inaccessible properties from the form field object.
  *
  * @param   string  $name  The property name for which to the the value.
  *
  * @return  mixed  The property value or null.
  *
  * @since   11.1
  */
 public function __get($name)
 {
     switch ($name) {
         case 'class':
         case 'description':
         case 'formControl':
         case 'hidden':
         case 'id':
         case 'multiple':
         case 'name':
         case 'required':
         case 'type':
         case 'validate':
         case 'value':
         case 'fieldname':
         case 'group':
             return $this->{$name};
         default:
             return parent::__get($name);
     }
 }