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


PHP block_list函数代码示例

本文整理汇总了PHP中block_list函数的典型用法代码示例。如果您正苦于以下问题:PHP block_list函数的具体用法?PHP block_list怎么用?PHP block_list使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: csa_base_blocks

/**
 * Implementation of theme_blocks().
 *
 * Print dividers after each second, third or fourth block. These can be used
 * to 'clear' them. This makes it easy te make rows of two, three or four blocks.
 */
function csa_base_blocks($region)
{
    $output = '';
    $block_list = block_list($region);
    $block_count = count($block_list);
    if ($block_count) {
        $i = 1;
        foreach ($block_list as $key => $block) {
            $classes = array();
            $output .= theme('block', $block);
            if ($i % 5 == 0) {
                $classes[] = 'after-fifth-block';
            }
            if ($i % 4 == 0) {
                $classes[] = 'after-fourth-block';
            }
            if ($i % 3 == 0) {
                $classes[] = 'after-third-block';
            }
            if ($i % 2 == 0) {
                $classes[] = 'after-second-block';
            }
            if ($i == $block_count) {
                $classes[] = 'after-last-block';
            }
            if (count($classes) > 0) {
                $output .= '<div class="' . implode(' ', $classes) . '"></div>' . "\n";
            }
            $i++;
        }
    }
    // Add any content assigned to this region through drupal_set_content() calls.
    $output .= drupal_get_content($region);
    return $output;
}
开发者ID:rasjones,项目名称:csa,代码行数:41,代码来源:template.php

示例2: aut_region_has_block

/**
* Determines if the region has at least one block for this user
*
* @param $region
* A string containing the region name
*
* @return
* TRUE if the region has at least one block. FALSE if it doesn't.
*/
function aut_region_has_block($region)
{
    $number_of_blocks = count(block_list($region));
    if ($number_of_blocks > 0) {
        return TRUE;
    } else {
        return FALSE;
    }
}
开发者ID:navster,项目名称:camp-adair,代码行数:18,代码来源:template.php

示例3: _bootstrap_barrio_block_list

/**
 * Returns a list of blocks.
 *
 * Uses Drupal block interface and appends any blocks 
 * assigned by the Context module.
 * Taken from Fusion Core.
 */
function _bootstrap_barrio_block_list($region)
{
    $drupal_list = array();
    if (module_exists('block')) {
        $drupal_list = block_list($region);
    }
    if (module_exists('context') && ($context = context_get_plugin('reaction', 'block'))) {
        $context_list = $context->block_list($region);
        $drupal_list = array_merge($context_list, $drupal_list);
    }
    return $drupal_list;
}
开发者ID:suzannealdrich,项目名称:issues4.us,代码行数:19,代码来源:template.php

示例4: wspine_test_preprocess_block

function wspine_test_preprocess_block(&$vars, $hook)
{
    // Add a striping class.
    $vars['classes_array'][] = 'block-' . $vars['block_zebra'];
    // Add first/last block classes
    $first_last = "";
    // If block id (count) is 1, it's first in region.
    if ($vars['block_id'] == '1') {
        $first_last = "first";
        $vars['classes_array'][] = $first_last;
    }
    // Count amount of blocks about to be rendered in that region.
    $block_count = count(block_list($vars['elements']['#block']->region));
    if ($vars['block_id'] == $block_count) {
        $first_last = "last";
        $vars['classes_array'][] = $first_last;
    }
}
开发者ID:rchicb,项目名称:wspine_test,代码行数:18,代码来源:template.php

示例5: eepotts_blocks

/**
 * Implementation of theme_block
 *
 * @see theme_block()
 *
 * Added first and last class to all blocks for styling.
 */
function eepotts_blocks($region)
{
    $output = '';
    if ($list = block_list($region)) {
        $counter = 1;
        foreach ($list as $key => $block) {
            $block->firstlast = '';
            if ($counter == 1) {
                $block->firstlast .= ' first';
            }
            if ($counter == count($list)) {
                $block->firstlast .= ' last';
            }
            $output .= theme('block', $block);
            $counter++;
        }
        //$block->count = count($list);
    }
    $output .= drupal_get_content($region);
    return $output;
}
开发者ID:native2517,项目名称:E---E-Potts,代码行数:28,代码来源:template.php

