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


PHP system_region_list函数代码示例

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


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

示例1: bootstrap_preprocess_region

/**
 * Pre-processes variables for the "region" theme hook.
 *
 * See template for list of available variables.
 *
 * @see region.tpl.php
 *
 * @ingroup theme_preprocess
 */
function bootstrap_preprocess_region(&$variables)
{
    $region = $variables['elements']['#region'];
    $variables['region'] = $region;
    $variables['content'] = $variables['elements']['#children'];
    $theme = \Drupal::theme()->getActiveTheme()->getName();
    // Content region.
    if ($region === 'content') {
        // @todo is this actually used properly?
        $variables['theme_hook_suggestions'][] = 'region__no_wrapper';
    } elseif ($region === 'help' && !empty($variables['content'])) {
        $content = $variables['content'];
        $variables['content'] = array('icon' => array('#markup' => _bootstrap_icon('question-sign')), 'content' => array('#markup' => $content));
        $variables['attributes']['class'][] = 'alert';
        $variables['attributes']['class'][] = 'alert-info';
        $variables['attributes']['class'][] = 'messages';
        $variables['attributes']['class'][] = 'info';
    }
    // Support for "well" classes in regions.
    static $wells;
    if (!isset($wells)) {
        foreach (system_region_list($theme) as $name => $title) {
            $wells[$name] = bootstrap_setting('region_well-' . $name);
        }
    }
    if (!empty($wells[$region])) {
        $variables['attributes']['class'][] = $wells[$region];
    }
}
开发者ID:sathishRio,项目名称:themes,代码行数:38,代码来源:region.vars.php

示例2: teca3_preprocess_region

/**
 * Implements hook_preprocess_region().
 */
function teca3_preprocess_region(&$variables)
{
    global $theme;
    static $wells;
    if (!isset($wells)) {
        foreach (system_region_list($theme) as $name => $title) {
            $wells[$name] = theme_get_setting('bootstrap_region_well-' . $name);
        }
    }
    switch ($variables['region']) {
        // @todo is this actually used properly?
        case 'content':
            $variables['theme_hook_suggestions'][] = 'region__no_wrapper';
            break;
        case 'help':
            $variables['content'] = _bootstrap_icon('question-sign') . $variables['content'];
            $variables['classes_array'][] = 'alert';
            $variables['classes_array'][] = 'alert-info';
            break;
        case 'footer':
            $variables['classes_array'][] = 'container';
            break;
    }
    if (!empty($wells[$variables['region']])) {
        $variables['classes_array'][] = $wells[$variables['region']];
    }
}
开发者ID:drupdateio,项目名称:teca,代码行数:30,代码来源:template.php

示例3: phptemplate_preprocess_page

/**
 * Override or insert PHPTemplate variables into the templates.
 */
function phptemplate_preprocess_page(&$vars)
{
    $vars['tabs2'] = menu_secondary_local_tasks();
    // Hook into color.module
    if (module_exists('color')) {
        _color_page_alter($vars);
    }
    // handy helper for themes, not related to 404 issue
    $vars['base_path'] = base_path();
    // Only does the check if required
    if (!$vars['show_blocks']) {
        global $theme;
        $regions = system_region_list($theme);
        foreach (array_keys($regions) as $region) {
            // Only set left and right regions
            // Drupal core sets the other blocks already
            // IMHO this shows a real lack of design considerations for leaving these out!
            if ($region == 'left' || $region == 'right') {
                $blocks = theme('blocks', $region);
                if (isset($variables[$region])) {
                    $vars[$region] .= $blocks;
                } else {
                    $vars[$region] = $blocks;
                }
            }
        }
    }
}
开发者ID:himmel22,项目名称:jplesson,代码行数:31,代码来源:template.php

