public function __construct($attributes = '') { if (!is_array($attributes)) { $attributes = array('action' => (string) $attributes); } $this->setAttributes($attributes); parent::__construct(); }
public function __construct($attributes = '') { // assume non-array is legend if (!is_array($attributes)) { $attributes = array('legend' => $attributes); } // handle legend if (array_key_exists('legend', $attributes)) { if (!$attributes['legend'] instanceof Legend) { $attributes['legend'] = new Legend($attributes['legend']); } $this->setChild($attributes['legend']); unset($attributes['legend']); } // set all attributes $this->setAttributes($attributes); parent::__construct(); }