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


PHP FormInterface::isDisabled方法代码示例

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


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

示例1: isDisabled

 /**
  * {@inheritdoc}
  */
 public function isDisabled()
 {
     if (null === $this->parent || !$this->parent->isDisabled()) {
         return $this->config->getDisabled();
     }
     return true;
 }
开发者ID:neteasy-work,项目名称:hkgbf_crm,代码行数:10,代码来源:Button.php

示例2: isDisabled

 /**
  * {@inheritDoc}
  */
 public function isDisabled()
 {
     if (null === $this->parent || !$this->parent->isDisabled()) {
         return $this->disabled;
     }
     return true;
 }
开发者ID:nicodmf,项目名称:symfony,代码行数:10,代码来源:Form.php

示例3: buildView

 /**
  * {@inheritdoc}
  */
 public function buildView(FormView $view, FormInterface $form)
 {
     $name = $form->getName();
     $readOnly = $form->getAttribute('read_only');
     if ($view->hasParent()) {
         if ('' === $name) {
             throw new FormException('Form node with empty name can be used only as root form node.');
         }
         if ('' !== ($parentFullName = $view->getParent()->get('full_name'))) {
             $id = sprintf('%s_%s', $view->getParent()->get('id'), $name);
             $fullName = sprintf('%s[%s]', $parentFullName, $name);
         } else {
             $id = $name;
             $fullName = $name;
         }
         // Complex fields are read-only if themselves or their parent is.
         $readOnly = $readOnly || $view->getParent()->get('read_only');
     } else {
         $id = $name;
         $fullName = $name;
         // Strip leading underscores and digits. These are allowed in
         // form names, but not in HTML4 ID attributes.
         // http://www.w3.org/TR/html401/struct/global.html#adef-id
         $id = ltrim($id, '_0123456789');
     }
     $types = array();
     foreach ($form->getTypes() as $type) {
         $types[] = $type->getName();
     }
     $view->set('form', $view)->set('id', $id)->set('name', $name)->set('full_name', $fullName)->set('read_only', $readOnly)->set('errors', $form->getErrors())->set('value', $form->getClientData())->set('disabled', $form->isDisabled())->set('required', $form->isRequired())->set('max_length', $form->getAttribute('max_length'))->set('pattern', $form->getAttribute('pattern'))->set('size', null)->set('label', $form->getAttribute('label'))->set('multipart', false)->set('attr', $form->getAttribute('attr'))->set('types', $types)->set('translation_domain', $form->getAttribute('translation_domain'));
 }
开发者ID:421p,项目名称:symfony,代码行数:34,代码来源:FormType.php

示例4: buildView

 /**
  * {@inheritdoc}
  */
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     $name = $form->getName();
     $blockName = $options['block_name'] ?: $form->getName();
     $translationDomain = $options['translation_domain'];
     if ($view->parent) {
         if ('' !== ($parentFullName = $view->parent->vars['full_name'])) {
             $id = sprintf('%s_%s', $view->parent->vars['id'], $name);
             $fullName = sprintf('%s[%s]', $parentFullName, $name);
             $uniqueBlockPrefix = sprintf('%s_%s', $view->parent->vars['unique_block_prefix'], $blockName);
         } else {
             $id = $name;
             $fullName = $name;
             $uniqueBlockPrefix = '_' . $blockName;
         }
         if (null === $translationDomain) {
             $translationDomain = $view->parent->vars['translation_domain'];
         }
     } else {
         $id = $name;
         $fullName = $name;
         $uniqueBlockPrefix = '_' . $blockName;
         // Strip leading underscores and digits. These are allowed in
         // form names, but not in HTML4 ID attributes.
         // http://www.w3.org/TR/html401/struct/global.html#adef-id
         $id = ltrim($id, '_0123456789');
     }
     $blockPrefixes = array();
     for ($type = $form->getConfig()->getType(); null !== $type; $type = $type->getParent()) {
         array_unshift($blockPrefixes, $type->getName());
     }
     $blockPrefixes[] = $uniqueBlockPrefix;
     $view->vars = array_replace($view->vars, array('form' => $view, 'id' => $id, 'name' => $name, 'full_name' => $fullName, 'disabled' => $form->isDisabled(), 'label' => $options['label'], 'multipart' => false, 'attr' => $options['attr'], 'block_prefixes' => $blockPrefixes, 'unique_block_prefix' => $uniqueBlockPrefix, 'translation_domain' => $translationDomain, 'cache_key' => $uniqueBlockPrefix . '_' . $form->getConfig()->getType()->getName()));
 }
开发者ID:mm999,项目名称:EduSoho,代码行数:37,代码来源:BaseType.php