示例4: testRegions

 /**
  * Tests setting and retrieving content for theme regions.
  */
 function testRegions()
 {
     global $theme_key;
     $block_regions = array_keys(system_region_list($theme_key));
     $delimiter = $this->randomMachineName(32);
     $values = array();
     // Set some random content for each region available.
     foreach ($block_regions as $region) {
         $first_chunk = $this->randomMachineName(32);
         drupal_add_region_content($region, $first_chunk);
         $second_chunk = $this->randomMachineName(32);
         drupal_add_region_content($region, $second_chunk);
         // Store the expected result for a drupal_get_region_content call for this region.
         $values[$region] = $first_chunk . $delimiter . $second_chunk;
     }
     // Ensure drupal_get_region_content returns expected results when fetching all regions.
     $content = drupal_get_region_content(NULL, $delimiter);
     foreach ($content as $region => $region_content) {
         $this->assertEqual($region_content, $values[$region], format_string('@region region text verified when fetching all regions', array('@region' => $region)));
     }
     // Ensure drupal_get_region_content returns expected results when fetching a single region.
     foreach ($block_regions as $region) {
         $region_content = drupal_get_region_content($region, $delimiter);
         $this->assertEqual($region_content, $values[$region], format_string('@region region text verified when fetching single region.', array('@region' => $region)));
     }
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:29,代码来源:RegionContentTest.php

示例5: bootstrap_preprocess_region

/**
 * Implements hook_preprocess_region().
 */
function bootstrap_preprocess_region(&$variables)
{
    global $theme;
    $region = $variables['region'];
    $classes =& $variables['classes_array'];
    // Content region.
    if ($region === 'content') {
        // @todo is this actually used properly?
        $variables['theme_hook_suggestions'][] = 'region__no_wrapper';
    } elseif ($region === 'help' && !empty($variables['content'])) {
        $variables['content'] = _bootstrap_icon('question-sign') . $variables['content'];
        $classes[] = 'alert';
        $classes[] = 'alert-info';
        $classes[] = 'messages';
        $classes[] = 'info';
    }
    // Support for "well" classes in regions.
    static $wells;
    if (!isset($wells)) {
        foreach (system_region_list($theme) as $name => $title) {
            $wells[$name] = bootstrap_setting('region_well-' . $name);
        }
    }
    if (!empty($wells[$region])) {
        $classes[] = $wells[$region];
    }
}
开发者ID:lcube45,项目名称:hyx,代码行数:30,代码来源:region.vars.php

示例6: urbana_preprocess_node

function urbana_preprocess_node(&$variables)
{
    // Get a list of all the regions for this theme
    foreach (system_region_list($GLOBALS['theme']) as $region_key => $region_name) {
        // Get the content for each region and add it to the $region variable
        if ($blocks = block_get_blocks_by_region($region_key)) {
            $variables['region'][$region_key] = $blocks;
        } else {
            $variables['region'][$region_key] = array();
        }
    }
}
开发者ID:korbinian,项目名称:urbana_neu,代码行数:12,代码来源:template.php

示例7: interact

 protected function interact(InputInterface $input, OutputInterface $output)
 {
     $dialog = $this->getDialogHelper();
     $configFactory = $this->getConfigFactory();
     $theme = $configFactory->get('system.theme')->get('default');
     $theme_regions = system_region_list($theme, REGIONS_VISIBLE);
     // --module option
     $module = $input->getOption('module');
     if (!$module) {
         // @see Drupal\Console\Command\ModuleTrait::moduleQuestion
         $module = $this->moduleQuestion($output, $dialog);
     }
     $input->setOption('module', $module);
     // --class-name option
     $class_name = $input->getOption('class-name');
     if (!$class_name) {
         $class_name = $dialog->askAndValidate($output, $dialog->getQuestion($this->trans('commands.generate.plugin.block.options.class-name'), 'DefaultBlock'), function ($class_name) {
             return $this->validateClassName($class_name);
         }, false, 'DefaultBlock', null);
     }
     $input->setOption('class-name', $class_name);
     $default_label = $this->getStringHelper()->camelCaseToHuman($class_name);
     // --label option
     $label = $input->getOption('label');
     if (!$label) {
         $label = $dialog->ask($output, $dialog->getQuestion($this->trans('commands.generate.plugin.block.options.label'), $default_label), $default_label);
     }
     $input->setOption('label', $label);
     $machine_name = $this->getStringHelper()->camelCaseToUnderscore($class_name);
     // --plugin-id option
     $plugin_id = $input->getOption('plugin-id');
     if (!$plugin_id) {
         $plugin_id = $dialog->ask($output, $dialog->getQuestion($this->trans('commands.generate.plugin.block.options.plugin-id'), $machine_name), $machine_name);
     }
     $input->setOption('plugin-id', $plugin_id);
     // --theme-region option
     $theme_region = $input->getOption('theme-region');
     if (!$theme_region) {
         $theme_region = $dialog->askAndValidate($output, $dialog->getQuestion($this->trans('commands.generate.plugin.block.options.theme-region'), ''), function ($region) use($theme_regions) {
             return array_search($region, $theme_regions);
         }, false, '', $theme_regions);
     }
     $input->setOption('theme-region', $theme_region);
     // --services option
     // @see Drupal\Console\Command\ServicesTrait::servicesQuestion
     $services_collection = $this->servicesQuestion($output, $dialog);
     $input->setOption('services', $services_collection);
     $output->writeln($this->trans('commands.generate.plugin.block.messages.inputs'));
     // @see Drupal\Console\Command\FormTrait::formQuestion
     $form = $this->formQuestion($output, $dialog);
     $input->setOption('inputs', $form);
 }
开发者ID:nfouka,项目名称:DrupalConsole,代码行数:52,代码来源:PluginBlockCommand.php

示例8: drupalexp_page_alter

/**
 * Implement hook_page_alter
 */
function drupalexp_page_alter(&$page)
{
    $regions = system_region_list($GLOBALS['theme'], REGIONS_ALL);
    foreach ($regions as $region => $name) {
        switch ($region) {
            case 'title':
                if (empty($page[$region])) {
                    $page[$region] = array('block_title' => array('#markup' => ''), '#region' => $region, '#theme_wrappers' => array('region'));
                }
                break;
        }
    }
}
开发者ID:egobierno,项目名称:opendata,代码行数:16,代码来源:template.php

示例9: interact

 protected function interact(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $configFactory = $this->getConfigFactory();
     $theme = $configFactory->get('system.theme')->get('default');
     $themeRegions = \system_region_list($theme, REGIONS_VISIBLE);
     // --module option
     $module = $input->getOption('module');
     if (!$module) {
         // @see Drupal\Console\Command\Shared\ModuleTrait::moduleQuestion
         $module = $this->moduleQuestion($output);
         $input->setOption('module', $module);
     }
     // --class option
     $class = $input->getOption('class');
     if (!$class) {
         $class = $io->ask($this->trans('commands.generate.plugin.block.options.class'), 'DefaultBlock', function ($class) {
             return $this->validateClassName($class);
         });
         $input->setOption('class', $class);
     }
     // --label option
     $label = $input->getOption('label');
     if (!$label) {
         $label = $io->ask($this->trans('commands.generate.plugin.block.options.label'), $this->getStringHelper()->camelCaseToHuman($class));
         $input->setOption('label', $label);
     }
     // --plugin-id option
     $pluginId = $input->getOption('plugin-id');
     if (!$pluginId) {
         $pluginId = $io->ask($this->trans('commands.generate.plugin.block.options.plugin-id'), $this->getStringHelper()->camelCaseToUnderscore($class));
         $input->setOption('plugin-id', $pluginId);
     }
     // --theme-region option
     $themeRegion = $input->getOption('theme-region');
     if (!$themeRegion) {
         $themeRegion = $output->choiceNoList($this->trans('commands.generate.plugin.block.options.theme-region'), array_values($themeRegions), null, true);
         $themeRegion = array_search($themeRegion, $themeRegions);
         $input->setOption('theme-region', $themeRegion);
     }
     // --services option
     // @see Drupal\Console\Command\Shared\ServicesTrait::servicesQuestion
     $services = $this->servicesQuestion($output);
     $input->setOption('services', $services);
     $output->writeln($this->trans('commands.generate.plugin.block.messages.inputs'));
     // @see Drupal\Console\Command\Shared\FormTrait::formQuestion
     $inputs = $this->formQuestion($output);
     $input->setOption('inputs', $inputs);
 }
开发者ID:mnico,项目名称:DrupalConsole,代码行数:49,代码来源:PluginBlockCommand.php

示例10: _proma_get_multiple_regions

function _proma_get_multiple_regions($region_types = array('sidebar_'), $theme_override = NULL)
{
    $current_theme = $theme_override ? $theme_override : variable_get('theme_default', $theme_override);
    $regions = system_region_list($current_theme);
    $theme_regions = array();
    // Loop through the region types:
    foreach ($region_types as $region_type) {
        foreach ($regions as $key => $name) {
            if (strpos($key, $region_type) === 0) {
                $theme_regions[$region_type][$key] = $name;
            }
        }
    }
    return $theme_regions;
}
开发者ID:bikramth19,项目名称:wordpress,代码行数:15,代码来源:template.php

示例11: load

 /**
  * {@inheritdoc}
  */
 public function load()
 {
     // If no theme was specified, use the current theme.
     if (!$this->theme) {
         $this->theme = \Drupal::theme()->getActiveTheme()->getName();
     }
     // Store the region list.
     $this->regions = system_region_list($this->theme, REGIONS_VISIBLE);
     // Load only blocks for this theme, and sort them.
     // @todo Move the functionality of _block_rehash() out of the listing page.
     $entities = _block_rehash($this->theme);
     // Sort the blocks using \Drupal\block\Entity\Block::sort().
     uasort($entities, array($this->entityType->getClass(), 'sort'));
     return $entities;
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:18,代码来源:BlockListBuilder.php

示例12: msd15_preprocess_node

/**
 * Preprocessor for node.tpl.php template file.
 */
function msd15_preprocess_node(&$vars)
{
    if ($vars["is_front"]) {
        $vars["theme_hook_suggestions"][] = "node__front";
    }
    // Get a list of all the regions for this theme
    foreach (system_region_list($GLOBALS['theme']) as $region_key => $region_name) {
        // Get the content for each region and add it to the $region variable
        if ($blocks = block_get_blocks_by_region($region_key)) {
            $vars['region'][$region_key] = $blocks;
        } else {
            $vars['region'][$region_key] = array();
        }
    }
}
开发者ID:patpaev,项目名称:benvs15,代码行数:18,代码来源:template.php

示例13: _bartik_process_page

/**
 * Helper function that inserts sample content into empty regions.
 */
function _bartik_process_page(&$variables)
{
    // Lorem ipsum is Latin and doesn't need to be translated.
    $paragraph = '<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p>';
    // List of links to be used in footer regions.
    $list = theme('links', array('links' => array('jean-bartik' => array('title' => t('Jean Bartik'), 'href' => 'http://www.google.com/search?q=Jean+Bartik', 'absolute' => TRUE), 'bartik-settings' => array('title' => t('Bartik theme settings'), 'href' => 'admin/appearance/settings/bartik'), 'drupal' => array('title' => t('Drupal.org'), 'href' => 'http://drupal.org', 'absolute' => TRUE), 'theme-guide' => array('title' => t('Drupal theme guide'), 'href' => 'http://drupal.org/theme-guide', 'absolute' => TRUE))));
    // Generate a link to the settings.
    $link = '<p class="sample-regions-link">' . t('This sample content can be turned off using the “Display sample content in empty regions” option on the !link page.', array('!link' => l(t('Bartik settings'), 'admin/appearance/settings/bartik'))) . '</p>';
    // Create a fake block.
    $block = new stdClass();
    $block->module = 'bartik';
    $block->theme = 'bartik';
    $block->status = 1;
    $block->weight = 0;
    $block->custom = 0;
    $block->visibility = 0;
    $block->pages = '';
    $block->title = '';
    $block->cache = DRUPAL_NO_CACHE;
    $block->subject = 'Lorem ipsum';
    // Grab the list of visible regions.
    $regions = system_region_list('bartik', REGIONS_VISIBLE);
    // Ignore common regions.
    $ignore_regions = array('header', 'highlight', 'help', 'content', 'footer');
    // Generate sample content for any empty regions.
    $bid = 1000;
    foreach ($regions as $region => $label) {
        if (!in_array($region, $ignore_regions) && empty($variables['page'][$region])) {
            // Set dynamic bits of the fake block.
            $bid++;
            $block->bid = $bid;
            $block->delta = 'delta-' . $bid;
            $block->region = $region;
            // Show the list of links in the footer regions, otherwise show lorem ipsum.
            if (strpos($region, 'footer_') === 0) {
                $content = $list . $link;
            } else {
                $content = $paragraph . $link;
            }
            // Load the region.
            $variables['page'][$region] = array('bartik_sample_block' => array('#markup' => $content, '#block' => $block, '#weight' => 0, '#theme_wrappers' => array('block')));
        }
    }
}
开发者ID:jensimmons,项目名称:Bartik,代码行数:47,代码来源:theme-settings.php

示例14: alterForm

 /**
  * {@inheritdoc}
  */
 public function alterForm(array &$form, FormStateInterface $form_state, $form_id = NULL)
 {
     parent::alterForm($form, $form_state, $form_id);
     $group = $this->getGroup($form, $form_state);
     $setting = $this->getElement($form, $form_state);
     // Move description.
     $group->setProperty('description', $setting->getProperty('description'));
     // Retrieve the current default values.
     $default_values = $group->getProperty('default_value', $this->getDefaultValue());
     $wells = ['' => t('None'), 'well' => t('.well (normal)'), 'well well-sm' => t('.well-sm (small)'), 'well well-lg' => t('.well-lg (large)')];
     // Create dynamic well settings for each region.
     $regions = system_region_list($this->theme->getName());
     foreach ($regions as $name => $title) {
         if (in_array($name, ['page_top', 'page_bottom'])) {
             continue;
         }
         $setting->{'region_well-' . $name} = ['#title' => $title, '#type' => 'select', '#attributes' => ['class' => ['input-sm']], '#options' => $wells, '#default_value' => isset($default_values[$name]) ? $default_values[$name] : ''];
     }
 }
开发者ID:Suite5,项目名称:feelmybook,代码行数:22,代码来源:RegionWells.php

示例15: easytheme_preprocess_node

function easytheme_preprocess_node(&$variables)
{
    // Get a list of all the regions for this theme
    foreach (system_region_list($GLOBALS['theme']) as $region_key => $region_name) {
        // Get the content for each region and add it to the $region variable
        if ($blocks = block_get_blocks_by_region($region_key)) {
            $variables['region'][$region_key] = $blocks;
        } else {
            $variables['region'][$region_key] = array();
        }
    }
    /* 
     * region to work with context
     *
     * http://www.raisedeyebrow.com/blog/2012/07/displaying-drupal-context-regions-node-templates
     */
    //$reaction = context_get_plugin('reaction', 'block');
    //$var = $variables['region']['sidebar_first'];
    //$variables['region']['sidebar_first'] = ($reaction->block_get_blocks_by_region('sidebar_first')); //
}
开发者ID:siramsay,项目名称:easytheme,代码行数:20,代码来源:template.php


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