finishView() public method

public finishView ( Symfony\Component\Form\FormView $view, Symfony\Component\Form\FormInterface $form, array $options )
$view Symfony\Component\Form\FormView
$form Symfony\Component\Form\FormInterface
$options array
 /**
  * {@inheritdoc}
  */
 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     parent::finishView($view, $form, $options);
     // convert the route into an URL
     $view->vars['limit'] = $options['limit'];
     $view->vars['url'] = $options['url'];
 }
Esempio n. 2
0
 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     parent::finishView($view, $form, $options);
     $this->filterManager->setDataClass($options['class']);
     $this->filterValueKinds = $this->filterManager->getFilterValuesAssocList();
     foreach ($view->children as $child) {
         isset($this->filterValueKinds[$child->vars['label']]) ? $label = $this->filterValueKinds[$child->vars['label']] : ($label = 'unkhown');
         $child->vars['filter_kind'] = $label;
     }
 }
Esempio n. 3
0
 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     /** @var FormView[] $fields */
     if ($view->offsetExists('submit_group')) {
         $fields = array($view->offsetGet('submit_group'));
         $view->offsetUnset('submit_group');
         $view->children = $view->children + $fields;
     }
     parent::finishView($view, $form, $options);
 }
Esempio n. 4
0
 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     parent::finishView($view, $form, $options);
     $view->vars['remote_path'] = $this->router->generate($options['remote_route'], $options['remote_params']);
     $varNames = array('minimum_input_length', 'placeholder');
     foreach ($varNames as $varName) {
         $view->vars[$varName] = $options[$varName];
     }
     $view->vars['full_name'] .= '[]';
 }
Esempio n. 5
0
 /**
  * @param FormView      $view
  * @param FormInterface $form
  * @param array         $options
  */
 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     parent::finishView($view, $form, $options);
     foreach ($view->vars['choices'] as $choice) {
         $additionalAttributes = array();
         foreach ($options['option_attributes'] as $attributeName => $choicePath) {
             $additionalAttributes[$attributeName] = $this->propertyAccessor->getValue($choice->data, $choicePath);
         }
         $choice->attr = array_replace(isset($choice->attr) ? $choice->attr : array(), $additionalAttributes);
     }
 }
Esempio n. 6
0
 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     parent::finishView($view, $form, $options);
     $themeOptions = array('contentTitle' => true, 'contentText' => true, 'titlePlaceHolder' => 'optional_title', 'textPlaceHolder' => 'create_content');
     foreach ($themeOptions as $option => $defaultValue) {
         if (isset($options['theme_options']) && isset($options['theme_options'][$option])) {
             $view->vars[$option] = $options['theme_options'][$option];
         } else {
             $view->vars[$option] = $defaultValue;
         }
     }
 }
 /**
  * {@inheritdoc}
  */
 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     //$view->vars['widget'] = $options['widget'];
     $view->vars['datepicker_format'] = $options['datepicker_format'];
     $view->vars['datepicker_start_date'] = $options['datepicker_start_date'];
     $view->vars['datepicker_end_date'] = $options['datepicker_end_date'];
     $view->vars['datepicker_autoclose'] = $options['datepicker_autoclose'];
     $view->vars['datepicker_show_on'] = $options['datepicker_show_on'];
     $view->vars['datepicker_start_view'] = $options['datepicker_start_view'];
     $view->vars['datepicker_week_start'] = $options['datepicker_week_start'];
     $view->vars['datepicker_type'] = $options['datepicker_type'];
     parent::finishView($view, $form, $options);
 }
 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     parent::finishView($view, $form, $options);
     // make variables available to the view
     $view->vars['remote_path'] = $options['remote_path'] ?: $this->router->generate($options['remote_route'], array_merge($options['remote_params'], ['page_limit' => $options['page_limit']]));
     $varNames = array('multiple', 'minimum_input_length', 'placeholder', 'language');
     foreach ($varNames as $varName) {
         $view->vars[$varName] = $options[$varName];
     }
     if ($options['multiple']) {
         $view->vars['full_name'] .= '[]';
     }
 }
 /**
  * {@inheritdoc}
  */
 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     parent::finishView($view, $form, $options);
     $view->vars['widget'] = $options['widget'];
     $view->vars['format'] = $options['format'];
     $view->vars['timepicker_show_meridian'] = $options['timepicker_show_meridian'];
     $view->vars['timepicker_template'] = $options['timepicker_template'];
     $view->vars['timepicker_minute_step'] = $options['timepicker_minute_step'];
     $view->vars['timepicker_second_step'] = $options['timepicker_second_step'];
     $view->vars['timepicker_default_time'] = $options['timepicker_default_time'];
     $view->vars['timepicker_disable_focus'] = $options['timepicker_disable_focus'];
     $view->vars['timepicker_modal_backdrop'] = $options['timepicker_modal_backdrop'];
     $view->vars['timepicker_show_seconds'] = $options['timepicker_show_seconds'];
     $view->vars['timepicker_type'] = $options['timepicker_type'];
 }