示例5: mapFormToData

 public function mapFormToData(FormInterface $form, &$data)
 {
     $propertyPath = $form->getAttribute('property_path');
     if (null !== $propertyPath && $form->isSynchronized() && !$form->isDisabled()) {
         // If the data is identical to the value in $data, we are
         // dealing with a reference
         $isReference = $form->getData() === $propertyPath->getValue($data);
         $byReference = $form->getAttribute('by_reference');
         if (!(is_object($data) && $isReference && $byReference)) {
             $propertyPath->setValue($data, $form->getData());
         }
     }
 }
开发者ID:nashadalam,项目名称:symfony,代码行数:13,代码来源:PropertyPathMapper.php

示例6: buildView

 /**
  * {@inheritdoc}
  */
 public function buildView(FormView $view, FormInterface $form, array $options)
 {
     $name = $form->getName();
     $blockName = $options['block_name'] ?: $form->getName();
     $translationDomain = $options['translation_domain'];
     $labelFormat = $options['label_format'];
     if ($view->parent) {
         if ('' !== ($parentFullName = $view->parent->vars['full_name'])) {
             $id = sprintf('%s_%s', $view->parent->vars['id'], $name);
             $fullName = sprintf('%s[%s]', $parentFullName, $name);
             $uniqueBlockPrefix = sprintf('%s_%s', $view->parent->vars['unique_block_prefix'], $blockName);
         } else {
             $id = $name;
             $fullName = $name;
             $uniqueBlockPrefix = '_' . $blockName;
         }
         if (null === $translationDomain) {
             $translationDomain = $view->parent->vars['translation_domain'];
         }
         if (!$labelFormat) {
             $labelFormat = $view->parent->vars['label_format'];
         }
     } else {
         $id = $name;
         $fullName = $name;
         $uniqueBlockPrefix = '_' . $blockName;
         // Strip leading underscores and digits. These are allowed in
         // form names, but not in HTML4 ID attributes.
         // http://www.w3.org/TR/html401/struct/global.html#adef-id
         $id = ltrim($id, '_0123456789');
     }
     $blockPrefixes = array();
     for ($type = $form->getConfig()->getType(); null !== $type; $type = $type->getParent()) {
         if (method_exists($type, 'getBlockPrefix')) {
             array_unshift($blockPrefixes, $type->getBlockPrefix());
         } else {
             @trigger_error(get_class($type) . ': The ResolvedFormTypeInterface::getBlockPrefix() method will be added in version 3.0. You should add it to your implementation.', E_USER_DEPRECATED);
             $fqcn = get_class($type->getInnerType());
             $name = $type->getName();
             $hasCustomName = $name !== $fqcn;
             array_unshift($blockPrefixes, $hasCustomName ? $name : StringUtil::fqcnToBlockPrefix($fqcn));
         }
     }
     $blockPrefixes[] = $uniqueBlockPrefix;
     $view->vars = array_replace($view->vars, array('form' => $view, 'id' => $id, 'name' => $name, 'full_name' => $fullName, 'disabled' => $form->isDisabled(), 'label' => $options['label'], 'label_format' => $labelFormat, 'multipart' => false, 'attr' => $options['attr'], 'block_prefixes' => $blockPrefixes, 'unique_block_prefix' => $uniqueBlockPrefix, 'translation_domain' => $translationDomain, 'cache_key' => $uniqueBlockPrefix . '_' . $form->getConfig()->getType()->getName()));
 }
开发者ID:Kyra2778,项目名称:AMR,代码行数:49,代码来源:BaseType.php

