• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP system_region_list函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: gavias_laikafood_preprocess_region

/**
 * Implements hook_preprocess_region().
 */
function gavias_laikafood_preprocess_region(&$variables)
{
    global $theme;
    static $wells;
    if (!isset($wells)) {
        foreach (system_region_list($theme) as $name => $title) {
            $wells[$name] = theme_get_setting('gavias_laikafood_region_well-' . $name);
        }
    }
    switch ($variables['region']) {
        case 'content':
            $variables['theme_hook_suggestions'][] = 'region__no_wrapper';
            break;
        case 'help':
            $variables['content'] = _gavias_laikafood_icon('question-sign') . $variables['content'];
            $variables['classes_array'][] = 'alert';
            $variables['classes_array'][] = 'alert-info';
            break;
    }
    if (trim($wells[$variables['region']])) {
        $variables['classes_array'][] = $wells[$variables['region']];
    }
}
开发者ID:ucaka,项目名称:forestway,代码行数:26,代码来源:template.php


示例17: _maximenu_block_options

/**
 * Loads options to Maximenu admin
 *
 */
function _maximenu_block_options($menu_content = array(), $settings = array())
{
    $form_new = array();
    // Skin
    $output_options = isset($settings['outputs']) ? $settings['outputs'] : '';
    if (!empty($output_options)) {
        $form_new['stacking'] = array('#type' => 'select', '#title' => t('Stacking'), '#options' => array('row' => 'Row', 'column' => 'Column'), '#default_value' => isset($menu_content['stacking']) ? $menu_content['stacking'] : 'row', '#description' => t('
        <ul>
          <li><strong>Row</strong> - all links in 1 row</li>
          <li><strong>Column</strong> -all links in 1 column</li>
        </ul>
       '));
        $form_new['direction'] = array('#type' => 'select', '#title' => t('Block Menu Direction'), '#options' => array('block-down' => 'Dropdown', 'block-up' => 'Dropup', 'block-right' => 'Right', 'block-left' => 'Left'), '#default_value' => isset($menu_content['direction']) ? $menu_content['direction'] : 'block-down', '#description' => t('OM Maximenu will popup on this direction. Applicable only with dropdown style.'));
        $theme_default = variable_get('theme_default', 'garland');
        $region_none = array('' => 'none');
        $regions = system_region_list($theme_default);
        $regions = array_merge($region_none, $regions);
        $form_new['region'] = array('#type' => 'select', '#title' => t('Region'), '#options' => $regions, '#default_value' => isset($menu_content['region']) ? $menu_content['region'] : '', '#description' => t('Select theme region.'));
        $form_new['weight'] = array('#type' => 'weight', '#title' => t('Block Weight'), '#delta' => 200, '#default_value' => isset($menu_content['weight']) ? $menu_content['weight'] : 0, '#description' => t('Negative values have the highest position in the order, so -1 comes first before 0 then 1, ...'));
        $access = user_access('use PHP for settings');
        if (isset($menu_content['visibility']) && $menu_content['visibility'] == 2 && !$access) {
            $form_new['visibility'] = array('#type' => 'value', '#value' => 2);
            $form_new['pages'] = array('#type' => 'value', '#value' => $menu_content['pages']);
        } else {
            $options = array(t('Show on every page except the listed pages.'), t('Show on only the listed pages.'));
            $description = t("Enter one page per line as Drupal paths. The '*' character is a wildcard. Example paths are %blog for the blog page and %blog-wildcardfor every personal blog. %front is the front page.", array('%blog' => 'blog', '%blog-wildcard' => 'blog/*', '%front' => '<front>'));
            if (module_exists('php') && $access) {
                $options[] = t('Show if the following PHP code returns <code>TRUE</code> (PHP-mode, experts only).');
                $description .= ' ' . t('If the PHP-mode is chosen, enter PHP code between %php. Note that executing incorrect PHP-code canbreak your Drupal site.', array('%php' => '<?php ?>'));
            }
            $form_new['visibility'] = array('#type' => 'radios', '#title' => t('Show menu on specific pages'), '#options' => $options, '#default_value' => isset($menu_content['visibility']) ? $menu_content['visibility'] : 0);
            $form_new['pages'] = array('#type' => 'textarea', '#title' => t('Pages'), '#default_value' => isset($menu_content['pages']) ? $menu_content['pages'] : '', '#description' => $description);
        }
    }
    return $form_new;
}
开发者ID:ph3l1x,项目名称:mydea,代码行数:40,代码来源:block.options.php


示例18: testPlacingBlocksAdmin

 /**
  * Tests placing blocks as an admin.
  */
 public function testPlacingBlocksAdmin()
 {
     // Create administrative user.
     $this->drupalLogin($this->drupalCreateUser(['access administration pages', 'access toolbar', 'administer blocks', 'view the administration theme']));
     $this->drupalGet(Url::fromRoute('<front>'));
     $this->clickLink('Place block');
     // Each region should have one link to place a block.
     $theme_name = $this->container->get('theme.manager')->getActiveTheme()->getName();
     $visible_regions = system_region_list($theme_name, REGIONS_VISIBLE);
     $this->assertGreaterThan(0, count($visible_regions));
     $default_theme = $this->config('system.theme')->get('default');
     $block_library_url = Url::fromRoute('block.admin_library', ['theme' => $default_theme]);
     foreach ($visible_regions as $region => $name) {
         $block_library_url->setOption('query', ['region' => $region]);
         $links = $this->xpath('//a[contains(@href, :href)]', [':href' => $block_library_url->toString()]);
         $this->assertEquals(1, count($links));
         list(, $query_string) = explode('?', $links[0]->getAttribute('href'), 2);
         parse_str($query_string, $query_parts);
         $this->assertNotEmpty($query_parts['destination']);
         // Get the text inside the div->a->span->em.
         $demo_block = $this->xpath('//div[@class="block-place-region"]/a/span[text()="Place block in the "]/em[text()="' . $name . '"]');
         $this->assertEquals(1, count($demo_block));
     }
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:27,代码来源:BlockPlaceTest.php


示例19: systemRegionList

 /**
  * Wraps system_region_list().
  */
 protected function systemRegionList($theme, $show = REGIONS_ALL)
 {
     return system_region_list($theme, $show);
 }
开发者ID:ravindrasingh22,项目名称:Drupal-8-rc,代码行数:7,代码来源:BlockListBuilder.php


示例20: clf_page_alter

/**
 * Implements hook_page_alter().
 *
 * Look for the last block in the region. This is impossible to determine from
 * within a preprocess_block function.
 *
 * @param $page
 *   Nested array of renderable elements that make up the page.
 */
function clf_page_alter(&$page)
{
    // Look in each visible region for blocks.
    foreach (system_region_list($GLOBALS['theme'], REGIONS_VISIBLE) as $region => $name) {
        if (!empty($page[$region])) {
            // Find the last block in the region.
            $blocks = array_reverse(element_children($page[$region]));
            while ($blocks && !isset($page[$region][$blocks[0]]['#block'])) {
                array_shift($blocks);
            }
            if ($blocks) {
                $page[$region][$blocks[0]]['#block']->last_in_region = TRUE;
            }
        }
    }
}
开发者ID:nathan-w,项目名称:Government-of-Canada-Drupal,代码行数:25,代码来源:template.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP system_resolvconf_generate函数代码示例发布时间:2022-05-23
下一篇:
PHP system_rebuild_theme_data函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap