Back to EditorField class

Method __set

public void
__set
(mixed $name, mixed $value)
Method to set certain otherwise inaccessible properties of the form field object.
Parameters
  • string $name The property name for which to set the value.
  • mixed $value The value of the property.
Returns
  • void
Since
  • 3.2
Class: EditorField
Project: Joomla

Method __set - Source code

/**
 * Method to set certain otherwise inaccessible properties of the form field object.
 *
 * @param   string  $name   The property name for which to set the value.
 * @param   mixed   $value  The value of the property.
 *
 * @return  void
 *
 * @since   3.2
 */
public function __set($name, $value)
{
    switch ($name) {
        case 'height':
        case 'width':
        case 'assetField':
        case 'authorField':
        case 'asset':
            $this->{$name} = (string) $value;
            break;
        case 'buttons':
            $value = (string) $value;
            if ($value === 'true' || $value === 'yes' || $value === '1') {
                $this->buttons = true;
            } elseif ($value === 'false' || $value === 'no' || $value === '0') {
                $this->buttons = false;
            } else {
                $this->buttons = explode(',', $value);
            }
            break;
        case 'hide':
            $value = (string) $value;
            $this->hide = $value ? explode(',', $value) : array();
            break;
        case 'editorType':
            // Can be in the form of: editor="desired|alternative".
            $this->editorType = explode('|', trim((string) $value));
            break;
        default:
            parent::__set($name, $value);
    }
}