AutorÃa | Ultima modificación | Ver Log |
<?phpdeclare(strict_types=1);namespace LeadersLinked\Form;use Laminas\Form\Form;use Laminas\Db\Adapter\AdapterInterface;use LeadersLinked\Mapper\PushTemplateMapper;use LeadersLinked\Model\PushTemplate;class PushMicrolearningNotificationForm extends Form{/**** @param AdapterInterface $adapter*/public function __construct($adapter){parent::__construct();$this->setInputFilter(new PushMicrolearningNotificationFilter($adapter));$this->add(['name' => 'push_template_id','type' => \Laminas\Form\Element\Select::class,'attributes' => ['id' => 'push_template_id',],'options' => ['value_options' => $this->getSelectOptions($adapter)]]);}/**** @param AdapterInterface $adapter*/private function getSelectOptions($adapter){$options = [];$mapper = PushTemplateMapper::getInstance($adapter);$records = $mapper->fetchAllActiveByType(PushTemplate::TYPE_MICRO_LEARNING);foreach($records as $record){$options[$record->uuid] = $record->title;}return $options;}}