本文整理汇总了PHP中theme_item_list函数的典型用法代码示例。如果您正苦于以下问题:PHP theme_item_list函数的具体用法?PHP theme_item_list怎么用?PHP theme_item_list使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了theme_item_list函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: at_tf_admin_file_formatter_table
function at_tf_admin_file_formatter_table($variables)
{
$rows = array();
foreach ($variables['items'] as $delta => $item) {
$rows[] = theme('file_link', array('file' => (object) $item));
}
return empty($rows) ? '' : theme_item_list(array('items' => $rows, 'title' => t('Attachments'), 'attributes' => array(), 'type' => 'ul'));
}
示例2: porto_sub_item_list
/**
* Overrides theme_item_list().
*/
function porto_sub_item_list($variables)
{
$items = $variables['items'];
$title = $variables['title'];
$type = $variables['type'];
if ($variables['attributes']['class'][0] == 'pager') {
$variables['attributes']['class'] = 'pagination pagination-lg pull-right';
}
$attributes = $variables['attributes'];
// Only output the list container and title, if there are any list items.
// Check to see whether the block title exists before adding a header.
// Empty headers are not semantic and present accessibility challenges.
$output = '';
if (isset($title) && $title !== '') {
$output .= '<h3>' . $title . '</h3>';
}
if (!empty($items)) {
$output .= "<{$type}" . drupal_attributes($attributes) . '>';
$num_items = count($items);
$i = 0;
foreach ($items as $item) {
$attributes = array();
$children = array();
$data = '';
$i++;
//if ( is_array($item) && in_array('pager-current', $item['class'])) {
if (isset($item['class']) && is_array($item) && in_array('pager-current', $item['class'])) {
$item['class'] = array('active');
$item['data'] = '<a href="#">' . $item['data'] . '</a>';
}
if (is_array($item)) {
foreach ($item as $key => $value) {
if ($key == 'data') {
$data = $value;
} elseif ($key == 'children') {
$children = $value;
} else {
$attributes[$key] = $value;
}
}
} else {
$data = $item;
}
if (count($children) > 0) {
// Render nested list.
$data .= theme_item_list(array('items' => $children, 'title' => NULL, 'type' => $type, 'attributes' => $attributes));
}
$output .= '<li' . drupal_attributes($attributes) . '>' . $data . "</li>\n";
}
$output .= "</{$type}>";
}
return $output;
}
示例3: mothership_item_list
function mothership_item_list($items = array(), $title = NULL, $type = 'ul', $attributes = NULL)
{
$attributes['class'] .= " item-list";
// $output = '<div class="item-list">';
if (isset($title)) {
$output .= '<h3>' . $title . '</h3>';
}
if (!empty($items)) {
$output .= "<{$type}" . drupal_attributes($attributes) . '>';
$num_items = count($items);
foreach ($items as $i => $item) {
$attributes = array();
$children = array();
if (is_array($item)) {
foreach ($item as $key => $value) {
if ($key == 'data') {
$data = $value;
} elseif ($key == 'children') {
$children = $value;
} else {
$attributes[$key] = $value;
}
}
} else {
$data = $item;
}
if (count($children) > 0) {
$data .= theme_item_list($children, NULL, $type, $attributes);
// Render nested list
}
// if ($i == 0) {
// $attributes['class'] = empty($attributes['class']) ? 'first' : ($attributes['class'] .' first');
// }
// if ($i == $num_items - 1) {
// $attributes['class'] = empty($attributes['class']) ? 'last' : ($attributes['class'] .' last');
// }
$output .= '<li' . drupal_attributes($attributes) . '>' . $data . "</li>\n";
}
$output .= "</{$type}>";
}
// $output .= '</div>';
return $output;
}
示例4: philippemouchel_preprocess_page
function philippemouchel_preprocess_page(&$vars)
{
$mgi = menu_get_item();
$items = array();
// Generate items renderable main menu
foreach ($vars['main_menu'] as $item) {
// Exception for home page
if ($item['href'] == '<front>') {
$item['href'] = '';
if ($mgi['path'] == variable_get('site_frontpage', '')) {
$item['attributes']['class'] = array('active-trail', 'active');
}
}
$items[] = l(t($item['title']), $item['href'], array('attributes' => $item['attributes']));
}
// Add custom item to download PDF file
$options = array('html' => TRUE, 'attributes' => array('title' => t('Download my CV as PDF file'), 'target' => '_blank'));
$items[] = array('data' => l('<i class="icon-file-pdf"></i>', 'sites/default/files/pdf/cv-philippemouchel-2014.pdf', $options), 'class' => array('pdf-download'));
$vars['rendered_main_menu'] = theme_item_list(array('title' => '<i class="icon-menu2"></i><span>' . t('Main menu') . '</span>', 'type' => 'ul', 'attributes' => array('class' => 'content'), 'items' => $items));
// Add translated title for HTML 5 Logo
drupal_add_js(array('philippemouchel' => array('html5LogoTitle' => t('HTML 5 validator'))), 'setting');
}
示例5: theadmin_preprocess_node
/**
* Preprocess functions for node.tpl.php.
*/
function theadmin_preprocess_node(&$vars)
{
$node = $vars['node'];
$url = substr($vars['node_url'], 5);
// Add general theme suggestions for all content types and view modes
$vars['theme_hook_suggestions'][] = 'node__' . $vars['type'] . '__' . $vars['view_mode'];
$vars['nid'] = $vars['node']->nid;
// IMAGE GALLERY ====================================================
if ($vars['type'] == 'media_gallery') {
drupal_set_title(t('welcome to your backend.'));
if (isset($vars['user']->roles[1]) && $vars['user']->roles[1] || $vars['view_mode'] == 'gallery_preview') {
//$vars['images'] = render($vars['content']['media_gallery_file']);
$images = array();
for ($i = 0; $i < count($vars['media_gallery_file']); $i++) {
$uri = $vars['media_gallery_file'][$i]['uri'];
$alt = $vars['media_gallery_file'][$i]['alt'];
$title = $vars['media_gallery_file'][$i]['title'];
$images[] = render_image($uri, $style = 'gallery_large', $alt);
}
$vars['images'] = theme_item_list(array('items' => $images, 'title' => null, 'type' => 'ul', 'attributes' => array()));
$vars['theme_hook_suggestions'][] = 'node__' . $vars['type'] . '__preview';
drupal_add_js(path_to_theme() . '/js/init_gallery.js');
} else {
$vars['add_media'] = render($vars['content']['add_media_link']);
$vars['images'] = render($vars['content']['media_gallery_file']);
}
//kpr($vars);
}
if ($vars['type'] == 'image_gallery') {
$images = array();
for ($i = 0; $i < count($vars['field_images']); $i++) {
$uri = $vars['field_images'][$i]['uri'];
$alt = $vars['field_images'][$i]['alt'];
$images[] = render_image($uri, $style = 'gallery_large', $alt);
}
}
// kpr($vars);
}
示例6: zimmer_links__locale_block
function zimmer_links__locale_block(&$variables)
{
// the global $language variable tells you what the current language is
global $language;
// an array of list items
$items = array();
foreach ($variables['links'] as $lang => $info) {
$name = $info['language']->native;
$href = isset($info['href']) ? $info['href'] : '';
$li_classes = array('list-item-class');
if ($lang === $language->language) {
$li_classes[] = 'active';
}
$link_classes = array('link-class1', 'link-class2');
$options = array('attributes' => array('class' => $link_classes), 'language' => $info['language'], 'html' => true);
$link = l($name, $href, $options);
if ($href) {
$items[] = array('data' => $link, 'class' => $li_classes);
}
}
$attributes = array('class' => array(''));
$output = theme_item_list(array('items' => $items, 'title' => '', 'type' => 'ul', 'attributes' => $attributes));
return $output;
}
示例7: progressive_sub_item_list
/**
* Overrides theme_item_list().
*/
function progressive_sub_item_list($vars)
{
if (isset($vars['attributes']['class']) && is_array($vars['attributes']['class']) && in_array('pager', $vars['attributes']['class'])) {
foreach ($vars['items'] as $i => $item) {
if (in_array('pager-current', $item['class'])) {
$vars['items'][$i]['data'] = '<span>' . $item['data'] . '</span>';
$vars['items'][$i]['class'][] = 'active';
}
}
$styles = array(1 => 'pagination', 2 => 'pagination pagination-lg', 3 => 'pagination', 4 => 'pagination pagination-sm');
$vars['attributes']['class'][] = $styles[theme_get_setting('pager') ? theme_get_setting('pager') : 1];
return '<div class="pagination-box">' . theme_item_list($vars) . '</div>';
}
return theme_item_list($vars);
}
示例8: mothership_item_list
function mothership_item_list($variables)
{
$items = $variables['items'];
$title = $variables['title'];
$type = $variables['type'];
$attributes = $variables['attributes'];
$output = '';
//get the daddy if its set and add it is item-list-$daddy
if (isset($variables['daddy'])) {
$wrapperclass = "item-list-" . $variables['daddy'];
} else {
$wrapperclass = "";
}
if (!empty($wrapperclass)) {
$output = '<div class="' . $wrapperclass . '">';
}
if (isset($title)) {
$output .= '<h3>' . $title . '</h3>';
}
if (!empty($items)) {
$output .= "<{$type}" . drupal_attributes($attributes) . '>';
$num_items = count($items);
foreach ($items as $i => $item) {
$attributes = array();
$children = array();
$data = '';
if (is_array($item)) {
foreach ($item as $key => $value) {
if ($key == 'data') {
$data = $value;
} elseif ($key == 'children') {
$children = $value;
} else {
$attributes[$key] = $value;
}
}
} else {
$data = $item;
}
if (count($children) > 0) {
// Render nested list.
$data .= theme_item_list(array('items' => $children, 'title' => NULL, 'type' => $type, 'attributes' => $attributes));
}
if ($i == 0) {
//TODO remove first
$attributes['class'][] = 'first';
}
if ($i == $num_items - 1) {
//TODO remove last
$attributes['class'][] = 'last';
}
$output .= '<li' . drupal_attributes($attributes) . '>' . $data . "</li>\n";
}
$output .= "</{$type}>";
}
if (!empty($wrapperclass)) {
$output .= '</div>';
}
return $output;
}
示例9: gavias_laikafood_item_list
/**
* Overrides theme_item_list().
*/
function gavias_laikafood_item_list($variables)
{
$items = $variables['items'];
$title = $variables['title'];
$type = $variables['type'];
$variables['attributes']['class'] = 'pagination pull-right';
$attributes = $variables['attributes'];
$output = '';
if (isset($title) && $title !== '') {
$output .= '<h3>' . $title . '</h3>';
}
if (!empty($items)) {
$output .= "<{$type}" . drupal_attributes($attributes) . '>';
$num_items = count($items);
$i = 0;
foreach ($items as $item) {
$attributes = array();
$children = array();
$data = '';
$i++;
if (isset($item['class']) && is_array($item) && in_array('pager-current', $item['class'])) {
$item['class'] = array('active');
$item['data'] = '<a href="#">' . $item['data'] . '</a>';
}
if (is_array($item)) {
foreach ($item as $key => $value) {
if ($key == 'data') {
$data = $value;
} elseif ($key == 'children') {
$children = $value;
} else {
$attributes[$key] = $value;
}
}
} else {
$data = $item;
}
if (count($children) > 0) {
$data .= theme_item_list(array('items' => $children, 'title' => NULL, 'type' => $type, 'attributes' => $attributes));
}
$output .= '<li' . drupal_attributes($attributes) . '>' . $data . "</li>\n";
}
$output .= "</{$type}>";
}
return $output;
}
示例10: goodnex_item_list
/**
* Modify theme_item_list()
*/
function goodnex_item_list($vars)
{
if (isset($vars['attributes']['class']) && in_array('pager', (array) $vars['attributes']['class'])) {
foreach ($vars['items'] as $i => &$item) {
if (in_array('pager-current', $item['class'])) {
$item['class'] = array('page-numbers-current current');
$item['data'] = $item['data'];
} elseif (is_array($item) && in_array('pager-item', $item['class'])) {
$item['class'] = array('page-numbers');
$item['data'] = $item['data'];
} elseif (in_array('pager-next', $item['class'])) {
$item['class'] = array('next page-numbers');
$item['data'] = $item['data'];
} elseif (in_array('pager-last', $item['class'])) {
$item['class'] = array('page-numbers');
$item['data'] = $item['data'];
} elseif (in_array('pager-first', $item['class'])) {
$item['class'] = array('page-numbers first');
$item['data'] = $item['data'];
} elseif (in_array('pager-previous', $item['class'])) {
$item['class'] = array('prev page-numbers');
$item['data'] = $item['data'];
} elseif (in_array('pager-ellipsis', $item['class'])) {
$item['class'] = array('disabled');
$item['data'] = $item['data'];
}
}
return '<div class="wp-pagenavi clearfix">' . theme_item_list($vars) . '</div>';
}
return theme_item_list($vars);
}
示例11: jollyany_item_list
/**
* Overrides theme_item_list().
*/
function jollyany_item_list($vars)
{
if (isset($vars['attributes']['class']) && is_array($vars['attributes']['class']) && in_array('pager', $vars['attributes']['class'])) {
$vars['attributes']['class'] = 'pagination';
foreach ($vars['items'] as $i => &$item) {
if (in_array('pager-current', $item['class'])) {
$item['class'] = array('active');
$item['data'] = '<a href="javascript: void(0);">' . $item['data'] . '</a>';
} elseif (in_array('pager-item', $item['class'])) {
$item['class'] = array('page-numbers');
$item['data'] = $item['data'];
} elseif (in_array('pager-next', $item['class'])) {
$item['class'] = array('next page-numbers');
$item['data'] = $item['data'];
} elseif (in_array('pager-last', $item['class'])) {
$item['class'] = array('page-numbers');
$item['data'] = $item['data'];
} elseif (in_array('pager-first', $item['class'])) {
$item['class'] = array('page-numbers first');
$item['data'] = $item['data'];
} elseif (in_array('pager-previous', $item['class'])) {
$item['class'] = array('prev page-numbers');
$item['data'] = $item['data'];
} elseif (in_array('pager-ellipsis', $item['class'])) {
$item['class'] = array('disabled');
$item['data'] = $item['data'];
}
}
return '<div class="text-center clearfix"><div class="pagination_wrapper">' . theme_item_list($vars) . '</div></div>';
}
return theme_item_list($vars);
}
示例12: basetpl_item_list
/**
* list items
*/
function basetpl_item_list($variables)
{
$items = $variables['items'];
$title = $variables['title'];
$type = $variables['type'];
$attributes = $variables['attributes'];
$class = isset($variables['attributes']['class']) && in_array('menu', $variables['attributes']['class']) ? 'inline-menu' : 'item-list';
$output = '<div class="' . $class . '">';
if (isset($title) && $title !== '') {
$output .= '<h3>' . $title . '</h3>';
}
if (!empty($items)) {
$output .= "<{$type}" . drupal_attributes($attributes) . '>';
$num_items = count($items);
$i = 0;
foreach ($items as $item) {
$attributes = array();
$children = array();
$data = '';
$i++;
if (is_array($item)) {
foreach ($item as $key => $value) {
if ($key == 'data') {
$data = $value;
} elseif ($key == 'children') {
$children = $value;
} else {
$attributes[$key] = $value;
}
}
} else {
$data = $item;
}
if (count($children) > 0) {
$data .= theme_item_list(array('items' => $children, 'title' => NULL, 'type' => $type, 'attributes' => $attributes));
}
if ($i == 1) {
$attributes['class'][] = 'first';
}
if ($i == $num_items) {
$attributes['class'][] = 'last';
}
$output .= '<li' . drupal_attributes($attributes) . '>' . $data . "</li>\n";
}
$output .= "</{$type}>";
}
$output .= '</div>';
return $output;
}
示例13: drupal_get_form
?>
<div>or</div>
<br/>
<?php
if ($browse_by_user) {
?>
<h4>Browse by User</h4>
<div id="ir-browse-by-user-form">
<?php
print drupal_get_form('scholar_browse_by_user_form');
?>
</div>
<br/>
<?php
}
?>
<?php
if ($browse_by_department) {
?>
<h4>Browse by Department</h4>
<br/>
<div id="ir-browse-by-department">
<?php
print theme_item_list(array(l('Place Holder', 'fedorair/ir')));
?>
</div>
<?php
}
}
?>
-->
示例14: wet4_links__locale_block
/**
* Modify the output of the language selector block.
*/
function wet4_links__locale_block(&$variables)
{
// the global $language variable tells you what the current language is
global $language;
// hide active language
unset($variables['links'][$language->language]);
// an array of list items
$items = array();
foreach ($variables['links'] as $lang => $info) {
$name = $info['language']->native;
$href = isset($info['href']) ? $info['href'] : '';
// if the global language is that of this item's language, add the active class
if ($lang === $language->language) {
$li_classes[] = 'active';
}
$options = array('language' => $info['language'], 'html' => true);
$link = l($name, $href, $options);
// display only translated links
if ($href) {
$items[] = array('data' => $link);
}
}
// output
$attributes = array('class' => array('list-inline'), 'id' => 'gc-bar');
$output = theme_item_list(array('items' => $items, 'title' => '', 'type' => 'ul', 'attributes' => $attributes));
return $output;
}
示例15: bear_skin_item_list
/**
* Implements theme_item_list()
* 1. Add some additional CSS classes
* 2. Make the alerts accessible using WAI standards
*/
function bear_skin_item_list(&$variables)
{
$items = $variables['items'];
$title = $variables['title'];
$type = $variables['type'];
$attributes = $variables['attributes'];
// create a more unique CSS identifier for this list
if (!empty($attributes['class'])) {
$list_class = implode('-', $attributes['class']);
} else {
// since the classes array on the menu is empty
// we'll just give this a class of theme-item-list since
// that is the generating function of this item list
$list_class = 'theme-item-list';
$variables['attributes']['class'] = array();
}
$variables['attributes']['class'][] = $list_class . '__list';
// determine if this is the pagination element
$pager = FALSE;
if (in_array('pager', $variables['attributes']['class'])) {
$pager = TRUE;
}
// add ARIA role to <ul> element
$variables['attributes']['role'] = $pager ? 'menubar' : 'list';
// add ARIA roles and SMACCS classes to list items
if (!empty($items)) {
foreach ($variables['items'] as &$item) {
if (!is_array($item)) {
continue;
}
$item['role'] = $pager ? 'presentation' : 'listitem';
$item['class'] = !empty($item['class']) ? $item['class'] : array();
$item['class'][] = $list_class . '__item';
if ($pager) {
$has_label = preg_match('/title="(.*?)"/', $item['data'], $label_text);
if ($has_label) {
// this is a bit ugly
// TODO: find a way to do this that doesn't use str_replace
$item['data'] = str_replace('<a ', '<a aria-label="' . $label_text[1] . '" class="' . $list_class . '__link" ', $item['data']);
}
}
}
}
if ($pager) {
return '<nav class="' . $list_class . '" role="navigation" aria-label="Pagination">' . theme_item_list($variables) . '</nav>' . "\n";
} else {
return theme_item_list($variables);
}
}