/**
* Method to get certain otherwise inaccessible properties from the form field object.
*
* @param string $name The property name for which to get the value.
*
* @return mixed The property value or null.
*
* @since 1.7.0
*/
public function __get($name)
{
switch ($name) {
case 'description':
case 'hint':
case 'formControl':
case 'hidden':
case 'id':
case 'multiple':
case 'name':
case 'required':
case 'type':
case 'validate':
case 'value':
case 'class':
case 'layout':
case 'labelclass':
case 'size':
case 'onchange':
case 'onclick':
case 'fieldname':
case 'group':
case 'disabled':
case 'readonly':
case 'autofocus':
case 'autocomplete':
case 'spellcheck':
case 'validationtext':
case 'showon':
case 'parentclass':
return $this->{$name};
case 'input':
// If the input hasn't yet been generated, generate it.
if (empty($this->input)) {
$this->input = $this->getInput();
}
return $this->input;
case 'label':
// If the label hasn't yet been generated, generate it.
if (empty($this->label)) {
$this->label = $this->getLabel();
}
return $this->label;
case 'title':
return $this->getTitle();
default:
// Check for data attribute
if (strpos($name, 'data-') === 0 && array_key_exists($name, $this->dataAttributes)) {
return $this->dataAttributes[$name];
}
}
}