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


PHP FieldManager::fetchTypes方法代码示例

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


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

示例1: __viewEdit


//.........这里部分代码省略.........
         $fields = $fieldManager->fetch(NULL, $section_id);
     }
     $meta['subsection'] = $meta['subsection'] == 'yes' ? 1 : 0;
     $meta['entry_order'] = isset($meta['entry_order']) ? $meta['entry_order'] : 'date';
     if (isset($_POST['meta'])) {
         $meta = $_POST['meta'];
         $meta['hidden'] = isset($meta['hidden']) ? 'yes' : 'no';
         if ($meta['name'] == '') {
             $meta['name'] = $section->get('name');
         }
     }
     $this->setPageType('form');
     $this->setTitle(__('%1$s – %2$s – %3$s', array(__('Symphony'), __('Sections'), $meta['name'])));
     $this->appendSubheading($meta['name']);
     $fieldset = new XMLElement('fieldset');
     $fieldset->setAttribute('class', 'settings');
     $fieldset->appendChild(new XMLElement('legend', __('Essentials')));
     $div = new XMLElement('div', NULL, array('class' => 'group'));
     $namediv = new XMLElement('div', NULL);
     $label = Widget::Label('Name');
     $label->appendChild(Widget::Input('meta[name]', $meta['name']));
     if (isset($this->_errors['name'])) {
         $namediv->appendChild(Widget::wrapFormElementWithError($label, $this->_errors['name']));
     } else {
         $namediv->appendChild($label);
     }
     $label = Widget::Label();
     $input = Widget::Input('meta[hidden]', 'yes', 'checkbox', $meta['hidden'] == 'yes' ? array('checked' => 'checked') : NULL);
     $label->setValue(__('%s Hide this section from the Publish menu', array($input->generate(false))));
     $namediv->appendChild($label);
     $div->appendChild($namediv);
     $navgroupdiv = new XMLElement('div', NULL);
     $sectionManager = new SectionManager($this->_Parent);
     $sections = $sectionManager->fetch(NULL, 'ASC', 'sortorder');
     $label = Widget::Label(__('Navigation Group') . ' <i>' . __('Choose only one. Created if does not exist') . '</i>');
     $label->appendChild(Widget::Input('meta[navigation_group]', $meta['navigation_group']));
     if (isset($this->_errors['navigation_group'])) {
         $navgroupdiv->appendChild(Widget::wrapFormElementWithError($label, $this->_errors['navigation_group']));
     } else {
         $navgroupdiv->appendChild($label);
     }
     if (is_array($sections) && !empty($sections)) {
         $ul = new XMLElement('ul', NULL, array('class' => 'tags singular'));
         $groups = array();
         foreach ($sections as $s) {
             if (in_array($s->get('navigation_group'), $groups)) {
                 continue;
             }
             $ul->appendChild(new XMLElement('li', $s->get('navigation_group')));
             $groups[] = $s->get('navigation_group');
         }
         $navgroupdiv->appendChild($ul);
     }
     $div->appendChild($navgroupdiv);
     $fieldset->appendChild($div);
     $this->Form->appendChild($fieldset);
     $fieldset = new XMLElement('fieldset');
     $fieldset->setAttribute('class', 'settings');
     $fieldset->appendChild(new XMLElement('legend', __('Fields')));
     $div = new XMLElement('div');
     $h3 = new XMLElement('h3', __('Fields'));
     $h3->setAttribute('class', 'label');
     $div->appendChild($h3);
     $ol = new XMLElement('ol');
     $ol->setAttribute('id', 'fields-duplicator');
     if (is_array($fields) && !empty($fields)) {
         foreach ($fields as $position => $field) {
             $wrapper = new XMLElement('li');
             $field->set('sortorder', $position);
             $field->displaySettingsPanel($wrapper, isset($this->_errors[$position]) ? $this->_errors[$position] : NULL);
             $ol->appendChild($wrapper);
         }
     }
     foreach ($fieldManager->fetchTypes() as $type) {
         if ($type = $fieldManager->create($type)) {
             array_push($types, $type);
         }
     }
     uasort($types, create_function('$a, $b', 'return strnatcasecmp($a->_name, $b->_name);'));
     foreach ($types as $type) {
         $defaults = array();
         $type->findDefaults($defaults);
         $type->setArray($defaults);
         $wrapper = new XMLElement('li');
         $wrapper->setAttribute('class', 'template');
         $type->set('sortorder', '-1');
         $type->displaySettingsPanel($wrapper);
         $ol->appendChild($wrapper);
     }
     $div->appendChild($ol);
     $fieldset->appendChild($div);
     $this->Form->appendChild($fieldset);
     $div = new XMLElement('div');
     $div->setAttribute('class', 'actions');
     $div->appendChild(Widget::Input('action[save]', __('Save Changes'), 'submit', array('accesskey' => 's')));
     $button = new XMLElement('button', __('Delete'));
     $button->setAttributeArray(array('name' => 'action[delete]', 'class' => 'confirm delete', 'title' => __('Delete this section'), 'type' => 'submit'));
     $div->appendChild($button);
     $this->Form->appendChild($div);
 }
开发者ID:klaftertief,项目名称:sym-forum,代码行数:101,代码来源:content.blueprintssections.php

示例2: __viewEdit


