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


PHP FormView::offsetExists方法代码示例

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


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

示例1: finishView

 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);
 }
开发者ID:xavier-dubreuil,项目名称:LightCMS,代码行数:10,代码来源:NodeType.php

示例2: renderFormElement

 /**
  * render a field element from the FieldDescription
  *
  *
  * @throws InvalidArgumentException
  * @param \Sonata\AdminBundle\Admin\FieldDescriptionInterface $fieldDescription
  * @param \Sumfony\Component\Form\FormView $formView
  * @param mixed $object
  * @param array $params
  * @return string
  */
 public function renderFormElement(FieldDescriptionInterface $fieldDescription, FormView $formView, $object, $params = array())
 {
     if (!$fieldDescription->getFieldName()) {
         return '';
     }
     if (!$formView->offsetExists($fieldDescription->getFieldName())) {
         throw new \RuntimeException(sprintf('No child named %s', $fieldDescription->getFieldName()));
     }
     $children = $formView->offsetGet($fieldDescription->getFieldName());
     if (in_array('hidden', $children->get('types'))) {
         return '';
     }
     // find the correct edit parameter
     //  edit   : standard | inline
     //  inline : natural | table
     $parentFieldDescription = $fieldDescription->getAdmin()->getParentFieldDescription();
     if (!$parentFieldDescription) {
         $params['edit'] = $fieldDescription->getOption('edit', 'standard');
         $params['inline'] = $fieldDescription->getOption('inline', 'natural');
         $base_template = sprintf('SonataAdminBundle:CRUD:base_%s_edit_field.html.twig', 'standard');
     } else {
         $params['edit'] = $parentFieldDescription->getOption('edit', 'standard');
         $params['inline'] = $parentFieldDescription->getOption('inline', 'natural');
         $base_template = sprintf('SonataAdminBundle:CRUD:base_%s_edit_field.html.twig', $params['edit']);
     }
     $template = $this->environment->loadTemplate($fieldDescription->getTemplate());
     return $this->output($fieldDescription, $template->render(array_merge($params, array('admin' => $fieldDescription->getAdmin(), 'object' => $object, 'field_description' => $fieldDescription, 'value' => $this->getValueFromFieldDescription($object, $fieldDescription, $params), 'field_element' => $children, 'base_template' => $fieldDescription->getOption('base_template', $base_template)))));
 }
开发者ID:renegare,项目名称:AdminBundle,代码行数:39,代码来源:SonataAdminExtension.php

示例3: finishView

 /**
  * {@inheritdoc}
  */
 public function finishView(FormView $view, FormInterface $form, array $options)
 {
     $isManualEditGranted = $this->orderAddressSecurityProvider->isManualEditGranted($options['addressType']);
     foreach ($view->children as $child) {
         $child->vars['disabled'] = !$isManualEditGranted;
         $child->vars['required'] = false;
         unset($child->vars['attr']['data-validation'], $child->vars['attr']['data-required'], $child->vars['label_attr']['data-required']);
     }
     if ($view->offsetExists('accountAddress')) {
         $view->offsetGet('accountAddress')->vars['disabled'] = false;
     }
 }
开发者ID:adam-paterson,项目名称:orocommerce,代码行数:15,代码来源:OrderAddressType.php

示例4: finishView

 /**
  * Validate that reward type field exists on form
  *
  * {@inheritDoc}
  */
 public function finishView(Form\FormView $view, Form\FormInterface $form, array $options)
 {
     if (!$view->offsetExists(self::REWARD_TYPE)) {
         throw new \LogicException('No `' . self::REWARD_TYPE . '` field set on form! Be sure to call parent::buildForm() in form class!');
     }
 }
开发者ID:mothership-ec,项目名称:cog-mothership-refer-a-friend,代码行数:11,代码来源:RewardConfig.php


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