public function __construct($label = 'Address type', array $choices = null) { if (null === $choices) { $choices = ['all' => 'All', 'delivery' => 'Delivery', 'billing' => 'Billing']; } $this->setFormChoices($choices); parent::__construct(self::NAME, $label, null, true); }
public function getChoices() { $choices = parent::getChoices(); if (null === $choices) { return $choices; } if (!is_array($choices)) { $choices = [$choices]; } if (in_array('EU', $choices)) { $choices = $choices + array_keys($this->_countryList->getEU()); foreach ($choices as $key => $choice) { if ($choice === 'EU') { unset($choices[$key]); } } } return array_values($choices); }
/** * Set form choices in constructor and get name and label from child class */ public function __construct() { $this->setFormChoices(['yes' => 'Yes', 'no' => 'No']); parent::__construct($this->_getName(), $this->_getLabel()); }
public function __construct($label = 'Brands', array $choices = []) { $this->setFormChoices($choices); parent::__construct(self::NAME, $label, null, true); }