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


PHP menu_list_system_menus函数代码示例

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


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

示例1: lemon_preprocess_page

/**
 * Override or insert variables into the page template.
 *
 * @param $variables
 *   An array of variables to pass to the theme template.
 * @param $hook
 *   The name of the template being rendered ("page" in this case.)
 */
function lemon_preprocess_page(&$variables, $hook)
{
    // Find the title of the menu used by the secondary links.
    $secondary_links = variable_get('menu_secondary_links_source', 'user-menu');
    if ($secondary_links) {
        $menus = function_exists('menu_get_menus') ? menu_get_menus() : menu_list_system_menus();
        $variables['secondary_menu_heading'] = $menus[$secondary_links];
    } else {
        $variables['secondary_menu_heading'] = '';
    }
}
开发者ID:johnedelatorre,项目名称:fusion,代码行数:19,代码来源:template.php

示例2: settingsForm

 public function settingsForm(array $form, array &$form_state)
 {
     $menu_enabled = \Drupal::moduleHandler()->moduleExists('menu_ui');
     if ($menu_enabled) {
         $menus = array('__new-menu__' => t('Create new menu(s)')) + menu_ui_get_menus();
     } else {
         $menus = menu_list_system_menus();
     }
     $form['existing_menus'] = array('#type' => 'checkboxes', '#title' => t('Generate links for these menus'), '#options' => $menus, '#default_value' => array('__new-menu__'), '#required' => TRUE);
     if ($menu_enabled) {
         $form['num_menus'] = array('#type' => 'textfield', '#title' => t('Number of new menus to create'), '#default_value' => $this->getSetting('num_menus'), '#size' => 10, '#states' => array('visible' => array(':input[name=existing_menus[__new-menu__]]' => array('checked' => TRUE))));
     }
     $form['num_links'] = array('#type' => 'textfield', '#title' => t('Number of links to generate'), '#default_value' => $this->getSetting('num_links'), '#size' => 10, '#required' => TRUE);
     $form['title_length'] = array('#type' => 'textfield', '#title' => t('Maximum number of characters in menu and menu link names'), '#description' => t("The minimum length is 2."), '#default_value' => $this->getSetting('title_length'), '#size' => 10, '#required' => TRUE);
     $form['link_types'] = array('#type' => 'checkboxes', '#title' => t('Types of links to generate'), '#options' => array('node' => t('Nodes'), 'front' => t('Front page'), 'external' => t('External')), '#default_value' => array('node', 'front', 'external'), '#required' => TRUE);
     $form['max_depth'] = array('#type' => 'select', '#title' => t('Maximum link depth'), '#options' => range(0, MENU_MAX_DEPTH), '#default_value' => floor(MENU_MAX_DEPTH / 2), '#required' => TRUE);
     unset($form['max_depth']['#options'][0]);
     $form['max_width'] = array('#type' => 'textfield', '#title' => t('Maximum menu width'), '#default_value' => $this->getSetting('max_width'), '#size' => 10, '#description' => t("Limit the width of the generated menu's first level of links to a certain number of items."), '#required' => TRUE);
     $form['kill'] = array('#type' => 'checkbox', '#title' => t('Delete existing custom generated menus and menu links before generating new ones.'), '#default_value' => $this->getSetting('kill'));
     return $form;
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:21,代码来源:MenuDevelGenerate.php

示例3: build_form

  function build_form($form, &$form_state) {
    $style_options = views_fetch_plugin_names('style', 'normal', array($this->base_table));
    $feed_row_options = views_fetch_plugin_names('row', 'feed', array($this->base_table));
    $path_prefix = url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q=');

    // Add filters and sorts which apply to the view as a whole.
    $this->build_filters($form, $form_state);
    $this->build_sorts($form, $form_state);

    $form['displays']['page'] = array(
      '#type' => 'fieldset',
      '#attributes' => array('class' => array('views-attachment', 'fieldset-no-legend'),),
      '#tree' => TRUE,
    );
    $form['displays']['page']['create'] = array(
      '#title' => t('Create a page'),
      '#type' => 'checkbox',
      '#attributes' => array('class' => array('strong')),
      '#default_value' => TRUE,
      '#id' => 'edit-page-create',
    );

    // All options for the page display are included in this container so they
    // can be hidden en masse when the "Create a page" checkbox is unchecked.
    $form['displays']['page']['options'] = array(
      '#type' => 'container',
      '#attributes' => array('class' => array('options-set'),),
      '#dependency' => array(
        'edit-page-create' => array(1),
      ),
      '#pre_render' => array('ctools_dependent_pre_render'),
      '#prefix' => '<div><div id="edit-page-wrapper">',
      '#suffix' => '</div></div>',
      '#parents' => array('page'),
    );

    $form['displays']['page']['options']['title'] = array(
      '#title' => t('Page title'),
      '#type' => 'textfield',
    );
    $form['displays']['page']['options']['path'] = array(
      '#title' => t('Path'),
      '#type' => 'textfield',
      '#field_prefix' => $path_prefix,
    );
    $form['displays']['page']['options']['style'] = array(
      '#type' => 'fieldset',
      '#attributes' => array('class' => array('container-inline', 'fieldset-no-legend')),
    );

    // Create the dropdown for choosing the display format.
    $form['displays']['page']['options']['style']['style_plugin'] = array(
      '#title' => t('Display format'),
      '#help_topic' => 'style',
      '#type' => 'select',
      '#options' => $style_options,
    );
    $style_form = &$form['displays']['page']['options']['style'];
    $style_form['style_plugin']['#default_value'] = views_ui_get_selected($form_state, array('page', 'style', 'style_plugin'), 'default', $style_form['style_plugin']);
    // Changing this dropdown updates $form['displays']['page']['options'] via
    // AJAX.
    views_ui_add_ajax_trigger($style_form, 'style_plugin', array('displays', 'page', 'options'));

    $this->build_form_style($form, $form_state, 'page');
    $form['displays']['page']['options']['items_per_page'] = array(
      '#title' => t('Items per page'),
      '#type' => 'textfield',
      '#default_value' => '10',
      '#size' => 5,
      '#element_validate' => array('_element_validate_integer_positive'),
    );
    $form['displays']['page']['options']['link'] = array(
      '#title' => t('Create a menu link'),
      '#type' => 'checkbox',
      '#id' => 'edit-page-link',
    );
    $form['displays']['page']['options']['link_properties'] = array(
      '#type' => 'container',
      '#dependency' => array(
        'edit-page-link' => array(1),
      ),
      '#pre_render' => array('ctools_dependent_pre_render'),
      '#prefix' => '<div id="edit-page-link-properties-wrapper">',
      '#suffix' => '</div>',
    );
    if (module_exists('menu')) {
      $menu_options = menu_get_menus();
    }
    else {
      // These are not yet translated.
      $menu_options = menu_list_system_menus();
      foreach ($menu_options as $name => $title) {
        $menu_options[$name] = t($title);
      }
    }
    $form['displays']['page']['options']['link_properties']['menu_name'] = array(
      '#title' => t('Menu'),
      '#type' => 'select',
      '#options' => $menu_options,
    );
//.........这里部分代码省略.........
开发者ID:north-central-college,项目名称:hrjobs,代码行数:101,代码来源:views_ui_base_views_wizard.class.php

示例4: clf_preprocess_page

/**
 * Override or insert variables into the page template.
 *
 * @param $variables
 *   An array of variables to pass to the theme template.
 * @param $hook
 *   The name of the template being rendered ("page" in this case.)
 */
function clf_preprocess_page(&$variables, $hook)
{
    if (isset($variables['node']->type)) {
        $nodetype = $variables['node']->type;
        $vars['theme_hook_suggestions'][] = 'page__' . $nodetype;
    }
    $variables['main_menu'] = menu_main_menu();
    // Find the title of the menu used by the secondary links.
    $secondary_links = variable_get('menu_secondary_links_source', 'user-menu');
    if ($secondary_links) {
        $menus = function_exists('menu_get_menus') ? menu_get_menus() : menu_list_system_menus();
        $variables['secondary_menu_heading'] = $menus[$secondary_links];
    } else {
        $variables['secondary_menu_heading'] = '';
    }
}
开发者ID:nathan-w,项目名称:Government-of-Canada-Drupal,代码行数:24,代码来源:template.php

示例5: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state)
 {
     $style_options = Views::fetchPluginNames('style', 'normal', array($this->base_table));
     $feed_row_options = Views::fetchPluginNames('row', 'feed', array($this->base_table));
     $path_prefix = $this->url('<none>', [], ['absolute' => TRUE]);
     // Add filters and sorts which apply to the view as a whole.
     $this->buildFilters($form, $form_state);
     $this->buildSorts($form, $form_state);
     $form['displays']['page'] = array('#type' => 'fieldset', '#title' => $this->t('Page settings'), '#attributes' => array('class' => array('views-attachment', 'fieldset-no-legend')), '#tree' => TRUE);
     $form['displays']['page']['create'] = array('#title' => $this->t('Create a page'), '#type' => 'checkbox', '#attributes' => array('class' => array('strong')), '#default_value' => FALSE, '#id' => 'edit-page-create');
     // All options for the page display are included in this container so they
     // can be hidden as a group when the "Create a page" checkbox is unchecked.
     $form['displays']['page']['options'] = array('#type' => 'container', '#attributes' => array('class' => array('options-set')), '#states' => array('visible' => array(':input[name="page[create]"]' => array('checked' => TRUE))), '#prefix' => '<div><div id="edit-page-wrapper">', '#suffix' => '</div></div>', '#parents' => array('page'));
     $form['displays']['page']['options']['title'] = array('#title' => $this->t('Page title'), '#type' => 'textfield', '#maxlength' => 255);
     $form['displays']['page']['options']['path'] = array('#title' => $this->t('Path'), '#type' => 'textfield', '#field_prefix' => $path_prefix, '#maxlength' => 254);
     $form['displays']['page']['options']['style'] = array('#type' => 'fieldset', '#title' => $this->t('Page display settings'), '#attributes' => array('class' => array('container-inline', 'fieldset-no-legend')));
     // Create the dropdown for choosing the display format.
     $form['displays']['page']['options']['style']['style_plugin'] = array('#title' => $this->t('Display format'), '#type' => 'select', '#options' => $style_options);
     $style_form =& $form['displays']['page']['options']['style'];
     $style_form['style_plugin']['#default_value'] = static::getSelected($form_state, array('page', 'style', 'style_plugin'), 'default', $style_form['style_plugin']);
     // Changing this dropdown updates $form['displays']['page']['options'] via
     // AJAX.
     views_ui_add_ajax_trigger($style_form, 'style_plugin', array('displays', 'page', 'options'));
     $this->buildFormStyle($form, $form_state, 'page');
     $form['displays']['page']['options']['items_per_page'] = array('#title' => $this->t('Items to display'), '#type' => 'number', '#default_value' => 10, '#min' => 0);
     $form['displays']['page']['options']['pager'] = array('#title' => $this->t('Use a pager'), '#type' => 'checkbox', '#default_value' => TRUE);
     $form['displays']['page']['options']['link'] = array('#title' => $this->t('Create a menu link'), '#type' => 'checkbox', '#id' => 'edit-page-link');
     $form['displays']['page']['options']['link_properties'] = array('#type' => 'container', '#states' => array('visible' => array(':input[name="page[link]"]' => array('checked' => TRUE))), '#prefix' => '<div id="edit-page-link-properties-wrapper">', '#suffix' => '</div>');
     if (\Drupal::moduleHandler()->moduleExists('menu_ui')) {
         $menu_options = menu_ui_get_menus();
     } else {
         // These are not yet translated.
         $menu_options = menu_list_system_menus();
         foreach ($menu_options as $name => $title) {
             $menu_options[$name] = $this->t($title);
         }
     }
     $form['displays']['page']['options']['link_properties']['menu_name'] = array('#title' => $this->t('Menu'), '#type' => 'select', '#options' => $menu_options);
     $form['displays']['page']['options']['link_properties']['title'] = array('#title' => $this->t('Link text'), '#type' => 'textfield');
     // Only offer a feed if we have at least one available feed row style.
     if ($feed_row_options) {
         $form['displays']['page']['options']['feed'] = array('#title' => $this->t('Include an RSS feed'), '#type' => 'checkbox', '#id' => 'edit-page-feed');
         $form['displays']['page']['options']['feed_properties'] = array('#type' => 'container', '#states' => array('visible' => array(':input[name="page[feed]"]' => array('checked' => TRUE))), '#prefix' => '<div id="edit-page-feed-properties-wrapper">', '#suffix' => '</div>');
         $form['displays']['page']['options']['feed_properties']['path'] = array('#title' => $this->t('Feed path'), '#type' => 'textfield', '#field_prefix' => $path_prefix, '#maxlength' => 254);
         // This will almost never be visible.
         $form['displays']['page']['options']['feed_properties']['row_plugin'] = array('#title' => $this->t('Feed row style'), '#type' => 'select', '#options' => $feed_row_options, '#default_value' => key($feed_row_options), '#access' => count($feed_row_options) > 1, '#states' => array('visible' => array(':input[name="page[feed]"]' => array('checked' => TRUE))), '#prefix' => '<div id="edit-page-feed-properties-row-plugin-wrapper">', '#suffix' => '</div>');
     }
     // Only offer the block settings if the module is enabled.
     if (\Drupal::moduleHandler()->moduleExists('block')) {
         $form['displays']['block'] = array('#type' => 'fieldset', '#title' => $this->t('Block settings'), '#attributes' => array('class' => array('views-attachment', 'fieldset-no-legend')), '#tree' => TRUE);
         $form['displays']['block']['create'] = array('#title' => $this->t('Create a block'), '#type' => 'checkbox', '#attributes' => array('class' => array('strong')), '#id' => 'edit-block-create');
         // All options for the block display are included in this container so
         // they can be hidden as a group when the "Create a block" checkbox is
         // unchecked.
         $form['displays']['block']['options'] = array('#type' => 'container', '#attributes' => array('class' => array('options-set')), '#states' => array('visible' => array(':input[name="block[create]"]' => array('checked' => TRUE))), '#prefix' => '<div id="edit-block-wrapper">', '#suffix' => '</div>', '#parents' => array('block'));
         $form['displays']['block']['options']['title'] = array('#title' => $this->t('Block title'), '#type' => 'textfield', '#maxlength' => 255);
         $form['displays']['block']['options']['style'] = array('#type' => 'fieldset', '#title' => $this->t('Block display settings'), '#attributes' => array('class' => array('container-inline', 'fieldset-no-legend')));
         // Create the dropdown for choosing the display format.
         $form['displays']['block']['options']['style']['style_plugin'] = array('#title' => $this->t('Display format'), '#type' => 'select', '#options' => $style_options);
         $style_form =& $form['displays']['block']['options']['style'];
         $style_form['style_plugin']['#default_value'] = static::getSelected($form_state, array('block', 'style', 'style_plugin'), 'default', $style_form['style_plugin']);
         // Changing this dropdown updates $form['displays']['block']['options']
         // via AJAX.
         views_ui_add_ajax_trigger($style_form, 'style_plugin', array('displays', 'block', 'options'));
         $this->buildFormStyle($form, $form_state, 'block');
         $form['displays']['block']['options']['items_per_page'] = array('#title' => $this->t('Items per block'), '#type' => 'number', '#default_value' => 5, '#min' => 0);
         $form['displays']['block']['options']['pager'] = array('#title' => $this->t('Use a pager'), '#type' => 'checkbox', '#default_value' => FALSE);
     }
     // Only offer the REST export settings if the module is enabled.
     if (\Drupal::moduleHandler()->moduleExists('rest')) {
         $form['displays']['rest_export'] = array('#type' => 'fieldset', '#title' => $this->t('REST export settings'), '#attributes' => array('class' => array('views-attachment', 'fieldset-no-legend')), '#tree' => TRUE);
         $form['displays']['rest_export']['create'] = array('#title' => $this->t('Provide a REST export'), '#type' => 'checkbox', '#attributes' => array('class' => array('strong')), '#id' => 'edit-rest-export-create');
         // All options for the REST export display are included in this container
         // so they can be hidden as a group when the "Provide a REST export"
         // checkbox is unchecked.
         $form['displays']['rest_export']['options'] = array('#type' => 'container', '#attributes' => array('class' => array('options-set')), '#states' => array('visible' => array(':input[name="rest_export[create]"]' => array('checked' => TRUE))), '#prefix' => '<div id="edit-rest-export-wrapper">', '#suffix' => '</div>', '#parents' => array('rest_export'));
         $form['displays']['rest_export']['options']['path'] = array('#title' => $this->t('REST export path'), '#type' => 'textfield', '#field_prefix' => $path_prefix, '#maxlength' => 254);
     }
     return $form;
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:83,代码来源:WizardPluginBase.php

示例6: gwt_drupal_preprocess_page

/**
 * Override or insert variables into the page template.
 *
 * @param $variables
 *   An array of variables to pass to the theme template.
 * @param $hook
 *   The name of the template being rendered ("page" in this case.)
 */
function gwt_drupal_preprocess_page(&$variables, $hook)
{
    global $base_url;
    // $variables['path_to_theme'] = $base_url.'/'.path_to_theme();
    $js_variables = array('theme_path' => $base_url . '/' . path_to_theme());
    drupal_add_js(array('gwt_drupal' => $js_variables), 'setting');
    // drupal_add_js(drupal_get_path('theme', 'MYTHEME') .'/mytheme.js', 'file');
    // Find the title of the menu used by the secondary links.
    $secondary_links = variable_get('menu_secondary_links_source', 'user-menu');
    if ($secondary_links) {
        $menus = function_exists('menu_get_menus') ? menu_get_menus() : menu_list_system_menus();
        $variables['secondary_menu_heading'] = $menus[$secondary_links];
    } else {
        $variables['secondary_menu_heading'] = '';
    }
    $variables['content_class'] = '';
    $variables['sidebar_first_class'] = ' large-3 medium-3';
    $variables['sidebar_second_class'] = ' large-3 medium-3';
    if (!empty($variables['page']['sidebar_first']) && !empty($variables['page']['sidebar_second'])) {
        $variables['content_class'] .= ' large-6 medium-6 large-push-3 medium-push-3';
        $variables['sidebar_first_class'] .= ' large-pull-6 medium-push-6';
    } elseif (!empty($variables['page']['sidebar_first']) && empty($variables['page']['sidebar_second'])) {
        $variables['content_class'] .= ' large-9 medium-9 large-push-3 medium-push-3';
        $variables['sidebar_first_class'] .= ' large-pull-9 medium-pull-9';
    } elseif (empty($variables['page']['sidebar_first']) && !empty($variables['page']['sidebar_second'])) {
        $variables['content_class'] .= ' large-9 medium-9';
    } else {
        $variables['content_class'] .= ' large-12';
    }
    // create a dynamic column on banner
    $variables['banner_class'] = ' large-12';
    $variables['banner_2_class'] = '';
    $variables['banner_3_class'] = '';
    $variables['banner_container_class'] = ' has-border';
    //  TODO: bug! banner slider and container should not show (if no content on other content) if the banner is medium size media
    if (!empty($variables['page']['banner'])) {
        if (!empty($variables['page']['banner_2']) && !empty($variables['page']['banner_3'])) {
            $variables['banner_class'] = ' large-6';
            $variables['banner_2_class'] = ' large-3';
            $variables['banner_3_class'] = ' large-3';
        } elseif (!empty($variables['page']['banner_2']) && empty($variables['page']['banner_3'])) {
            $variables['banner_class'] = ' large-8';
            $variables['banner_2_class'] = ' large-4';
        } elseif (empty($variables['page']['banner_2']) && !empty($variables['page']['banner_3'])) {
            $variables['banner_class'] = ' large-9';
            $variables['banner_3_class'] = ' large-3';
        }
    } elseif (empty($variables['page']['banner'])) {
        $variables['banner_class'] = '';
        $variables['banner_container_class'] = '';
        if (!empty($variables['page']['banner_2']) && !empty($variables['page']['banner_3'])) {
            $variables['banner_2_class'] = ' large-6';
            $variables['banner_3_class'] = ' large-6';
        } elseif (!empty($variables['page']['banner_2']) && empty($variables['page']['banner_3'])) {
            $variables['banner_2_class'] = ' large-12';
        } elseif (empty($variables['page']['banner_2']) && !empty($variables['page']['banner_3'])) {
            $variables['banner_3_class'] = ' large-12';
        }
    }
    // create a dynamic column on banner
    $variables['name_slogan_class'] = ' large-12';
    $variables['ear_content_class'] = '';
    $variables['ear_content_2_class'] = '';
    // if both banner are available
    if (!empty($variables['page']['ear_content']) && !empty($variables['page']['ear_content_2'])) {
        $variables['name_slogan_class'] = ' large-6';
        $variables['ear_content_class'] = ' large-3';
        $variables['ear_content_2_class'] = ' large-3';
    } elseif (!empty($variables['page']['ear_content']) && !empty($variables['page']['ear_content_2'])) {
        $variables['name_slogan_class'] = ' large-9';
        $variables['ear_content_class'] = ' large-3';
        //$variables['ear_content_2_class'] = '';
    } elseif (empty($variables['page']['ear_content']) && !empty($variables['page']['ear_content_2'])) {
        $variables['name_slogan_class'] = ' large-9';
        //$variables['ear_content_class'] = '';
        $variables['ear_content_2_class'] = ' large-3';
    }
    // TODO: make a function that parse multiple region columns
    // create a dynamic column on agency footer
    $variables['footer_class'] = ' large-12';
    if (!empty($variables['page']['footer_2'])) {
        $variables['footer_class'] = ' large-6';
        $variables['footer_2_class'] = ' large-6';
        $variables['footer_3_class'] = ' large-3';
        $variables['footer_4_class'] = ' large-3';
        if (!empty($variables['page']['footer_3']) && !empty($variables['page']['footer_4'])) {
            $variables['footer_class'] = ' large-3';
            $variables['footer_2_class'] = ' large-3';
        } elseif (empty($variables['page']['footer_3']) && !empty($variables['page']['footer_4'])) {
            $variables['footer_2_class'] = ' large-3';
        } elseif (!empty($variables['page']['footer_3']) && empty($variables['page']['footer_4'])) {
            $variables['footer_class'] = ' large-4';
//.........这里部分代码省略.........
开发者ID:reyjmc03,项目名称:gwt-drupal,代码行数:101,代码来源:template.php

示例7: menu_get_menus

/**
 * Return an associative array of the custom menus names.
 *
 * @param $all
 *   If FALSE return only user-added menus, or if TRUE also include
 *   the menus defined by the system.
 * @return
 *   An array with the machine-readable names as the keys, and human-readable
 *   titles as the values.
 */
function menu_get_menus($all = TRUE)
{
    if ($custom_menus = menu_load_all()) {
        if (!$all) {
            $custom_menus = array_diff_key($custom_menus, menu_list_system_menus());
        }
        foreach ($custom_menus as $menu_name => $menu) {
            $custom_menus[$menu_name] = t($menu['title']);
        }
        asort($custom_menus);
    }
    return $custom_menus;
}
开发者ID:makinacorpus,项目名称:drupal-usync,代码行数:23,代码来源:polyfill-menu-module.php

示例8: testMenuBundles

 /**
  * Tests menu link bundles.
  */
 public function testMenuBundles()
 {
     $this->drupalLogin($this->admin_user);
     $menu = $this->addCustomMenu();
     // Clear the entity cache to ensure the static caches are rebuilt.
     \Drupal::entityManager()->clearCachedBundles();
     $bundles = entity_get_bundles('menu_link');
     $this->assertTrue(isset($bundles[$menu->id()]));
     $menus = menu_list_system_menus();
     $menus[$menu->id()] = $menu->label();
     ksort($menus);
     $this->assertIdentical(array_keys($bundles), array_keys($menus));
     // Test if moving a menu link between menus changes the bundle.
     $node = $this->drupalCreateNode(array('type' => 'article'));
     $item = $this->addMenuLink(0, 'node/' . $node->id(), 'tools');
     $this->moveMenuLink($item, 0, $menu->id());
     $this->assertEqual($item->bundle(), 'tools', 'Menu link bundle matches the menu');
     $moved_item = entity_load('menu_link', $item->id(), TRUE);
     $this->assertNotEqual($moved_item->bundle(), $item->bundle(), 'Menu link bundle was changed');
     $this->assertEqual($moved_item->bundle(), $menu->id(), 'Menu link bundle matches the menu');
     $unsaved_item = entity_create('menu_link', array('menu_name' => $menu->id(), 'link_title' => $this->randomName(16), 'link_path' => '<front>'));
     $this->assertEqual($unsaved_item->bundle(), $menu->id(), 'Unsaved menu link bundle matches the menu');
     $this->assertEqual($unsaved_item->menu_name, $menu->id(), 'Unsaved menu link menu name matches the menu');
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:27,代码来源:MenuTest.php

示例9: constellation_preprocess_block

function constellation_preprocess_block(&$vars)
{
    //dpm($vars);
    if (theme_get_setting('extra_block_classes')) {
        $vars['classes_array'][] = 'block-' . $vars['block_zebra'];
        $vars['classes_array'][] = 'block-count-' . $vars['id'];
        $vars['classes_array'][] = drupal_html_class('block-region-' . $vars['block']->region);
    }
    if (theme_get_setting('horizontal_login_block') && $vars['block']->module == 'user' && $vars['block']->delta == 'login') {
        $vars['classes_array'][] = 'lb-h';
    }
    if (theme_get_setting('slider_login_block') && $vars['block']->module == 'user' && $vars['block']->delta == 'login') {
        $vars['classes_array'][] = 'lb-s';
    }
    $vars['title_attributes_array']['class'][] = 'block-title';
    $vars['content_attributes_array']['class'][] = 'block-content';
    $vars['content_attributes_array']['class'][] = 'content';
    $nav_blocks = array('navigation', 'main-menu', 'management', 'user-menu');
    if (in_array($vars['block']->delta, $nav_blocks)) {
        $vars['theme_hook_suggestions'][] = 'block__menu';
    }
    $nav_modules = array('superfish', 'nice_menus');
    if (in_array($vars['block']->module, $nav_modules)) {
        $vars['theme_hook_suggestions'][] = 'block__menu';
    }
    if ($vars['block']->region == 'menu_bar') {
        $vars['theme_hook_suggestions'][] = 'block__menu_bar';
        $vars['title_attributes_array']['class'][] = 'element-invisible';
    }
    // Provide template suggestions such as block--header--search, or block--menu-bar--menu
    $vars['theme_hook_suggestions'][] = 'block__' . $vars['block']->region . '__' . $vars['block']->module;
    // Add ARIA Roles to blocks, thank-you to Jacine http://drupal.org/user/88931 for cleaning up this code :)
    $roles = array('complementary' => array('aggregator', 'help', 'locale', 'poll', 'profile', 'node' => array('syndicate'), 'system' => array('powered-by', 'help'), 'user' => array('new', 'online')), 'navigation' => array('blog', 'book', 'comment', 'forum', 'menu', 'menu_block', 'node' => array('recent'), 'shortcut', 'statistics', 'system' => array_keys(menu_list_system_menus()), 'superfish', 'nice_menus'), 'search' => array('search'), 'form' => array('user' => array('login')));
    foreach ($roles as $role => $module) {
        if (!is_array($role) && in_array($vars['block']->module, $module)) {
            $vars['attributes_array']['role'] = "{$role}";
        } elseif (is_array($role)) {
            foreach ($role as $module => $delta) {
                if ($vars['block']->module == $module && in_array($vars['block']->delta, $delta)) {
                    $vars['attributes_array']['role'] = "{$role}";
                }
            }
        }
    }
}
开发者ID:neardark,项目名称:nd-staging,代码行数:45,代码来源:template.php


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