//.........这里部分代码省略.........
     $label->appendChild(Widget::Input('meta[name]', General::sanitize($meta['name'])));
     if (isset($this->_errors['name'])) {
         $namediv->appendChild(Widget::wrapFormElementWithError($label, $this->_errors['name']));
     } else {
         $namediv->appendChild($label);
     }
     $label = Widget::Label();
     $input = Widget::Input('meta[hidden]', 'yes', 'checkbox', $meta['hidden'] == 'yes' ? array('checked' => 'checked') : NULL);
     $label->setValue(__('%s Hide this section from the back-end menu', array($input->generate(false))));
     $namediv->appendChild($label);
     $div->appendChild($namediv);
     $navgroupdiv = new XMLElement('div', NULL);
     $sectionManager = new SectionManager($this->_Parent);
     $sections = $sectionManager->fetch(NULL, 'ASC', 'sortorder');
     $label = Widget::Label(__('Navigation Group') . ' <i>' . __('Choose only one. Created if does not exist') . '</i>');
     $label->appendChild(Widget::Input('meta[navigation_group]', $meta['navigation_group']));
     if (isset($this->_errors['navigation_group'])) {
         $navgroupdiv->appendChild(Widget::wrapFormElementWithError($label, $this->_errors['navigation_group']));
     } else {
         $navgroupdiv->appendChild($label);
     }
     if (is_array($sections) && !empty($sections)) {
         $ul = new XMLElement('ul', NULL, array('class' => 'tags singular'));
         $groups = array();
         foreach ($sections as $s) {
             if (in_array($s->get('navigation_group'), $groups)) {
                 continue;
             }
             $ul->appendChild(new XMLElement('li', $s->get('navigation_group')));
             $groups[] = $s->get('navigation_group');
         }
         $navgroupdiv->appendChild($ul);
     }
     $div->appendChild($navgroupdiv);
     $fieldset->appendChild($div);
     $this->Form->appendChild($fieldset);
     /**
      * Allows extensions to add elements to the header of the Section Editor
      * form. Usually for section settings, this delegate is passed the current
      * `$meta` array and the `$this->_errors` array.
      *
      * @delegate AddSectionElements
      * @since Symphony 2.2
      * @param string $context
      * '/blueprints/sections/'
      * @param XMLElement $form
      *  An XMLElement of the current `$this->Form`, just after the Section
      *  settings have been appended, but before the Fields duplicator
      * @param array $meta
      *  The current $_POST['meta'] array
      * @param array $errors
      *  The current errors array
      */
     Symphony::ExtensionManager()->notifyMembers('AddSectionElements', '/blueprints/sections/', array('form' => &$this->Form, 'meta' => &$meta, 'errors' => &$this->_errors));
     $fieldset = new XMLElement('fieldset');
     $fieldset->setAttribute('class', 'settings');
     $fieldset->appendChild(new XMLElement('legend', __('Fields')));
     $div = new XMLElement('div');
     $p = new XMLElement('p', __('Fields'));
     $p->setAttribute('class', 'label');
     $div->appendChild($p);
     $ol = new XMLElement('ol');
     $ol->setAttribute('id', 'fields-duplicator');
     if (is_array($fields) && !empty($fields)) {
         foreach ($fields as $position => $field) {
             $wrapper = new XMLElement('li', NULL, array('class' => 'field-' . $field->handle() . ($field->mustBeUnique() ? ' unique' : NULL)));
             $wrapper->setAttribute('data-type', $field->handle());
             $field->set('sortorder', $position);
             $field->displaySettingsPanel($wrapper, isset($this->_errors[$position]) ? $this->_errors[$position] : NULL);
             $ol->appendChild($wrapper);
         }
     }
     foreach ($fieldManager->fetchTypes() as $type) {
         if ($type = $fieldManager->create($type)) {
             array_push($types, $type);
         }
     }
     uasort($types, create_function('$a, $b', 'return strnatcasecmp($a->_name, $b->_name);'));
     foreach ($types as $type) {
         $defaults = array();
         $type->findDefaults($defaults);
         $type->setArray($defaults);
         $wrapper = new XMLElement('li');
         $wrapper->setAttribute('class', 'template field-' . $type->handle() . ($type->mustBeUnique() ? ' unique' : NULL));
         $wrapper->setAttribute('data-type', $type->handle());
         $type->set('sortorder', '-1');
         $type->displaySettingsPanel($wrapper);
         $ol->appendChild($wrapper);
     }
     $div->appendChild($ol);
     $fieldset->appendChild($div);
     $this->Form->appendChild($fieldset);
     $div = new XMLElement('div');
     $div->setAttribute('class', 'actions');
     $div->appendChild(Widget::Input('action[save]', __('Save Changes'), 'submit', array('accesskey' => 's')));
     $button = new XMLElement('button', __('Delete'));
     $button->setAttributeArray(array('name' => 'action[delete]', 'class' => 'button confirm delete', 'title' => __('Delete this section'), 'type' => 'submit', 'accesskey' => 'd', 'data-message' => __('Are you sure you want to delete this section?')));
     $div->appendChild($button);
     $this->Form->appendChild($div);
 }
开发者ID:benesch,项目名称:hilton-unar,代码行数:101,代码来源:content.blueprintssections.php


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