public function __construct($attributes) { if (is_object($attributes)) { $attributes = (array) $attributes; } parent::__construct($attributes); }
/** * Class constructor * * @param string $name Element name * @param string|array $attributes HTML attributes (either a string or an array) * @param array $data Element data (label, options used for element setup) */ public function __construct($name = null, $attributes = null, array $data = array()) { parent::__construct($attributes); $this->setName($name); // Autogenerating the id if not set on previous steps if ('' == $this->getId()) { $this->setId(); } if (!empty($data)) { $this->data = array_merge($this->data, $data); } }
/** * Class constructor * * @param string Element name * @param mixed Attributes (either a string or an array) * @param array Element data (label, options and data used for element creation) */ public function __construct($name = null, $attributes = null, $data = null) { parent::__construct($attributes); $this->setName($name); // Autogenerating the id if not set on previous steps if ('' == $this->getId()) { $this->setId(); } if (!is_null($data)) { $this->data = $data; } }