Esempio n. 10
0
 /**
  * @param FormView      $view
  * @param FormInterface $form
  * @param array         $options
  */
 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     parent::finishView($view, $form, $options);
     foreach ($view->vars['choices'] as $choice) {
         $additionalAttributes = array();
         foreach ($options['option_attributes'] as $attributeName => $choicePath) {
             /* generate a thumbnail image if the option_attribute is an image-path */
             if ($attributeName == 'data-img-src') {
                 $webPath = $this->propertyAccessor->getValue($choice->data, $choicePath);
                 $runtimeConfig = array("relative_resize" => array("widen" => 109));
                 $value = $this->cacheManager->getBrowserPath($webPath, 'filter_widen', $runtimeConfig);
             } else {
                 $value = $this->propertyAccessor->getValue($choice->data, $choicePath);
             }
             $additionalAttributes[$attributeName] = $value;
         }
         $choice->attr = array_replace(isset($choice->attr) ? $choice->attr : array(), $additionalAttributes);
     }
 }
Esempio n. 11
0
 /**
  * {@inheritdoc}
  *
  * @param FormView      $view
  * @param FormInterface $form
  * @param array         $options
  */
 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     parent::finishView($view, $form, $options);
     $view->vars['authorizationChecker'] = $this->controller->getService('securityAuthorizationChecker');
     /*
      * Inject data as plain documents entities
      */
     $view->vars['nodeTree'] = new NodeTreeWidget($this->controller->getRequest(), $this->controller, $this->nodeSource->getNode(), $this->nodeSource->getTranslation());
     $view->vars['nodeStatuses'] = ['draft' => Node::DRAFT, 'pending' => Node::PENDING, 'published' => Node::PUBLISHED, 'archived' => Node::ARCHIVED, 'deleted' => Node::DELETED];
     /*
      * Linked types to create quick add buttons
      */
     $defaultValues = explode(',', $this->field->getDefaultValues());
     foreach ($defaultValues as $key => $value) {
         $defaultValues[$key] = trim($value);
     }
     $nodeTypes = $this->controller->getService('em')->getRepository('RZ\\Roadiz\\Core\\Entities\\NodeType')->findBy(['name' => $defaultValues]);
     $view->vars['linkedTypes'] = $nodeTypes;
 }
 /**
  * {@inheritdoc}
  */
 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     $view->vars['mode'] = $options['mode'];
     $view->vars['indent_unit'] = $options['indent_unit'];
     $view->vars['smart_indent'] = $options['smart_indent'];
     $view->vars['tab_size'] = $options['tab_size'];
     $view->vars['indent_with_tabs'] = $options['indent_with_tabs'];
     $view->vars['auto_clear_empty_lines'] = $options['auto_clear_empty_lines'];
     $view->vars['line_wrapping'] = $options['line_wrapping'];
     $view->vars['first_line_number'] = $options['first_line_number'];
     $view->vars['line_numbers'] = $options['line_numbers'];
     $view->vars['line_number_formatter'] = $options['line_number_formatter'];
     $view->vars['gutter'] = $options['gutter'];
     $view->vars['fixed_gutter'] = $options['fixed_gutter'];
     $view->vars['fixed_gutter'] = $options['fixed_gutter'];
     $view->vars['read_only'] = $options['read_only'];
     $view->vars['match_brackets'] = $options['match_brackets'];
     $view->vars['autofocus'] = $options['autofocus'];
     $view->vars['theme'] = $options['theme'];
     parent::finishView($view, $form, $options);
 }
