本文整理汇总了PHP中FieldManager::listAll方法的典型用法代码示例。如果您正苦于以下问题:PHP FieldManager::listAll方法的具体用法?PHP FieldManager::listAll怎么用?PHP FieldManager::listAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FieldManager
的用法示例。
在下文中一共展示了FieldManager::listAll方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __viewEdit
//.........这里部分代码省略.........
$meta['name'] = $section->get('name');
}
}
$this->setPageType('form');
$this->setTitle(__('%1$s – %2$s – %3$s', array($meta['name'], __('Sections'), __('Symphony'))));
$this->appendSubheading($meta['name'], Widget::Anchor(__('View Entries'), SYMPHONY_URL . '/publish/' . $section->get('handle'), __('View Section Entries'), 'button'));
$this->insertBreadcrumbs(array(Widget::Anchor(__('Sections'), SYMPHONY_URL . '/blueprints/sections/')));
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings');
$fieldset->appendChild(new XMLElement('legend', __('Essentials')));
$namediv = new XMLElement('div', null, array('class' => 'column'));
$label = Widget::Label(__('Name'));
$label->appendChild(Widget::Input('meta[name]', isset($meta['name']) ? General::sanitize($meta['name']) : null));
if (isset($this->_errors['name'])) {
$namediv->appendChild(Widget::Error($label, $this->_errors['name']));
} else {
$namediv->appendChild($label);
}
$fieldset->appendChild($namediv);
$div = new XMLElement('div', null, array('class' => 'two columns'));
$handlediv = new XMLElement('div', null, array('class' => 'column'));
$label = Widget::Label(__('Handle'));
$label->appendChild(Widget::Input('meta[handle]', isset($meta['handle']) ? General::sanitize($meta['handle']) : null));
if (isset($this->_errors['handle'])) {
$handlediv->appendChild(Widget::Error($label, $this->_errors['handle']));
} else {
$handlediv->appendChild($label);
}
$div->appendChild($handlediv);
$navgroupdiv = new XMLElement('div', null, array('class' => 'column'));
$sections = SectionManager::fetch(null, 'ASC', 'sortorder');
$label = Widget::Label(__('Navigation Group'));
$label->appendChild(Widget::Input('meta[navigation_group]', $meta['navigation_group']));
if (isset($this->_errors['navigation_group'])) {
$navgroupdiv->appendChild(Widget::Error($label, $this->_errors['navigation_group']));
} else {
$navgroupdiv->appendChild($label);
}
if (is_array($sections) && !empty($sections)) {
$ul = new XMLElement('ul', null, array('class' => 'tags singular', 'data-interactive' => 'data-interactive'));
$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);
$this->addSectionOptions($meta);
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings');
$legend = new XMLElement('legend', __('Fields'));
$legend->setAttribute('id', 'fields-legend');
$fieldset->appendChild($legend);
$div = new XMLElement('div', null, array('class' => 'frame', 'id' => 'fields-duplicator'));
$ol = new XMLElement('ol');
$ol->setAttribute('data-add', __('Add field'));
$ol->setAttribute('data-remove', __('Remove field'));
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::listAll() 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);
}
示例2: __viewEdit
//.........这里部分代码省略.........
$div = new XMLElement('div', NULL, array('class' => 'two columns'));
$namediv = new XMLElement('div', NULL, array('class' => 'column'));
$label = Widget::Label(__('Name'));
$label->appendChild(Widget::Input('meta[name]', General::sanitize($meta['name'])));
if (isset($this->_errors['name'])) {
$namediv->appendChild(Widget::Error($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, array('class' => 'column'));
$sections = SectionManager::fetch(NULL, 'ASC', 'sortorder');
$label = Widget::Label(__('Navigation Group'));
$label->appendChild(Widget::Input('meta[navigation_group]', $meta['navigation_group']));
if (isset($this->_errors['navigation_group'])) {
$navgroupdiv->appendChild(Widget::Error($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', null, array('id' => 'fields', 'class' => 'settings'));
$fieldset->appendChild(new XMLElement('legend', __('Fields')));
$div = new XMLElement('div', null, array('class' => 'frame'));
$ol = new XMLElement('ol');
$ol->setAttribute('id', 'fields-duplicator');
$ol->setAttribute('data-add', __('Add field'));
$ol->setAttribute('data-remove', __('Remove field'));
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::listAll() 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);
}
示例3: fetchTypes
/**
* Returns an array of all available field handles discovered in the
* `TOOLKIT . /fields` or `EXTENSIONS . /{}/fields`.
*
* @deprecated This function will be removed in Symphony 2.4. Use
* `FieldManager::listAll` instead.
* @return array
* A single dimensional array of field handles.
*/
public static function fetchTypes()
{
return FieldManager::listAll();
}