本文整理汇总了PHP中theme_item_list函数的典型用法代码示例。如果您正苦于以下问题:PHP theme_item_list函数的具体用法?PHP theme_item_list怎么用?PHP theme_item_list使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了theme_item_list函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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'));
}
开发者ID:samknelson,项目名称:grievance,代码行数:8,代码来源:template.php
示例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;
}
开发者ID:NISR,项目名称:web_d7,代码行数:56,代码来源:template.php
示例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;
}
开发者ID:Joanl,项目名称:ding,代码行数:43,代码来源:template.alternatives.php
示例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');
}
开发者ID:philippemouchel,项目名称:drupazure,代码行数:22,代码来源:template.php
示例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);
}
开发者ID:aimhighagency,项目名称:mjkim,代码行数:41,代码来源:template.php
示例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;
}
开发者ID:stephangrundner,项目名称:zimmer,代码行数:24,代码来源:template.php
示例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);
}
开发者ID:ivanvincent,项目名称:imsv_fe,代码行数:18,代码来源:template.php
示例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;
}
开发者ID:kieranbutler,项目名称:ikieran,代码行数:60,代码来源:menu.php
示例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;
}
开发者ID:ucaka,项目名称:forestway,代码行数:49,代码来源:template.functions.php
示例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);
}
开发者ID:anasbenmansour,项目名称:acgtheme,代码行数:34,代码来源:template.php
示例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);
}
开发者ID:pantasio,项目名称:hdso,代码行数:35,代码来源:template.php
示例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;
}
开发者ID:bert-bruggeman,项目名称:e2e_themes,代码行数:52,代码来源:navigation.inc.php
示例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
}
}
?>
-->
开发者ID:roblib,项目名称:islandora_scholar_upei,代码行数:31,代码来源:Home.tpl.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;
}
开发者ID:OPIN-WET4,项目名称:wet4_theme,代码行数:30,代码来源:template.php
示例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);
}
}
开发者ID:Probo-Demos,项目名称:drupal_github,代码行数:54,代码来源:template.php
示例16: _bvng_get_sidebar_content
/**
* Retrieve sidebar content according to content type
* @todo To investigate why passing $variables['node'] as $node will produce extra
* taxonomy_term object in $field_items, which cause taxonomy_term_load_multiple() to fail.
* Therefore here a $node object is loaded by $nid and $vid.
*/
function _bvng_get_sidebar_content($nid, $vid)
{
$node = node_load($nid, $vid);
$markup = '';
if ($node) {
switch ($node->type) {
case 'newsarticle':
case 'usesofdata':
$fields = _bvng_get_sidebar_fields($node->type);
foreach ($fields as $idx => $field) {
$variable_name = str_replace('-', '_', $idx);
${$variable_name} = array('title' => $field['title'], 'type' => 'ul', 'items' => array(), 'attributes' => array('id' => $idx, 'class' => $node->type . '-sidebar' . ' ' . $idx));
$item_list =& ${$variable_name};
if ($idx != 'tags') {
$field_items = field_get_items('node', $node, $field['machine_name']);
if ($field_items !== FALSE) {
switch ($field['field_type']) {
case 'node_date':
array_push($item_list['items'], array('data' => format_date($node->{$field}['machine_name'], 'custom', 'F jS, Y ')));
break;
case 'text':
foreach ($field_items as $item) {
array_push($item_list['items'], array('data' => $item['value']));
}
break;
case 'link_field':
foreach ($field_items as $item) {
array_push($item_list['items'], array('data' => l($item['title'], $item['url'])));
}
break;
case 'taxonomy_term_reference':
_bvng_get_tag_links($field_items, $item_list);
break;
}
$markup .= theme_item_list($item_list);
}
} elseif ($idx == 'tags') {
$terms = array();
$term_sources = $field['fields'];
// Get all terms.
foreach ($term_sources as $term_source) {
$items = field_get_items('node', $node, $term_source);
if (is_array($items)) {
foreach ($items as $item) {
$terms[] = $item['tid'];
}
}
}
if (count($terms) > 0) {
_bvng_get_tag_links($terms, $item_list);
$markup .= theme_item_list($item_list);
}
}
}
break;
case 'resource_ims':
$orc_id = _bvng_get_field_value('node', $node, 'field_orc_original_ims_id');
$file_size_text = _bvng_get_field_value('node', $node, 'field_size_text');
$resource_url = 'http://imsgbif.gbif.org/CMS_ORC/?doc_id=' . $orc_id . '&download=1';
$download_text = t('Download');
if (!empty($file_size_text)) {
$download_text .= ' (' . $file_size_text . ')';
}
$download_link = l($download_text, $resource_url);
$markup .= $download_link;
break;
}
}
return $markup;
}
开发者ID:mwagdi,项目名称:gbif-portal,代码行数:76,代码来源:template.php
示例17: theme_bootsmacss_social_links
/**
* Social links theme function.
*/
function theme_bootsmacss_social_links($items, $title)
{
$prefix = $output = $suffix = '';
// Prefix and suffix for middle centering.
if (!empty($title)) {
$prefix = '<div class="middle-align__row">
<div class="middle-align__col">
<p>Follow us at</p>
</div>
<div class="middle-align__col">';
$suffix = '</div></div>';
}
// Render links with proper icons.
foreach ($items as $key => $value) {
if (strpos($value, 'facebook') !== FALSE) {
$platform = 'fb';
} elseif (strpos($value, 'twitter') !== FALSE) {
$platform = 'twitter';
} elseif (strpos($value, 'youtube') !== FALSE) {
$platform = 'link';
} elseif (strpos($value, 'linkedin') !== FALSE) {
$platform = 'linkedin';
} else {
$platform = 'link';
}
$items[$key] = array('data' => l('<span class="icon icon--' . $platform . '"></span>', $value, array('html' => TRUE, 'attributes' => array('target' => '_blank'))), 'class' => array('social-links__item'));
}
// Render list.
$list = theme_item_list(array('title' => '', 'items' => $items, 'type' => 'ul', 'attributes' => array('class' => array('social-links', 'list-inline'))));
return $prefix . $list . $suffix;
}
开发者ID:bandanaman,项目名称:bootsmacss-drupal,代码行数:34,代码来源:template.php
示例18: megatron_item_list
function megatron_item_list($variables)
{
$items = $variables['items'];
$title = $variables['title'];
$type = $variables['type'];
$attributes = $variables['attributes'];
$output = '';
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) {
$attributes['class'][] = 'first';
}
if ($i == $num_items - 1) {
$attributes['class'][] = 'last';
}
$output .= '<li' . drupal_attributes($attributes) . '>' . $data . "</li>\n";
}
$output .= "</{$type}>";
}
return $output;
}
开发者ID:Emmanuel19,项目名称:Megatron,代码行数:46,代码来源:extras.php
示例19: intranet_preprocess_node
/**
* Override or insert variables into the node template.
*/
function intranet_preprocess_node(&$variables)
{
$node = $variables['node'];
$field_items = field_get_items('node', $node, 'field_linktype');
$link_type = $field_items[0]['value'];
if ($variables['view_mode'] == 'full' && node_is_page($variables['node'])) {
$variables['classes_array'][] = 'node-full';
}
if ($variables['type'] == 'cluster_of_links' && $link_type == 'All Applications') {
$content_array = $variables['field_link_details'];
$field_items1 = field_get_items('node', $node, 'field_link_details');
foreach ($field_items1 as $key => $value) {
$multifield = _multifield_field_item_to_entity('field_link_details', $value);
$subfield_link = field_get_items('multifield', $multifield, 'field_link');
$subfield_icon = field_get_items('multifield', $multifield, 'field_clustor_link_icon');
$link_url = $subfield_link[0]['display_url'];
$link_title = $subfield_link[0]['title'];
$img_path = $subfield_icon[0]['uri'];
$image = array('style_name' => 'all_application', 'path' => $img_path, 'alt' => '', 'title' => '');
// link elements
$text = theme('image_style', $image);
// in your case it's an image
$path = $link_url;
$options = array('attributes' => array('target' => '_blank'), 'html' => true);
$items[] = array('data' => l($text, $path, $options), 'id' => 'all_app_list_' . $key);
}
$attributes = array('id' => 'all-app-list');
$links_html = theme_item_list(array('items' => $items, 'type' => 'ul', 'title' => '', 'attributes' => $attributes));
$variables['all_applications_record'] = $links_html;
$variables['theme_hook_suggestions'][] = 'node__teaser_all_app';
}
if ($variables['type'] == 'cluster_of_links' && $link_type == 'Quick Links' && ($variables['view_mode'] == 'teaser' || $variables['view_mode'] == 'full')) {
$variables['theme_hook_suggestions'][] = 'node__teaser_quick_links';
}
if ($variables['type'] == 'cxo_messages' && $variables['view_mode'] == 'full') {
$user = user_load($variables['user']->uid);
if ($user->picture) {
$variables['user_picture'] = theme_image_style(array('style_name' => 'cxo-message-user', 'path' => $user->picture->uri, 'attributes' => array('class' => 'avatar'), 'width' => "170", 'height' => "180"));
} else {
$variables['user_picture'] = theme_image_style(array('style_name' => 'cxo-message-user', 'path' => 'public://detail-user.png', 'attributes' => array('class' => 'avatar'), 'width' => "170", 'height' => "180"));
}
$variables['date'] = date("M j, Y", strtotime($variables['date']));
$variables['submitted'] = t('!username on !datetime', array('!username' => $variables['name'], '!datetime' => $variables['date']));
}
//Applying cxo style to user image on award detail page for consistency.
if ($variables['type'] == 'award' && $variables['view_mode'] == 'full') {
if ($variables['field_user_identity'][0]['entity']->picture) {
$variables['user_picture'] = theme_image_style(array('style_name' => 'cxo-message-user', 'path' => $variables['field_user_identity'][0]['entity']->picture->uri, 'attributes' => array('class' => 'avatar'), 'width' => "170", 'height' => "180"));
} else {
$variables['user_picture'] = theme_image_style(array('style_name' => 'cxo-message-user', 'path' => 'public://detail-user.png', 'attributes' => array('class' => 'avatar'), 'width' => "170", 'height' => "180"));
}
}
if ($variables['type'] == 'units' && $variables['view_mode'] == 'full') {
$variables['theme_hook_suggestions'][] = 'node__units';
}
}
开发者ID:cap-mayank,项目名称:intranet,代码行数:59,代码来源:template.php
示例20: scsmetronic_subtheme_item_list
/**
* over ride the item list to exclude the otuside tag
*/
function scsmetronic_subtheme_item_list($variables)
{
$items = $variables['items'];
$title = $variables['title'];
$type = $variables['type'];
$attributes = $variables['attributes'];
$add_div = isset($variables['add_div']) ? $variables['add_div'] : TRUE;
// 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 = $add_div ? '<div class="item-list">' : '';
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) {
// Render nested list.
$data .= theme_item_list(array('items' => $children, 'title' => NULL, 'type' => $type, 'attributes' => $attributes));
}
if ($i == 1) {
$attributes['class'][] = 'first';
}
|
请发表评论