buildView() публичный Метод

This method gets called for each type in the hierarchy starting form the top most type. Type extensions can further modify the view.
См. также: FormTypeExtensionInterface::buildView()
public buildView ( Symfony\Component\Form\FormView $view, Symfony\Component\Form\FormInterface $form )
$view Symfony\Component\Form\FormView The view
$form Symfony\Component\Form\FormInterface The form
 /**
  * @param FormView      $view
  * @param FormInterface $form
  * @param array         $options
  */
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     parent::buildView($view, $form, $options);
     if (isset($view->vars['name']) && '' !== $view->vars['name'] && null !== $view->vars['name']) {
         $view->vars['label'] = 'open_orchestra_backoffice.form.content_type.default_listable_label.' . $view->vars['name'];
     }
 }
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     parent::buildView($view, $form, $options);
     $view->vars['label'] = false;
     $view->vars['attr'] = array();
     $view->vars['label_attr'] = array();
 }
Пример #3
0
 /**
  * {@inheritdoc}
  */
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     $view->vars['dataSrc'] = $this->getDataSrc();
     $view->vars['lookaheadId'] = $options['lookahead_id'];
     $view->vars['lateInit'] = $options['late_init'];
     parent::buildView($view, $form, $options);
 }
Пример #4
0
 /**
  * {@inheritdoc}
  */
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     $widgetOptions = $this->parseWidgetOptions(array_intersect_key($options, $this->widgetOptions));
     $view->vars['attr']['switchery'] = null;
     $view->vars['attr']['switchery-options'] = json_encode($widgetOptions);
     parent::buildView($view, $form, $options);
 }
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     parent::buildView($view, $form, $options);
     $view->vars['labelAdd'] = $options['labelAdd'];
     $view->vars['labelDelete'] = $options['labelDelete'];
     $view->vars['prototype_name'] = $options['prototype_name'];
 }
Пример #6
0
 /**
  * {@inheritdoc}
  */
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     parent::buildView($view, $form, $options);
     /** @var SimpleChoiceList $choices */
     $choices = $form->get('type')->getConfig()->getOption('choice_list');
     $view->vars['datetime_range_metadata'] = ['name' => $view->vars['full_name'] . '[type]', 'label' => $view->vars['label'], 'choices' => $choices->getRemainingViews(), 'typeValues' => $view->vars['type_values'], 'dateParts' => $view->vars['date_parts'], 'externalWidgetOptions' => array_merge($view->vars['widget_options'], ['dateVars' => $view->vars['date_vars']]), 'templateSelector' => '#date-filter-template-wo-actions', 'criteriaValueSelectors' => ['type' => 'select', 'date_type' => 'select[name!=date_part]', 'date_part' => 'select[name=date_part]', 'value' => ['start' => 'input[name=\\"' . $view->vars['full_name'] . '[value][start]\\"]', 'end' => 'input[name=\\"' . $view->vars['full_name'] . '[value][end]\\"]']]];
 }
Пример #7
0
 /**
  * {@inheritdoc}
  */
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     parent::buildView($view, $form, $options);
     if (array_key_exists('mde_config', $options)) {
         $view->vars['mde_config'] = $options['mde_config'];
     }
 }
Пример #8
0
 /**
  * @param FormView $view
  * @param FormInterface $form
  * @param array $options
  */
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     parent::buildView($view, $form, $options);
     //        $view->vars = array_merge($view->vars, array(
     //            'entity' => $options['entity']
     //        ));
 }
 /**
  * {@inheritDoc}
  */
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     $view->vars['root'] = $options['root'];
     $view->vars['create_in_overlay'] = $options['create_in_overlay'];
     $view->vars['edit_in_overlay'] = $options['edit_in_overlay'];
     $view->vars['delete_in_overlay'] = $options['delete_in_overlay'];
     parent::buildView($view, $form, $options);
 }
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     parent::buildView($view, $form, $options);
     $view->vars['preaddonAttr'] = isset($options['attr']['preaddon_attr']) ? $options['attr']['preaddon_attr'] : [];
     $view->vars['postaddonAttr'] = isset($options['attr']['postaddon_attr']) ? $options['attr']['postaddon_attr'] : [];
     $view->vars['preaddon'] = isset($options['attr']['preaddon']) ? $options['attr']['preaddon'] : [];
     $view->vars['postaddon'] = isset($options['attr']['postaddon']) ? $options['attr']['postaddon'] : [];
 }
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     parent::buildView($view, $form, $options);
     $view->vars['type'] = 'compact' === $options['widget'] ? 'text' : 'hidden';
     $view->vars['widget'] = $options['widget'];
     $view->vars['root_node'] = $options['root_node'];
     $view->vars['repository_name'] = $options['repository_name'];
 }
