当前位置: 首页>>代码示例>>PHP>>正文


PHP FormInterface::getRoot方法代码示例

本文整理汇总了PHP中Symfony\Component\Form\FormInterface::getRoot方法的典型用法代码示例。如果您正苦于以下问题:PHP FormInterface::getRoot方法的具体用法?PHP FormInterface::getRoot怎么用?PHP FormInterface::getRoot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Form\FormInterface的用法示例。


在下文中一共展示了FormInterface::getRoot方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildView

 /**
  * {@inheritdoc}
  */
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     $data = array_key_exists('data', $view->vars) ? $view->vars['data'] : null;
     if ($data instanceof UploadedFile && $form->getRoot()->getErrors()) {
         $view->vars['data'] = $data = null;
     }
     $view->vars = array_replace($view->vars, array('type' => 'file', 'value' => ''));
 }
开发者ID:Lionel09,项目名称:FormExtensionsBundle,代码行数:11,代码来源:SingleUploadType.php

示例2: getRoot

 /**
  * {@inheritdoc}
  */
 public function getRoot()
 {
     return $this->parent ? $this->parent->getRoot() : $this;
 }
开发者ID:neteasy-work,项目名称:hkgbf_crm,代码行数:7,代码来源:Button.php

示例3: getValidationGroups

 /**
  * Returns the validation groups of the given form.
  *
  * @param  FormInterface $form The form.
  *
  * @return array The validation groups.
  */
 private static function getValidationGroups(FormInterface $form)
 {
     $root = $form->getRoot();
     // Determine the clicked button of the complete form tree
     if (!static::$clickedButtons->contains($root)) {
         // Only call findClickedButton() once to prevent an exponential
         // runtime
         // https://github.com/symfony/symfony/issues/8317
         static::$clickedButtons->attach($root, self::findClickedButton($root));
     }
     $button = static::$clickedButtons->offsetGet($root);
     if (null !== $button) {
         $groups = $button->getConfig()->getOption('validation_groups');
         if (null !== $groups) {
             return self::resolveValidationGroups($groups, $form);
         }
     }
     do {
         $groups = $form->getConfig()->getOption('validation_groups');
         if (null !== $groups) {
             return self::resolveValidationGroups($groups, $form);
         }
         $form = $form->getParent();
     } while (null !== $form);
     return array(Constraint::DEFAULT_GROUP);
 }
开发者ID:koumba,项目名称:monsiteweb.com,代码行数:33,代码来源:FormValidator.php

示例4: getValidationGroups

 /**
  * Returns the validation groups of the given form.
  *
  * @param  FormInterface $form The form.
  *
  * @return array The validation groups.
  */
 private static function getValidationGroups(FormInterface $form)
 {
     $button = self::findClickedButton($form->getRoot());
     if (null !== $button) {
         $groups = $button->getConfig()->getOption('validation_groups');
         if (null !== $groups) {
             return self::resolveValidationGroups($groups, $form);
         }
     }
     do {
         $groups = $form->getConfig()->getOption('validation_groups');
         if (null !== $groups) {
             return self::resolveValidationGroups($groups, $form);
         }
         $form = $form->getParent();
     } while (null !== $form);
     return array(Constraint::DEFAULT_GROUP);
 }
开发者ID:richsage,项目名称:symfony,代码行数:25,代码来源:FormValidator.php

示例5: shouldSkipForEmptyUpdate

 /**
  * Returns if the update should be skipped for empty value.
  *
  * @param \Symfony\Component\Form\FormInterface $form
  * @param mixed $value
  * @param string $fieldDefinitionIdentifier
  *
  * @return boolean
  */
 protected function shouldSkipForEmptyUpdate(FormInterface $form, $value, $fieldDefinitionIdentifier)
 {
     return $value === null && ($form->getRoot()->has("ezforms_skip_empty_update_{$fieldDefinitionIdentifier}") && $form->getRoot()->get("ezforms_skip_empty_update_{$fieldDefinitionIdentifier}")->getData() === "yes");
 }
开发者ID:eab-dev,项目名称:NetgenEzFormsBundle,代码行数:13,代码来源:DataMapper.php

示例6: buildView

 /**
  * Pass the 'errors_with_fields'-value to the view
  *
  * @param FormView $view
  * @param FormInterface $form
  * @param array $options
  */
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     // set an 'errors_with_fields' variable for the view to the root's option
     $view->vars[self::ERRORS_WITH_FIELDS_OPTION] = $form->getRoot()->getConfig()->getOption(self::ERRORS_WITH_FIELDS_OPTION);
 }
开发者ID:mothership-ec,项目名称:cog,代码行数:12,代码来源:FormTypeErrorsWithFieldsExtension.php

示例7: buildView

 /**
  * {@inheritdoc}
  */
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     $propertyAccessor = PropertyAccess::createPropertyAccessor();
     $view->vars['image_filter'] = $options['image_filter'];
     $view->vars['image_path'] = $propertyAccessor->getValue($form->getRoot()->getData(), $options['image_property_path']);
 }
开发者ID:ruslan-polutsygan,项目名称:common-bundle,代码行数:9,代码来源:ImageType.php


注:本文中的Symfony\Component\Form\FormInterface::getRoot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。