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


PHP FormHelper::fromFieldDocument方法代码示例

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


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

示例1: buildContentsFromRequest

 /**
  * @param array<TreeNode> $nodes
  * @param array $contents
  * @param block_BlockRequest $request
  * @param form_persistentdocument_baseform $form
  * @since 2.0.2
  * @deprecated
  */
 public function buildContentsFromRequest($nodes, &$contents, $request, $form)
 {
     $parameters = $request->getParameters();
     $eventParam = array('form' => $form, 'parameters' => &$parameters, 'isPosted' => $this->isPostedFormId($form->getId(), $request));
     f_event_EventManager::dispatchEvent(self::FORM_INIT_DATA_EVENT_NAME, $this, $eventParam);
     $request->setParametersByRef($parameters);
     foreach ($nodes as $node) {
         // $document is a form_persistentdocument_field
         $document = $node->getPersistentDocument();
         $html = '';
         if ($document instanceof form_persistentdocument_group) {
             $templateObject = TemplateLoader::getInstance()->setPackageName('modules_form')->setDirectory('templates/markup/' . $form->getMarkup())->load('Form-Group');
             $elements = array();
             $this->buildContentsFromRequest($node->getChildren(), $elements, $request, $form);
             $attributes = array('id' => $document->getId(), 'label' => $document->getLabel(), 'description' => $document->getDescription(), 'elements' => $elements);
             $html = $templateObject->setAttribute('group', $attributes);
         } else {
             if ($document instanceof form_persistentdocument_field) {
                 $templateObject = TemplateLoader::getInstance()->setPackageName('modules_form')->setDirectory('templates/markup/' . $form->getMarkup())->load($document->getSurroundingTemplate());
                 $html = FormHelper::fromFieldDocument($document, isset($parameters[$document->getFieldName()]) ? $parameters[$document->getFieldName()] : $document->getDefaultValue());
                 $attributes = array('id' => $document->getId(), 'label' => $document->getLabel(), 'description' => $document->getHelpText(), 'required' => $document->getRequired(), 'display' => f_util_ClassUtils::methodExists($document, 'getDisplay') ? $document->getDisplay() : '', 'html' => $html);
             } else {
                 if ($document instanceof form_persistentdocument_freecontent) {
                     $templateObject = TemplateLoader::getInstance()->setPackageName('modules_form')->setDirectory('templates/markup/' . $form->getMarkup())->load('Form-FreeContent');
                     $attributes = array('id' => $document->getId(), 'label' => $document->getLabel(), 'description' => $document->getText(), 'required' => false, 'html' => '');
                 }
             }
             $templateObject->setAttribute('field', $attributes);
         }
         $contents[$document->getId()] = $templateObject->execute();
     }
 }
开发者ID:RBSWebFactory,项目名称:modules.form,代码行数:40,代码来源:FormService.class.php

示例2: getContentsFromRequest

 /**
  * @param array<TreeNode> $nodes
  * @param block_BlockRequest $request
  * @param form_persistentdocument_baseform $form
  * @return array
  */
 protected function getContentsFromRequest($nodes, $request, $form)
 {
     $contents = array();
     $markup = $form->getMarkup();
     foreach ($nodes as $node) {
         $document = $node->getPersistentDocument();
         if ($document instanceof form_persistentdocument_group) {
             $templateObject = TemplateLoader::getInstance()->setPackageName('modules_form')->setDirectory('templates/markup/' . $markup)->load('Form-Group');
             $elements = $this->getContentsFromRequest($node->getChildren(), $contents, $request, $markup);
             $attributes = array('id' => $document->getId(), 'label' => $document->getLabel(), 'description' => $document->getDescription(), 'elements' => $elements);
         } else {
             if ($document instanceof form_persistentdocument_field) {
                 $templateObject = TemplateLoader::getInstance()->setPackageName('modules_form')->setDirectory('templates/markup/' . $markup)->load($document->getSurroundingTemplate());
                 $html = FormHelper::fromFieldDocument($document, $request->hasParameter($document->getFieldName()) ? $request->getParameter($document->getFieldName()) : $document->getDefaultValue());
                 $attributes = array('id' => $document->getId(), 'label' => $document->getLabel(), 'description' => $document->getHelpText(), 'required' => $document->getRequired(), 'display' => f_util_ClassUtils::methodExists($document, 'getDisplay') ? $document->getDisplay() : '', 'html' => $html);
             } else {
                 if ($document instanceof form_persistentdocument_freecontent) {
                     $templateObject = TemplateLoader::getInstance()->setPackageName('modules_form')->setDirectory('templates/markup/' . $markup)->load('Form-FreeContent');
                     $attributes = array('id' => $document->getId(), 'label' => $document->getLabel(), 'description' => $document->getText(), 'required' => false, 'html' => '');
                 }
             }
             $templateObject->setAttribute('field', $attributes);
         }
         $contents[$document->getId()] = $templateObject->execute();
     }
     return $contents;
 }
开发者ID:RBSWebFactory,项目名称:modules.form,代码行数:33,代码来源:BlockFormBaseAction.class.php


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