示例6: zen_preprocess_block

/**
 * Override or insert variables into the block templates.
 *
 * @param $vars
 *   An array of variables to pass to the theme template.
 * @param $hook
 *   The name of the template being rendered ("block" in this case.)
 */
function zen_preprocess_block(&$vars, $hook)
{
    $block = $vars['block'];
    // Drupal 7 uses a $content variable instead of $block->content.
    $vars['content'] = $block->content;
    // Drupal 7 should use a $title variable instead of $block->subject.
    $vars['title'] = $block->subject;
    // Special classes for blocks.
    $vars['classes_array'][] = 'block-' . $block->module;
    // Classes describing the position of the block within the region.
    if ($vars['block_id'] == 1) {
        $vars['classes_array'][] = 'first';
    }
    if (!function_exists('context_blocks') && count(block_list($vars['block']->region)) == $vars['block_id']) {
        $vars['classes_array'][] = 'last';
    }
    $vars['classes_array'][] = 'region-' . $vars['block_zebra'];
    $vars['classes_array'][] = $vars['zebra'];
    $vars['classes_array'][] = 'region-count-' . $vars['block_id'];
    $vars['classes_array'][] = 'count-' . $vars['id'];
    // Create the block ID.
    $vars['block_html_id'] = 'block-' . $block->module . '-' . $block->delta;
    $vars['edit_links_array'] = array();
    if (theme_get_setting('zen_block_editing') && user_access('administer blocks')) {
        include_once './' . _zen_path() . '/zen-internals/template.block-editing.inc';
        zen_preprocess_block_editing($vars, $hook);
        $vars['classes_array'][] = 'with-block-editing';
    }
}
开发者ID:CalvinZhu,项目名称:boinc,代码行数:37,代码来源:template.php

示例7: foreach

        print '</li>';
    }
    ?>
  </div>
  <?php 
}
?>
    </div>
  </div>
  <div id="footer" class="footer">
    <div class="doc">
  <?php 
if ($footer_message) {
    print '<span id="footer_message">' . $footer_message . '</span>';
}
foreach (block_list('footer') as $block) {
    print $block->content;
}
?>
    </div>
  </div>