Пример #12
0
 /**
  * {@inheritdoc}
  */
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     parent::buildView($view, $form, $options);
     // Detect nette/application v2.4+.
     $prefix = property_exists('Nette\\Application\\UI\\Component', 'onAnchor') && $form->getRoot()->getConfig()->getMethod() === 'POST';
     $view->vars['full_name'] = ($prefix ? '_' : '') . Presenter::SIGNAL_KEY;
     $view->vars['value'] = $options['data'];
 }
 /**
  * {@inheritDoc}
  */
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     parent::buildView($view, $form, $options);
     $view->vars['tree'] = $this->tree;
     $view->vars['root_node'] = $form->getConfig()->getAttribute('root_node');
     $view->vars['select_root_node'] = $form->getConfig()->getAttribute('select_root_node');
     $view->vars['routing_defaults'] = $this->defaults;
 }
Пример #14
0
 /**
  * {@inheritdoc}
  */
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     parent::buildView($view, $form, $options);
     $vars = array('configs' => $options['configs']);
     if ($form->getData()) {
         $vars['attr'] = array('data-entities' => json_encode(array(array('id' => $form->getData(), 'text' => $form->getData()))));
     }
     $view->vars = array_replace_recursive($view->vars, $vars);
 }
Пример #15
0
 /**
  * (non-PHPdoc)
  * @see \Symfony\Component\Form\AbstractType::buildView()
  */
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     parent::buildView($view, $form, $options);
     $attr = array("rows" => 8, "class" => "wysiwyg-editor");
     if (array_key_exists("attr", $options)) {
         $attr = array_merge($attr, $options["attr"]);
     }
     $view->vars = array_replace($view->vars, array("attr" => $attr));
 }
Пример #16
0
 /**
  * {@inheritdoc}
  */
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     parent::buildView($view, $form, $options);
     $vars = ['configs' => $options['configs']];
     if ($form->getData()) {
         $vars['attr'] = ['data-selected-data' => json_encode([['id' => $form->getData(), 'text' => $form->getData()]])];
     }
     $view->vars = array_replace_recursive($view->vars, $vars);
 }
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     $contentIds = $form->getAttribute('content_ids');
     $paths = array();
     foreach ($contentIds as $key => $id) {
         $paths[$key] = $this->router->generate(null, array('content_id' => $id));
     }
     $view->vars['content_paths'] = $paths;
     parent::buildView($view, $form, $options);
 }
 public function buildView(Form\FormView $view, Form\FormInterface $form, array $options)
 {
     parent::buildView($view, $form, $options);
     if ($form->getData() !== null) {
         $view->location = $form->getData();
         $view->has_location = true;
     } else {
         $view->has_location = false;
     }
 }
 /**
  * {@inheritdoc}
  */
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     $allFieldNames = array();
     foreach ($options['map'] as $value => $fieldNames) {
         foreach ($fieldNames as $fieldName) {
             $allFieldNames[$fieldName] = $fieldName;
         }
     }
     $allFieldNames = array_values($allFieldNames);
     $view->vars['all_fields'] = $allFieldNames;
     $view->vars['map'] = $options['map'];
     parent::buildView($view, $form, $options);
 }
 /**
  * {@inheritdoc}
  */
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     $routes = $options['routes'];
     $paths = array();
     foreach ($routes as $key => $route) {
         $name = isset($route['name']) ? $route['name'] : null;
         $parameters = isset($route['parameters']) ? $route['parameters'] : array();
         $referenceType = isset($route['referenceType']) ? $route['referenceType'] : UrlGeneratorInterface::ABSOLUTE_PATH;
         $paths[$key] = $this->router->generate($name, $parameters, $referenceType);
     }
     $view->vars['paths'] = $paths;
     parent::buildView($view, $form, $options);
 }
