/** * {@inheritdoc} */ public function buildView(FormView $view, FormInterface $form, array $options) { $data = $form->getData(); if ($data instanceof Item) { $view->vars['label'] = $this->resolver->getLabel($data->getType()); } return; }
public function buildView(FormView $view, FormInterface $form, array $options) { $items = array(); if (count($options['items'])) { foreach ($options['items'] as $item) { $items[] = array('type' => $item['type'], 'label' => isset($item['label']) ? $item['label'] : $this->resolver->getLabel($item['type']), 'translationDomain' => isset($item['translationDomain']) ? $item['translationDomain'] : 'EnhavoGridBundle'); } } else { foreach ($this->resolver->getItems() as $name => $item) { $items[] = array('type' => $name, 'label' => $this->resolver->getLabel($name), 'translationDomain' => isset($item['translationDomain']) ? $item['translationDomain'] : 'EnhavoGridBundle'); } } $view->vars['items'] = $items; }