<?php 
if ($node->type == 'kbarticle') {
    ?>
<script type="text/javascript">

function showfor_start() {
    var os = 'windows';
    var browser = 'firefox3.6';
    var detect_os = true;
    var detect_browser = true;  
开发者ID:rodin,项目名称:mcskb,代码行数:31,代码来源:page.tpl.php

示例8: zen_blocks

/**
 * Return a set of blocks available for the current user.
 *
 * @param $region
 *   Which set of blocks to retrieve.
 * @param $show_blocks
 *   A boolean to determine whether to render sidebar regions or not. Should be
 *   the same value as passed to theme_page.
 * @return
 *   A string containing the themed blocks for this region.
 *
 * @see zen_show_blocks_discovery()
 */
function zen_blocks($region, $show_blocks = NULL)
{
    // Since Drupal 6 doesn't pass $show_blocks to theme_blocks, we manually call
    // theme('blocks', NULL, $show_blocks) so that this function can remember the
    // value on later calls.
    static $render_sidebars = TRUE;
    if (!is_null($show_blocks)) {
        $render_sidebars = $show_blocks;
    }
    // If zen_blocks was called with a NULL region, its likely we were just
    // setting the $render_sidebars static variable.
    if ($region) {
        $output = '';
        // If $renders_sidebars is FALSE, don't render any region whose name begins
        // with "sidebar_".
        if (($render_sidebars || strpos($region, 'sidebar_') !== 0) && ($list = block_list($region))) {
            foreach ($list as $key => $block) {
                // $key == module_delta
                $output .= theme('block', $block);
            }
        }
        // Add any content assigned to this region through drupal_set_content() calls.
        $output .= drupal_get_content($region);
        $elements['#children'] = $output;
        $elements['#region'] = $region;
        return $output ? theme('region', $elements) : '';
    }
}
开发者ID:aakb,项目名称:Urban-media-space,代码行数:41,代码来源:template.php

示例9: dolphin_preprocess_block

/**
 * This function create the EDIT LINKS for blocks and menus blocks.
 * When overing a block (except in IE6), some links appear to edit
 * or configure the block. You can then edit the block, and once you are
 * done, brought back to the first page.
 *
 * @param $vars
 *  A sequential array of variables to pass to the theme template.
 * @param $hook
 *  The name of the theme function being called ("block" in this case.)
 */
function dolphin_preprocess_block(&$vars, $hook)
{
    $block = $vars['block'];
    // special block classes
    $classes = array('block');
    $classes[] = dolphin_id_safe('block-' . $vars['block']->module);
    $classes[] = dolphin_id_safe('block-' . $vars['block']->region);
    $classes[] = dolphin_id_safe('block-id-' . $vars['block']->bid);
    $classes[] = 'clearfix';
    // support for Skinr Module
    if (module_exists('skinr')) {
        $classes[] = $vars['skinr'];
    }
    $vars['block_classes'] = implode(' ', $classes);
    // Concatenate with spaces
    if (theme_get_setting('dolphin_block_editing') && user_access('administer blocks')) {
        // Display 'edit block' for custom blocks.
        if ($block->module == 'block') {
            $edit_links[] = l('<span>' . t('edit block') . '</span>', 'admin/build/block/configure/' . $block->module . '/' . $block->delta, array('attributes' => array('title' => t('edit the content of this block'), 'class' => 'block-edit'), 'query' => drupal_get_destination(), 'html' => TRUE));
        } else {
            $edit_links[] = l('<span>' . t('configure') . '</span>', 'admin/build/block/configure/' . $block->module . '/' . $block->delta, array('attributes' => array('title' => t('configure this block'), 'class' => 'block-config'), 'query' => drupal_get_destination(), 'html' => TRUE));
        }
        // Display 'edit menu' for Menu blocks.
        if (($block->module == 'menu' || $block->module == 'user' && $block->delta == 1) && user_access('administer menu')) {
            $menu_name = $block->module == 'user' ? 'navigation' : $block->delta;
            $edit_links[] = l('<span>' . t('edit menu') . '</span>', 'admin/build/menu-customize/' . $menu_name, array('attributes' => array('title' => t('edit the menu that defines this block'), 'class' => 'block-edit-menu'), 'query' => drupal_get_destination(), 'html' => TRUE));
        } elseif ($block->module == 'menu_block' && user_access('administer menu')) {
            list($menu_name, ) = split(':', variable_get("menu_block_{$block->delta}_parent", 'navigation:0'));
            $edit_links[] = l('<span>' . t('edit menu') . '</span>', 'admin/build/menu-customize/' . $menu_name, array('attributes' => array('title' => t('edit the menu that defines this block'), 'class' => 'block-edit-menu'), 'query' => drupal_get_destination(), 'html' => TRUE));
        }
        $vars['edit_links_array'] = $edit_links;
        $vars['edit_links'] = '<div class="edit">' . implode(' ', $edit_links) . '</div>';
    }
    // Add first/last block classes
    $first_last = "";
    // If block id (count) is 1, it's first in region.
    if ($vars['block_id'] == '1') {
        $first_last = " first";
        $vars['block_classes'] .= $first_last;
    }
    // Count amount of blocks about to be rendered in that region.
    $block_count = count(block_list($vars['block']->region));
    if ($vars['block_id'] == $block_count) {
        $first_last = " last";
        $vars['block_classes'] .= $first_last;
    }
}
开发者ID:keilovecraft,项目名称:dolphin,代码行数:58,代码来源:template.php

示例10: open_framework_is_in_nav_menu

function open_framework_is_in_nav_menu($element)
{
    // #theme holds one or more suggestions for theming function names for the link
    // simplify things by casting into an array
    $link_theming_functions = isset($element['#theme']) ? (array) $element['#theme'] : array();
    // Avoid calculating this more than once
    $nav_theming_functions =& drupal_static(__FUNCTION__);
    // if not done yet, calculate the names of the theming function for all the blocks
    // in the navigation region
    if (!isset($nav_theming_functions)) {
        // get all blocks in the navigation region
        $blocks = block_list('navigation');
        // Blocks placed using the context module don't show up using Drupal's block_list
        // If context is enabled, see if it has placed any blocks in the navigation area
        // See: http://drupal.org/node/785350
        $context_blocks = array();
        if (module_exists('context')) {
            $reaction_block_plugin = context_get_plugin('reaction', 'block');
            $context_blocks = $reaction_block_plugin->block_list('navigation');
        }
        $blocks = array_merge($blocks, $context_blocks);
        // extract just their IDs (<module>_<delta>)
        $ids = array_keys($blocks);
        // translate the ids into function names for comparison purposes
        $nav_theming_functions = array_map('open_framework_block_id_to_function_name', $ids);
    }
    // if there is nothing in the navigation section, the main menu is added automatically, so
    // we watch for that.
    // 'menu_link__main_menu' is the theming function name for the main-menu
    if (empty($nav_theming_functions) && in_array('menu_link__main_menu', $link_theming_functions)) {
        return TRUE;
    }
    // Find out if any of the theming functions for the blocks are the same
    // as the theming functions for the link.
    $intersect = array_intersect($nav_theming_functions, $link_theming_functions);
    if (!empty($intersect)) {
        return TRUE;
    } else {
        return FALSE;
    }
}
开发者ID:Sorekk,项目名称:cvillecouncilus,代码行数:41,代码来源:template.php

示例11: urbanmediaspace_blocks

function urbanmediaspace_blocks($region, $show_blocks = NULL)
{
    if (module_exists("context")) {
        // Since Drupal 6 doesn't pass $show_blocks to theme_blocks, we manually call
        // theme('blocks', NULL, $show_blocks) so that this function can remember the
        // value on later calls.
        static $render_sidebars = TRUE;
        if (!is_null($show_blocks)) {
            $render_sidebars = $show_blocks;
        }
        // Is the Context module enabled? If so make sure that the blocks Context wants to display get displayed
        if ($region) {
            $output = '';
            if (module_exists("context")) {
                // Get the Context plugin needed to get the blocks that needs to be displayed for this region
                $plugin = context_get_plugin('reaction', 'block');
                // Let's get the blocks that should be displayed from Context.
                if (is_object($plugin)) {
                    $output .= $plugin->execute($region);
                }
            } else {
                // If $renders_sidebars is FALSE, don't render any region whose name begins
                // with "sidebar_".
                if (($render_sidebars || strpos($region, 'sidebar_') !== 0) && ($list = block_list($region))) {
                    foreach ($list as $key => $block) {
                        // $key == module_delta
                        $output .= theme('block', $block);
                    }
                }
                // Add any content assigned to this region through drupal_set_content() calls.
                $output .= drupal_get_content($region);
            }
            $elements['#children'] = $output;
            $elements['#region'] = $region;
            return $output ? theme('region', $elements) : '';
        }
    } else {
        return zen_blocks($region, $show_blocks);
    }
}
开发者ID:aakb,项目名称:Urban-media-space,代码行数:40,代码来源:template.php

示例12: fusion_core_block_list

/**
 * Returns a list of blocks.  
 * Uses Drupal block interface and appends any blocks assigned by the Context module.
 */
function fusion_core_block_list($region) {
  $drupal_list = block_list($region);
  if (module_exists('context')) {
    $context = context_get_plugin('reaction', 'block');
    $context_list = $context->block_list($region);
    $drupal_list = array_merge($context_list, $drupal_list);
  }
  return $drupal_list;
}
开发者ID:richielokay,项目名称:drupal7,代码行数:13,代码来源:template.php

示例13: jbase_preprocess_block

/**
 * Override or insert variables into the block templates.
 *
 * @param $vars
 *   An array of variables to pass to the theme template.
 */
function jbase_preprocess_block(&$vars)
{
    $block = $vars['block'];
    // First/last block position
    $vars['position'] = $vars['block_id'] == 1 ? 'first' : '';
    if ($vars['block_id'] == count(block_list($block->region))) {
        $vars['position'] = $vars['position'] ? '' : 'last';
    }
}
开发者ID:jaywolf,项目名称:jBase,代码行数:15,代码来源:template.php

示例14: cms_base_preprocess_block

/**
 * Override or insert variables into the block templates.
 *
 * @param $vars
 *   An array of variables to pass to the theme template.
 */
function cms_base_preprocess_block(&$vars)
{
    $block = $vars['block'];
    // Special classes for blocks.Allows advanced theming based on context.
    $classes = array();
    $classes[] = 'block-' . $block->module;
    $classes[] = 'region-' . $vars['block_zebra'];
    $classes[] = $vars['zebra'];
    $classes[] = 'region-count-' . $vars['block_id'];
    $classes[] = 'count-' . $vars['id'];
    $vars['edit_links_array'] = array();
    $vars['edit_links'] = '';
    if (theme_get_setting('block_editing_link') && user_access('administer blocks')) {
        $classes[] = 'with-block-editing';
        $vars['block_edit_links_array'] = _cms_base_block_editing_links($vars['block']);
        foreach ($vars['block_edit_links_array'] as $edit_link) {
            $links[] = l('<span>' . $edit_link['title'] . '</span>', $edit_link['url'], array('attributes' => $edit_link['attributes'], 'query' => $edit_link['query'], 'fragment' => $edit_link['fragment'], 'html' => TRUE));
        }
        $vars['block_edit_links'] = '<div class="block-edit">' . implode(' ', $links) . '</div>';
    }
    // Grid class on basis of block count like 'grid_4 if there are for blocks in region (listed in array)
    $dynamic_regions = array('content_top1', 'content_top4', 'content_bottom2', 'content_bottom3', 'footer', 'footer2');
    if (in_array($vars['block']->region, $dynamic_regions)) {
        $block_total_count = count(block_list($vars['block']->region));
        $block_total_count = $block_total_count >= 4 ? 4 : $block_total_count;
        $block_count = 12 / $block_total_count;
        $classes[] = ' grid_' . $block_count;
    }
    // Render block classes.
    $vars['classes'] = implode(' ', $classes);
}
开发者ID:naveen3,项目名称:test2-online,代码行数:37,代码来源:template.php

示例15: tendu_preprocess_block

/**
 * Override block variables to add a variable with "first" and "last" classes to blocks per region
 * Again, most of the variables here are Drupals default.
 * I added $block_region_placement to pass the first/last string to the tpl.
 *  
 * @param $variables
 * A list of block variables
 */
function tendu_preprocess_block(&$variables)
{
    $block_region_placement = array();
    static $block_counter = array();
    // All blocks get an independent counter for each region.
    if (!isset($block_counter[$variables['block']->region])) {
        $block_counter[$variables['block']->region] = 1;
    }
    //Get a list of all blocks in this block's region
    $list = block_list($variables['block']->region);
    //Set class "first" to the first block
    if ($block_counter[$variables['block']->region] == 1) {
        $block_region_placement[] = 'block-first';
    }
    //Set class "last" to the last block
    if ($block_counter[$variables['block']->region] == count($list)) {
        $block_region_placement[] = 'block-last';
    }
    $block_region_placement = array_filter($block_region_placement);
    // Remove empty elements
    $variables['block_region_placement'] = implode(' ', $block_region_placement);
    // Create class list separated by spaces
    // Continue with Drupal default variables
    $variables['block_zebra'] = $block_counter[$variables['block']->region] % 2 ? 'odd' : 'even';
    $variables['block_id'] = $block_counter[$variables['block']->region]++;
    $variables['template_files'][] = 'block-' . $variables['block']->region;
    $variables['template_files'][] = 'block-' . $variables['block']->module;
    $variables['template_files'][] = 'block-' . $variables['block']->module . '-' . $variables['block']->delta;
}
开发者ID:edwardchan,项目名称:israel-catalog,代码行数:37,代码来源:template.php


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