示例7: buildView

 /**
  * {@inheritdoc}
  */
 public function buildView(FormViewInterface $view, FormInterface $form, array $options)
 {
     $name = $form->getName();
     $blockName = $options['block_name'] ?: $form->getName();
     $readOnly = $options['read_only'];
     $translationDomain = $options['translation_domain'];
     if ($view->hasParent()) {
         if ('' === $name) {
             throw new FormException('Form node with empty name can be used only as root form node.');
         }
         $parentView = $view->getParent();
         if ('' !== ($parentFullName = $parentView->getVar('full_name'))) {
             $id = sprintf('%s_%s', $parentView->getVar('id'), $name);
             $fullName = sprintf('%s[%s]', $parentFullName, $name);
             $fullBlockName = sprintf('%s_%s', $parentView->getVar('full_block_name'), $blockName);
         } else {
             $id = $name;
             $fullName = $name;
             $fullBlockName = '_' . $blockName;
         }
         // Complex fields are read-only if they themselves or their parents are.
         if (!$readOnly) {
             $readOnly = $parentView->getVar('read_only');
         }
         if (!$translationDomain) {
             $translationDomain = $parentView->getVar('translation_domain');
         }
     } else {
         $id = $name;
         $fullName = $name;
         $fullBlockName = '_' . $blockName;
         // Strip leading underscores and digits. These are allowed in
         // form names, but not in HTML4 ID attributes.
         // http://www.w3.org/TR/html401/struct/global.html#adef-id
         $id = ltrim($id, '_0123456789');
     }
     $types = array();
     for ($type = $form->getConfig()->getType(); null !== $type; $type = $type->getParent()) {
         array_unshift($types, $type->getName());
     }
     if (!$translationDomain) {
         $translationDomain = 'messages';
     }
     $view->addVars(array('form' => $view, 'id' => $id, 'name' => $name, 'full_name' => $fullName, 'full_block_name' => $fullBlockName, 'read_only' => $readOnly, 'errors' => $form->getErrors(), 'valid' => $form->isBound() ? $form->isValid() : true, 'value' => $form->getViewData(), 'disabled' => $form->isDisabled(), 'required' => $form->isRequired(), 'max_length' => $options['max_length'], 'pattern' => $options['pattern'], 'size' => null, 'label' => $options['label'], 'multipart' => false, 'attr' => $options['attr'], 'label_attr' => $options['label_attr'], 'compound' => $form->getConfig()->getCompound(), 'types' => $types, 'translation_domain' => $translationDomain));
 }
开发者ID:nathanlon,项目名称:symfony,代码行数:48,代码来源:FormType.php

示例8: buildView

    /**
     * {@inheritdoc}
     */
    public function buildView(FormView $view, FormInterface $form, array $options)
    {
        $name = $form->getName();
        $blockName = $options['block_name'] ?: $form->getName();
        $readOnly = $options['read_only'];
        $translationDomain = $options['translation_domain'];

        if ($view->parent) {
            if ('' === $name) {
                throw new Exception('Form node with empty name can be used only as root form node.');
            }

            if ('' !== ($parentFullName = $view->parent->vars['full_name'])) {
                $id = sprintf('%s_%s', $view->parent->vars['id'], $name);
                $fullName = sprintf('%s[%s]', $parentFullName, $name);
                $uniqueBlockPrefix = sprintf('%s_%s', $view->parent->vars['unique_block_prefix'], $blockName);
            } else {
                $id = $name;
                $fullName = $name;
                $uniqueBlockPrefix = '_' . $blockName;
            }

            // Complex fields are read-only if they themselves or their parents are.
            if (!$readOnly) {
                $readOnly = $view->parent->vars['read_only'];
            }

            if (!$translationDomain) {
                $translationDomain = $view->parent->vars['translation_domain'];
            }
        } else {
            $id = $name;
            $fullName = $name;
            $uniqueBlockPrefix = '_' . $blockName;

            // Strip leading underscores and digits. These are allowed in
            // form names, but not in HTML4 ID attributes.
            // http://www.w3.org/TR/html401/struct/global.html#adef-id
            $id = ltrim($id, '_0123456789');
        }

        $blockPrefixes = array();
        for ($type = $form->getConfig()->getType(); null !== $type; $type = $type->getParent()) {
            array_unshift($blockPrefixes, $type->getName());
        }
        $blockPrefixes[] = $uniqueBlockPrefix;

        if (!$translationDomain) {
            $translationDomain = 'messages';
        }

        $view->vars = array_replace($view->vars, array(
            'form'                => $view,
            'id'                  => $id,
            'name'                => $name,
            'full_name'           => $fullName,
            'read_only'           => $readOnly,
            'errors'              => $form->getErrors(),
            'valid'               => $form->isBound() ? $form->isValid() : true,
            'value'               => $form->getViewData(),
            'data'                => $form->getNormData(),
            'disabled'            => $form->isDisabled(),
            'required'            => $form->isRequired(),
            'max_length'          => $options['max_length'],
            'pattern'             => $options['pattern'],
            'size'                => null,
            'label'               => $options['label'],
            'multipart'           => false,
            'attr'                => $options['attr'],
            'label_attr'          => $options['label_attr'],
            'compound'            => $form->getConfig()->getCompound(),
            'block_prefixes'      => $blockPrefixes,
            'unique_block_prefix' => $uniqueBlockPrefix,
            'translation_domain'  => $translationDomain,
            // Using the block name here speeds up performance in collection
            // forms, where each entry has the same full block name.
            // Including the type is important too, because if rows of a
            // collection form have different types (dynamically), they should
            // be rendered differently.
            // https://github.com/symfony/symfony/issues/5038
            'cache_key'           => $uniqueBlockPrefix . '_' . $form->getConfig()->getType()->getName(),
        ));
    }
开发者ID:nysander,项目名称:symfony,代码行数:86,代码来源:FormType.php


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