/** * Custom values loading function for dependent select * * @param $form * @return array ('value' => 'text') for selectbox */ public function getValuesEventId($form) { $type = $form['type']->getValue(); switch ($type) { case 'Akce': $event = $this->events->getEventsWithoutNews(); break; case 'Kronika': $event = $this->events->getChroniclesWithoutNews(); break; default: return ['' => '- - - - -']; } $event = $event->fetchAll(); array_walk($event, function (&$value, $key) use(&$event) { $value = $value->dateend->format('Y/m/d') . ' - ' . $value->name; }); return $event; }