Esempio n. 13
0
 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     parent::finishView($view, $form, $options);
     //$cfg = $form->getConfig();
     // assign some variables to the view template
     $vars = array('render', 'route', 'route_params', 'property', 'minLength', 'items', 'delay', 'spinner', 'multiple', 'allow_add', 'allow_remove', 'empty_value', 'resetOnSelect', 'callback');
     foreach ($vars as $var) {
         $view->vars[$var] = $options[$var];
     }
     // convert the route into an URL
     if (!empty($options['route'])) {
         try {
             $params = $options['route_params'] ?: array();
             if (!is_array($params) and !$params instanceof \Traversable) {
                 throw new UnexpectedTypeException($params, "array or \\Traversable");
             }
             $view->vars['url'] = $this->router->generate($options['route'], $params);
         } catch (\InvalidArgumentException $e) {
             throw new RuntimeException("Route \"{$options['route']}\" configured on " . get_class() . " does not exist.");
         }
     }
 }
 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     parent::finishView($view, $form, $options);
     // make variables available to the view
     $view->vars['remote_path'] = $options['remote_path'] ?: $this->router->generate($options['remote_route'], array_merge($options['remote_params'], ['page_limit' => $options['page_limit']]));
     // merge variable names which are only set per instance with those from yml config
     $varNames = array_merge(array('multiple', 'placeholder', 'primary_key', 'autostart'), array_keys($this->config));
     foreach ($varNames as $varName) {
         $view->vars[$varName] = $options[$varName];
     }
     //tags options
     $varNames = array_keys($this->config['allow_add']);
     foreach ($varNames as $varName) {
         if (isset($options['allow_add'][$varName])) {
             $view->vars['allow_add'][$varName] = $options['allow_add'][$varName];
         } else {
             $view->vars['allow_add'][$varName] = $this->config['allow_add'][$varName];
         }
     }
     if ($options['multiple']) {
         $view->vars['full_name'] .= '[]';
     }
 }
Esempio n. 15
0
 /**
  * @param FormView      $view
  * @param FormInterface $form
  * @param array         $options
  */
 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     parent::finishView($view, $form, $options);
     // Set choice_attributes on choices
     foreach ($view->vars['choices'] as $choice) {
         $additionalAttributes = array();
         foreach ($options['choice_attributes'] as $attributeName => $choicePath) {
             $additionalAttributes[$attributeName] = $this->propertyAccessor->getValue($choice->data, $choicePath);
         }
         $choice->attr = array_replace(isset($choice->attr) ? $choice->attr : array(), $additionalAttributes);
     }
     // Set choice_attributes on children (for example options, radio, etc)
     if ($options['expanded']) {
         foreach ($view as $i => $childView) {
             $additionalAttributes = array();
             foreach ($options['choice_attributes'] as $attributeName => $choicePath) {
                 $entity = $view->vars['choices'][$i]->data;
                 $additionalAttributes[$attributeName] = $this->propertyAccessor->getValue($entity, $choicePath);
             }
             $childView->vars['attr'] = array_replace(isset($childView->attr) ? $childView->attr : array(), $additionalAttributes);
         }
     }
 }
Esempio n. 16
0
 /**
  * {@inheritdoc}
  */
 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     parent::finishView($view, $form, $options);
     $view->vars['widget_options'] = $options['widget_options'];
 }
Esempio n. 17
0
 /**
  * {@inheritdoc}
  */
 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     parent::finishView($view, $form, $options);
 }
Esempio n. 18
0
 /**
  * {@inheritdoc}
  */
 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     parent::finishView($view, $form, $options);
     $view->vars['tree_current'] = $form->getParent()->getData()->getId();
     $view->vars['tree_source'] = $options['source'];
 }
Esempio n. 19
0
 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     parent::finishView($view, $form, $options);
     // TODO: Change the autogenerated stub
 }
 /**
  * {@inheritdoc}
  */
 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     parent::finishView($view, $form, $options);
     $view->vars['option'] = $this->option;
     $view->vars['is_addable'] = array_key_exists('data-field-addable', $options['attr']) ? (bool) $options['attr']['data-field-addable'] : false;
 }
 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     parent::finishView($view, $form, $options);
     // TODO: Change the autogenerated stub
     $view->vars['attr']['class'] = $view->vars['attr']['class'] . ' meisa_menu_link';
 }
Esempio n. 22
0
 public function finishView(\Symfony\Component\Form\FormView $view, \Symfony\Component\Form\FormInterface $form, array $options)
 {
     parent::finishView($view, $form, $options);
     $view->vars['class'] = $options['class'];
 }
Esempio n. 23
0
 /**
  * {@inheritdoc}
  *
  * @param FormView      $view
  * @param FormInterface $form
  * @param array         $options
  */
 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     parent::finishView($view, $form, $options);
     /*
      * Inject data as plain documents entities
      */
     $view->vars['data'] = $this->selectedDocuments;
 }
 /**
  * {@inheritdoc}
  */
 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     $view->vars['attr']['options'] = json_encode($view->vars['attr']['options']);
     parent::finishView($view, $form, $options);
 }
 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     parent::finishView($view, $form, $options);
     $view->vars['edit_mode_enabled'] = $options['edit_mode_enabled'];
 }
 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     parent::finishView($view, $form, $options);
     $view->vars['type'] = 'text';
 }