Пример #21
0
 /**
  * {@inheritdoc}
  */
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     $view->vars['enable'] = $form->getConfig()->getAttribute('enable');
     if ($form->getConfig()->getAttribute('enable')) {
         $view->vars['base_path'] = $form->getConfig()->getAttribute('base_path');
         $view->vars['config'] = json_encode($form->getConfig()->getAttribute('config'));
         $view->vars['plugins'] = $form->getConfig()->getAttribute('plugins');
     }
     parent::buildView($view, $form, $options);
     // Dynamically load CKEditor assets
     if ($this->assetsLoader) {
         $this->assetsLoader->addVendor('ckeditor');
     }
 }
Пример #22
0
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     parent::buildView($view, $form, $options);
     // overwrite selectize attrs
     if (isset($options['selectize'])) {
         foreach ($options['selectize'] as $attr => $value) {
             $this->defaults['selectize'][$attr] = $value;
         }
     }
     $this->defaults['selectize']['entity'] = $form->getData();
     foreach ($this->defaults['selectize'] as $attr => $value) {
         $this->defaults['attr']['data-selectize-' . $attr] = $value;
     }
     $view->vars = array_merge($view->vars, $this->defaults);
 }
Пример #23
0
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     $locale = null;
     while ($form && !($page = $form->getData()) instanceof View) {
         $form = $form->getParent();
         // when the form is an a2lix_translationsFields, then it's name is the current locale,
         // we store it to generate the link in the good locale
         if ('a2lix_translationsFields' === $form->getConfig()->getType()->getName()) {
             $locale = $form->getName();
         }
     }
     if (!$locale) {
         $locale = $page->getCurrentLocale();
     }
     $parentUrl = $page->getParent() ? $page->getParent()->getUrl() : '';
     $url = $this->router->generate('victoire_core_page_show', ['url' => $parentUrl, '_locale' => $locale], Router::ABSOLUTE_URL);
     $view->vars['base_url'] = $url;
     parent::buildView($view, $form, $options);
 }
Пример #24
0
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     parent::buildView($view, $form, $options);
     $tabs = array();
     $active = false;
     foreach ($form->all() as $child) {
         if ('tab' == $child->getConfig()->getType()->getName()) {
             $config = $child->getConfig();
             $id = $config->getName();
             $title = $config->getOption('title') ? $config->getOption('title') : $id;
             if ($config->getOption('active')) {
                 $active = $id;
             }
             $tabs[$id] = $title;
         }
     }
     $view->vars['active'] = $active;
     $view->vars['tabs'] = $tabs;
 }
Пример #25
0
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     parent::buildView($view, $form, $options);
     $entity = $form->getParent()->getData();
     $property_name = $view->vars['name'];
     $this->defaults = array_merge($this->defaults, $options);
     // entity info
     $entity_info = $this->container->get('itf.admin_helper')->getEntityInfo(get_class($entity));
     $this->defaults['fn_entity'] = $entity_info['entity_short'];
     $this->defaults['fn_bundle'] = $entity_info['bundle_short'];
     $this->defaults['fn_property'] = $property_name;
     // extract constraints
     $validator = $this->container->get('validator');
     $metadata = $validator->getMetadataFor(get_class($entity));
     if (isset($metadata->properties[$this->defaults['fn_property']])) {
         $this->extractConstraints($metadata->properties[$this->defaults['fn_property']]);
     }
     // set id
     if (method_exists($entity, 'getId')) {
         $this->defaults['fn_entity_id'] = (int) $entity->getId();
     }
     $view->vars = array_merge($view->vars, $this->defaults);
 }
Пример #26
0
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     parent::buildView($view, $form, $options);
 }
 /**
  * {@inheritdoc}
  */
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     parent::buildView($view, $form, $options);
     $attr = $view->vars['attr'];
     $view->vars['attr'] = $attr;
 }
 /**
  * {@inheritdoc}
  */
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     parent::buildView($view, $form, $options);
     $view->vars = array_replace($view->vars, array('Zk2DateTimeSetting' => $options['Zk2DateTimeSetting']));
 }
Пример #29
0
 /**
  * {@inheritdoc}
  */
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     parent::buildView($view, $form, $options);
     $view->vars['currency_choices'] = $options['currency_choices'];
 }
Пример #30
0
 /**
  *
  * {@inheritdoc}
  *
  */
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     /* give options for twig context */
     parent::buildView($view, $form, $options);
 }