本文整理汇总了PHP中PageManager::fetchAvailablePageTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP PageManager::fetchAvailablePageTypes方法的具体用法?PHP PageManager::fetchAvailablePageTypes怎么用?PHP PageManager::fetchAvailablePageTypes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageManager
的用法示例。
在下文中一共展示了PageManager::fetchAvailablePageTypes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __form
//.........这里部分代码省略.........
$ol->setAttribute('data-interactive', 'data-interactive');
$ol->setAttribute('data-add', __('Add filter'));
$ol->setAttribute('data-remove', __('Remove filter'));
$ul = new XMLElement('ul');
$ul->setAttribute('class', 'tags');
$ul->setAttribute('data-interactive', 'data-interactive');
$pages = PageManager::fetch(false, array('*'), array(), 'title ASC');
foreach ($pages as $page) {
$ul->appendChild(new XMLElement('li', preg_replace('/\\/{2,}/i', '/', '/' . $page['path'] . '/' . $page['handle'])));
}
if (isset($fields['filter']['navigation']['parent'])) {
$li = new XMLElement('li');
$li->setAttribute('class', 'unique');
$li->setAttribute('data-type', 'parent');
$li->appendChild(new XMLElement('header', '<h4>' . __('Parent Page') . '</h4>'));
$label = Widget::Label(__('Value'));
$label->appendChild(Widget::Input('fields[filter][navigation][parent]', General::sanitize($fields['filter']['navigation']['parent'])));
$li->appendChild($label);
$li->appendChild($ul);
$ol->appendChild($li);
}
$li = new XMLElement('li');
$li->setAttribute('class', 'unique template');
$li->setAttribute('data-type', 'parent');
$li->appendChild(new XMLElement('header', '<h4>' . __('Parent Page') . '</h4>'));
$label = Widget::Label(__('Value'));
$label->appendChild(Widget::Input('fields[filter][navigation][parent]'));
$li->appendChild($label);
$li->appendChild($ul);
$ol->appendChild($li);
$ul = new XMLElement('ul');
$ul->setAttribute('class', 'tags');
$ul->setAttribute('data-interactive', 'data-interactive');
if ($types = PageManager::fetchAvailablePageTypes()) {
foreach ($types as $type) {
$ul->appendChild(new XMLElement('li', $type));
}
}
if (isset($fields['filter']['navigation']['type'])) {
$li = new XMLElement('li');
$li->setAttribute('class', 'unique');
$li->setAttribute('data-type', 'type');
$li->appendChild(new XMLElement('header', '<h4>' . __('Page Type') . '</h4>'));
$label = Widget::Label(__('Value'));
$label->appendChild(Widget::Input('fields[filter][navigation][type]', General::sanitize($fields['filter']['navigation']['type'])));
$li->appendChild($label);
$li->appendChild($ul);
$ol->appendChild($li);
}
$li = new XMLElement('li');
$li->setAttribute('class', 'unique template');
$li->appendChild(new XMLElement('header', '<h4>' . __('Page Type') . '</h4>'));
$li->setAttribute('data-type', 'type');
$label = Widget::Label(__('Value'));
$label->appendChild(Widget::Input('fields[filter][navigation][type]'));
$li->appendChild($label);
$li->appendChild($ul);
$ol->appendChild($li);
$div->appendChild($ol);
$fieldset->appendChild($div);
$this->Form->appendChild($fieldset);
// Sorting
$fieldset = new XMLElement('fieldset');
$this->setContext($fieldset, array('sections', 'system'));
$fieldset->appendChild(new XMLElement('legend', __('Sorting')));
$p = new XMLElement('p', __('Use %s syntax to order by page parameters.', array('<code>{' . __('$param') . '}</code>')));
示例2: __fetchAvailablePageTypes
/**
* Returns all the page types that exist in this Symphony install.
* There are 5 default system page types, and new types can be added
* by Developers via the Page Editor.
*
* @deprecated This function will be removed in Symphony 2.4.
* The preferred way to access the page types is via
* `PageManager::fetchAvailablePageTypes()`
* @see toolkit.PageManager#fetchAvailablePageTypes
* @return array
* An array of strings of the page types used in this Symphony
* install. At the minimum, this will be an array with the values
* 'index', 'XML', 'admin', '404' and '403'.
*/
public function __fetchAvailablePageTypes()
{
return PageManager::fetchAvailablePageTypes();
}
示例3: __viewEdit
//.........这里部分代码省略.........
$where = array(sprintf('id != %d', $page_id));
$pages = PageManager::fetch(false, array('id'), $where, 'title ASC');
$options = array(array('', false, '/'));
if (!empty($pages)) {
if (!function_exists('__compare_pages')) {
function __compare_pages($a, $b)
{
return strnatcasecmp($a[2], $b[2]);
}
}
foreach ($pages as $page) {
$options[] = array($page['id'], $fields['parent'] == $page['id'], '/' . PageManager::resolvePagePath($page['id']));
}
usort($options, '__compare_pages');
}
$label->appendChild(Widget::Select('fields[parent]', $options));
$column->appendChild($label);
$group->appendChild($column);
// Parameters ---------------------------------------------------------
$column = new XMLElement('div');
$column->setAttribute('class', 'column');
$label = Widget::Label(__('URL Parameters'));
$label->appendChild(Widget::Input('fields[params]', $fields['params'], 'text', array('placeholder' => 'param1/param2')));
$column->appendChild($label);
// Type -----------------------------------------------------------
$label = Widget::Label(__('Page Type'));
$label->appendChild(Widget::Input('fields[type]', $fields['type']));
if (isset($this->_errors['type'])) {
$label = Widget::Error($label, $this->_errors['type']);
}
$column->appendChild($label);
$tags = new XMLElement('ul');
$tags->setAttribute('class', 'tags');
$types = PageManager::fetchAvailablePageTypes();
foreach ($types as $type) {
$tags->appendChild(new XMLElement('li', $type));
}
$column->appendChild($tags);
$group->appendChild($column);
$fieldset->appendChild($group);
$this->Form->appendChild($fieldset);
// Events -------------------------------------------------------------
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings');
$fieldset->appendChild(new XMLElement('legend', __('Page Resources')));
$group = new XMLElement('div');
$group->setAttribute('class', 'two columns');
$label = Widget::Label(__('Events'));
$label->setAttribute('class', 'column');
$events = ResourceManager::fetch(RESOURCE_TYPE_EVENT, array(), array(), 'name ASC');
$options = array();
if (is_array($events) && !empty($events)) {
if (!isset($fields['events'])) {
$fields['events'] = array();
}
foreach ($events as $name => $about) {
$options[] = array($name, in_array($name, $fields['events']), $about['name']);
}
}
$label->appendChild(Widget::Select('fields[events][]', $options, array('multiple' => 'multiple')));
$group->appendChild($label);
// Data Sources -------------------------------------------------------
$label = Widget::Label(__('Data Sources'));
$label->setAttribute('class', 'column');
$datasources = ResourceManager::fetch(RESOURCE_TYPE_DS, array(), array(), 'name ASC');
$options = array();
示例4: __form
//.........这里部分代码省略.........
$div->setAttribute('class', 'contextual navigation');
$ol = new XMLElement('ol');
$ol->setAttribute('class', 'filters-duplicator');
$ol->setAttribute('data-add', __('Add filter'));
$ol->setAttribute('data-remove', __('Remove filter'));
$ul = new XMLElement('ul');
$ul->setAttribute('class', 'tags');
$pages = PageManager::fetch(false, array('*'), array(), 'title ASC');
foreach ($pages as $page) {
$ul->appendChild(new XMLElement('li', preg_replace('/\\/{2,}/i', '/', '/' . $page['path'] . '/' . $page['handle'])));
}
if (isset($fields['filter']['navigation']['parent'])) {
$li = new XMLElement('li');
$li->setAttribute('class', 'unique');
$li->setAttribute('data-type', 'parent');
$li->appendChild(new XMLElement('header', '<h4>' . __('Parent Page') . '</h4>'));
$label = Widget::Label(__('Value'));
$label->appendChild(Widget::Input('fields[filter][navigation][parent]', General::sanitize($fields['filter']['navigation']['parent'])));
$li->appendChild($label);
$li->appendChild($ul);
$ol->appendChild($li);
}
$li = new XMLElement('li');
$li->setAttribute('class', 'unique template');
$li->setAttribute('data-type', 'parent');
$li->appendChild(new XMLElement('header', '<h4>' . __('Parent Page') . '</h4>'));
$label = Widget::Label(__('Value'));
$label->appendChild(Widget::Input('fields[filter][navigation][parent]'));
$li->appendChild($label);
$li->appendChild($ul);
$ol->appendChild($li);
$ul = new XMLElement('ul');
$ul->setAttribute('class', 'tags');
if ($types = PageManager::fetchAvailablePageTypes()) {
foreach ($types as $type) {
$ul->appendChild(new XMLElement('li', $type));
}
}
if (isset($fields['filter']['navigation']['type'])) {
$li = new XMLElement('li');
$li->setAttribute('class', 'unique');
$li->setAttribute('data-type', 'type');
$li->appendChild(new XMLElement('header', '<h4>' . __('Page Type') . '</h4>'));
$label = Widget::Label(__('Value'));
$label->appendChild(Widget::Input('fields[filter][navigation][type]', General::sanitize($fields['filter']['navigation']['type'])));
$li->appendChild($label);
$li->appendChild($ul);
$ol->appendChild($li);
}
$li = new XMLElement('li');
$li->setAttribute('class', 'unique template');
$li->appendChild(new XMLElement('header', '<h4>' . __('Page Type') . '</h4>'));
$li->setAttribute('data-type', 'type');
$label = Widget::Label(__('Value'));
$label->appendChild(Widget::Input('fields[filter][navigation][type]'));
$li->appendChild($label);
$li->appendChild($ul);
$ol->appendChild($li);
$div->appendChild($ol);
$fieldset->appendChild($div);
$this->Form->appendChild($fieldset);
$fieldset = new XMLElement('fieldset');
$fieldset->setAttribute('class', 'settings contextual inverse navigation authors static_xml dynamic_xml From_extensions');
$fieldset->appendChild(new XMLElement('legend', __('Sorting and Limiting')));
$p = new XMLElement('p', __('Use %s syntax to limit by page parameters.', array('<code>{' . __('$param') . '}</code>')));
$p->setAttribute('class', 'help contextual inverse navigation');