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


PHP system_admin_compact_mode函数代码示例

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


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

示例1: slate_admin_block_content

/**
 * Override of theme_admin_block_content().
 */
function slate_admin_block_content($content, $get_runstate = FALSE)
{
    static $has_run = FALSE;
    if ($get_runstate) {
        return $has_run;
    }
    $has_run = TRUE;
    $output = '';
    if (!empty($content)) {
        foreach ($content as $k => $item) {
            $id = str_replace('/', '-', $item['href']);
            $class = ' path-' . $id;
            $content[$k]['title'] = "<span class='icon'></span>{$item['title']}";
            $content[$k]['localized_options']['html'] = TRUE;
            if (!empty($content[$k]['localized_options']['attributes']['class'])) {
                $content[$k]['localized_options']['attributes']['class'] .= $class;
            } else {
                $content[$k]['localized_options']['attributes']['class'] = $class;
            }
        }
        $output = system_admin_compact_mode() ? '<ul class="menu">' : '<ul class="admin-list">';
        foreach ($content as $item) {
            $output .= '<li class="leaf">';
            $output .= l($item['title'], $item['href'], $item['localized_options']);
            if (!system_admin_compact_mode()) {
                $output .= "<div class='description'>{$item['description']}</div>";
            }
            $output .= '</li>';
        }
        $output .= '</ul>';
    }
    return $output;
}
开发者ID:ricardoreis,项目名称:Atrium,代码行数:36,代码来源:template.php

示例2: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, array &$form_state)
 {
     $role_names = array();
     $role_permissions = array();
     foreach ($this->getRoles() as $role_name => $role) {
         // Retrieve role names for columns.
         $role_names[$role_name] = String::checkPlain($role->label());
         // Fetch permissions for the roles.
         $role_permissions[$role_name] = $role->getPermissions();
     }
     // Store $role_names for use when saving the data.
     $form['role_names'] = array('#type' => 'value', '#value' => $role_names);
     // Render role/permission overview:
     $options = array();
     $module_info = system_rebuild_module_data();
     $hide_descriptions = system_admin_compact_mode();
     // Get a list of all the modules implementing a hook_permission() and sort by
     // display name.
     $modules = array();
     foreach ($this->moduleHandler->getImplementations('permission') as $module) {
         $modules[$module] = $module_info[$module]->info['name'];
     }
     asort($modules);
     $form['system_compact_link'] = array('#theme' => 'system_compact_link');
     $form['permissions'] = array('#type' => 'table', '#header' => array($this->t('Permission')), '#id' => 'permissions', '#sticky' => TRUE);
     foreach ($role_names as $name) {
         $form['permissions']['#header'][] = array('data' => $name, 'class' => array('checkbox'));
     }
     foreach ($modules as $module => $display_name) {
         if ($permissions = $this->moduleHandler->invoke($module, 'permission')) {
             // Module name.
             $form['permissions'][$module] = array(array('#wrapper_attributes' => array('colspan' => count($role_names) + 1, 'class' => array('module'), 'id' => 'module-' . $module), '#markup' => $module_info[$module]->info['name']));
             foreach ($permissions as $perm => $perm_item) {
                 // Fill in default values for the permission.
                 $perm_item += array('description' => '', 'restrict access' => FALSE, 'warning' => !empty($perm_item['restrict access']) ? $this->t('Warning: Give to trusted roles only; this permission has security implications.') : '');
                 $options[$perm] = $perm_item['title'];
                 // Show the permission description.
                 if (!$hide_descriptions) {
                     $user_permission_description = $perm_item['description'];
                     // Append warning message.
                     if (!empty($perm_item['warning'])) {
                         $user_permission_description .= ' <em class="permission-warning">' . $perm_item['warning'] . '</em>';
                     }
                 }
                 $form['permissions'][$perm]['description'] = array('#wrapper_attributes' => array('class' => array('permission')), '#type' => 'item', '#markup' => $perm_item['title'], '#description' => $user_permission_description);
                 $options[$perm] = '';
                 foreach ($role_names as $rid => $name) {
                     $form['permissions'][$perm][$rid] = array('#title' => $name . ': ' . $perm_item['title'], '#title_display' => 'invisible', '#wrapper_attributes' => array('class' => array('checkbox')), '#type' => 'checkbox', '#default_value' => in_array($perm, $role_permissions[$rid]) ? 1 : 0, '#attributes' => array('class' => array('rid-' . $rid)), '#parents' => array($rid, $perm));
                 }
             }
         }
     }
     $form['actions'] = array('#type' => 'actions');
     $form['actions']['submit'] = array('#type' => 'submit', '#value' => $this->t('Save permissions'));
     $form['#attached']['library'][] = 'user/drupal.user.permissions';
     return $form;
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:60,代码来源:UserPermissionsForm.php

示例3: preRenderCompactLink

 /**
  * Pre-render callback: Renders a link into #markup.
  *
  * Doing so during pre_render gives modules a chance to alter the link parts.
  *
  * @param array $element
  *   A structured array whose keys form the arguments to Drupal::l():
  *   - #title: The link text to pass as argument to Drupal::l().
  *   - One of the following:
  *     - #route_name and (optionally) a #route_parameters array; The route
  *       name and route parameters which will be passed into the link
  *       generator.
  *     - #href: The system path or URL to pass as argument to Drupal::l().
  *   - #options: (optional) An array of options to pass to Drupal::l() or the
  *     link generator.
  *
  * @return array
  *   The passed-in element containing the system compact link default values.
  */
 public static function preRenderCompactLink($element)
 {
     // By default, link options to pass to l() are normally set in #options.
     $element += array('#options' => array());
     if (system_admin_compact_mode()) {
         $element['#title'] = t('Show descriptions');
         $element['#url'] = BaseUrl::fromRoute('system.admin_compact_page', array('mode' => 'off'));
         $element['#options'] = array('attributes' => array('title' => t('Expand layout to include descriptions.')), 'query' => \Drupal::destination()->getAsArray());
     } else {
         $element['#title'] = t('Hide descriptions');
         $element['#url'] = BaseUrl::fromRoute('system.admin_compact_page', array('mode' => 'on'));
         $element['#options'] = array('attributes' => array('title' => t('Compress layout by hiding descriptions.')), 'query' => \Drupal::destination()->getAsArray());
     }
     $options = NestedArray::mergeDeep($element['#url']->getOptions(), $element['#options']);
     $element['#markup'] = \Drupal::l($element['#title'], $element['#url']->setOptions($options));
     return $element;
 }
开发者ID:isramv,项目名称:camp-gdl,代码行数:36,代码来源:SystemCompactLink.php

示例4: seven_admin_block_content

/**
 * Override of theme_admin_block_content().
 *
 * Use unordered list markup in both compact and extended move.
 */
function seven_admin_block_content($content)
{
    $output = '';
    if (!empty($content)) {
        $output = system_admin_compact_mode() ? '<ul class="admin-list compact">' : '<ul class="admin-list">';
        foreach ($content as $item) {
            $output .= '<li class="leaf">';
            $output .= l($item['title'], $item['href'], $item['localized_options']);
            if (!system_admin_compact_mode()) {
                $output .= '<div class="description">' . $item['description'] . '</div>';
            }
            $output .= '</li>';
        }
        $output .= '</ul>';
    }
    return $output;
}
开发者ID:upei,项目名称:drupal6-cms,代码行数:22,代码来源:template.php

示例5: playaround_admin_block_content

/**
 * Overrides theme_admin_block_content().
 *
 * Use unordered list markup in both compact and extended mode.
 */
function playaround_admin_block_content($variables) {
  $content = $variables['content'];
  $output = '';
  if (!empty($content)) {
    $output = system_admin_compact_mode() ? '<ul class="admin-list compact">' : '<ul class="admin-list">';
    foreach ($content as $item) {
      $output .= '<li class="leaf">';
      $output .= l($item['title'], $item['href'], $item['localized_options']);
      if (isset($item['description']) && !system_admin_compact_mode()) {
        $output .= '<div class="description">' . filter_xss_admin($item['description']) . '</div>';
      }
      $output .= '</li>';
    }
    $output .= '</ul>';
  }
  return $output;
}
开发者ID:EpisDiocAlb,项目名称:DrupalSite,代码行数:22,代码来源:template.php

示例6: rubik_admin_block_content

/**
 * Override of theme_admin_block_content().
 */
function rubik_admin_block_content($vars)
{
    $content = $vars['content'];
    $output = '';
    if (!empty($content)) {
        foreach ($content as $k => $item) {
            //-- Safety check for invalid clients of the function
            if (empty($content[$k]['localized_options']['attributes']['class'])) {
                $content[$k]['localized_options']['attributes']['class'] = array();
            }
            if (!is_array($content[$k]['localized_options']['attributes']['class'])) {
                $content[$k]['localized_options']['attributes']['class'] = array($content[$k]['localized_options']['attributes']['class']);
            }
            $content[$k]['title'] = "<span class='icon'></span>" . filter_xss_admin($item['title']);
            $content[$k]['localized_options']['html'] = TRUE;
            if (!empty($content[$k]['localized_options']['attributes']['class'])) {
                $content[$k]['localized_options']['attributes']['class'] += _rubik_icon_classes($item['href']);
            } else {
                $content[$k]['localized_options']['attributes']['class'] = _rubik_icon_classes($item['href']);
            }
        }
        $output = system_admin_compact_mode() ? '<ul class="admin-list admin-list-compact">' : '<ul class="admin-list">';
        foreach ($content as $item) {
            $output .= '<li class="leaf">';
            $output .= l($item['title'], $item['href'], $item['localized_options']);
            if (isset($item['description']) && !system_admin_compact_mode()) {
                $output .= "<div class='description'>{$item['description']}</div>";
            }
            $output .= '</li>';
        }
        $output .= '</ul>';
    }
    return $output;
}
开发者ID:netsensei,项目名称:netsensei,代码行数:37,代码来源:template.php

示例7: rootcandy_admin_block_content

function rootcandy_admin_block_content($content)
{
    if (!$content) {
        return '';
    }
    if (system_admin_compact_mode()) {
        drupal_add_js(drupal_get_path('theme', 'rootcandy') . '/compact-icon.js');
        drupal_add_css(drupal_get_path('theme', 'rootcandy') . '/compact-icon.css');
        $counter = 1;
        $output = '<ul class="admin-menu-compact">';
        foreach ($content as $item) {
            $additional_class = $counter % 4 == 0 ? ' last' : '';
            //Append class last to every 4th item signifying a new row
            $item['localized_options']['html'] = TRUE;
            if ($image = _rootcandy_menu_icon($item['href'])) {
                $link = l($image . '<br />' . $item['title'], $item['href'], $item['localized_options']);
            } else {
                $link = l(theme('image', drupal_get_path('theme', 'rootcandy') . '/icons/i32/misc/unknown.png') . '<br />' . $item['title'], $item['href'], $item['localized_options']);
            }
            $output .= '<li class="leaf' . $additional_class . '">' . $link . '</li>';
            $counter++;
        }
        $output .= '</ul>';
    } else {
        $output = '<dl class="admin-list">';
        foreach ($content as $item) {
            $output .= '<dt>' . l($item['title'], $item['href'], $item['localized_options']) . '</dt>';
            $output .= '<dd>' . $item['description'] . '</dd>';
        }
        $output .= '</dl>';
    }
    return $output;
}
开发者ID:hoannm,项目名称:d6e,代码行数:33,代码来源:template.php

示例8: rubik_admin_block_content

/**
 * Override of theme_admin_block_content().
 */
function rubik_admin_block_content($content, $get_runstate = FALSE)
{
    static $has_run = FALSE;
    if ($get_runstate) {
        return $has_run;
    }
    $has_run = TRUE;
    $output = '';
    if (!empty($content)) {
        foreach ($content as $k => $item) {
            $content[$k]['title'] = "<span class='icon'></span>" . filter_xss_admin($item['title']);
            $content[$k]['localized_options']['html'] = TRUE;
            if (!empty($content[$k]['localized_options']['attributes']['class'])) {
                $content[$k]['localized_options']['attributes']['class'] .= _rubik_icon_classes($item['href']);
            } else {
                $content[$k]['localized_options']['attributes']['class'] = _rubik_icon_classes($item['href']);
            }
        }
        $output = system_admin_compact_mode() ? '<ul class="admin-list admin-list-compact">' : '<ul class="admin-list">';
        foreach ($content as $item) {
            $output .= '<li class="leaf">';
            $output .= l($item['title'], $item['href'], $item['localized_options']);
            if (!system_admin_compact_mode()) {
                $output .= "<div class='description'>{$item['description']}</div>";
            }
            $output .= '</li>';
        }
        $output .= '</ul>';
    }
    return $output;
}
开发者ID:radimklaska,项目名称:Drupal.cz,代码行数:34,代码来源:template.php

示例9: adminimal_admin_block_content

/**
 * Implements theme_admin_block_content().
 * Adding classes to the administration blocks see issue #1869690.
 */
function adminimal_admin_block_content($variables)
{
    $content = $variables['content'];
    $output = '';
    if (!empty($content)) {
        $class = 'admin-list';
        if ($compact = system_admin_compact_mode()) {
            $class .= ' compact';
        }
        $output .= '<dl class="' . $class . '">';
        foreach ($content as $item) {
            if (!isset($item['path'])) {
                $item['path'] = '';
            }
            $output .= '<div class="admin-block-item ' . check_plain(str_replace("/", "-", $item['path'])) . '"><dt>' . l($item['title'], $item['href'], $item['localized_options']) . '</dt>';
            if (!$compact && isset($item['description'])) {
                $output .= '<dd class="description">' . filter_xss_admin($item['description']) . '</dd>';
            }
            $output .= '</div>';
        }
        $output .= '</dl>';
    }
    return $output;
}
开发者ID:riouxtherefore,项目名称:editr,代码行数:28,代码来源:template.php

示例10: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state)
 {
     $role_names = array();
     $role_permissions = array();
     $admin_roles = array();
     foreach ($this->getRoles() as $role_name => $role) {
         // Retrieve role names for columns.
         $role_names[$role_name] = $role->label();
         // Fetch permissions for the roles.
         $role_permissions[$role_name] = $role->getPermissions();
         $admin_roles[$role_name] = $role->isAdmin();
     }
     // Store $role_names for use when saving the data.
     $form['role_names'] = array('#type' => 'value', '#value' => $role_names);
     // Render role/permission overview:
     $options = array();
     $hide_descriptions = system_admin_compact_mode();
     $form['system_compact_link'] = array('#id' => FALSE, '#type' => 'system_compact_link');
     $form['permissions'] = array('#type' => 'table', '#header' => array($this->t('Permission')), '#id' => 'permissions', '#attributes' => ['class' => ['permissions', 'js-permissions']], '#sticky' => TRUE);
     foreach ($role_names as $name) {
         $form['permissions']['#header'][] = array('data' => $name, 'class' => array('checkbox'));
     }
     $permissions = $this->permissionHandler->getPermissions();
     $permissions_by_provider = array();
     foreach ($permissions as $permission_name => $permission) {
         $permissions_by_provider[$permission['provider']][$permission_name] = $permission;
     }
     foreach ($permissions_by_provider as $provider => $permissions) {
         // Module name.
         $form['permissions'][$provider] = array(array('#wrapper_attributes' => array('colspan' => count($role_names) + 1, 'class' => array('module'), 'id' => 'module-' . $provider), '#markup' => $this->moduleHandler->getName($provider)));
         foreach ($permissions as $perm => $perm_item) {
             // Fill in default values for the permission.
             $perm_item += array('description' => '', 'restrict access' => FALSE, 'warning' => !empty($perm_item['restrict access']) ? $this->t('Warning: Give to trusted roles only; this permission has security implications.') : '');
             $options[$perm] = $perm_item['title'];
             $form['permissions'][$perm]['description'] = array('#type' => 'inline_template', '#template' => '<div class="permission"><span class="title">{{ title }}</span>{% if description or warning %}<div class="description">{% if warning %}<em class="permission-warning">{{ warning }}</em> {% endif %}{{ description }}</div>{% endif %}</div>', '#context' => array('title' => $perm_item['title']));
             // Show the permission description.
             if (!$hide_descriptions) {
                 $form['permissions'][$perm]['description']['#context']['description'] = $perm_item['description'];
                 $form['permissions'][$perm]['description']['#context']['warning'] = $perm_item['warning'];
             }
             $options[$perm] = '';
             foreach ($role_names as $rid => $name) {
                 $form['permissions'][$perm][$rid] = array('#title' => $name . ': ' . $perm_item['title'], '#title_display' => 'invisible', '#wrapper_attributes' => array('class' => array('checkbox')), '#type' => 'checkbox', '#default_value' => in_array($perm, $role_permissions[$rid]) ? 1 : 0, '#attributes' => array('class' => array('rid-' . $rid, 'js-rid-' . $rid)), '#parents' => array($rid, $perm));
                 // Show a column of disabled but checked checkboxes.
                 if ($admin_roles[$rid]) {
                     $form['permissions'][$perm][$rid]['#disabled'] = TRUE;
                     $form['permissions'][$perm][$rid]['#default_value'] = TRUE;
                 }
             }
         }
     }
     $form['actions'] = array('#type' => 'actions');
     $form['actions']['submit'] = array('#type' => 'submit', '#value' => $this->t('Save permissions'), '#button_type' => 'primary');
     $form['#attached']['library'][] = 'user/drupal.user.permissions';
     return $form;
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:59,代码来源:UserPermissionsForm.php

示例11: marinelli_admin_block_content

function marinelli_admin_block_content($content)
{
    if (!$content) {
        return '';
    }
    if (system_admin_compact_mode()) {
        $output = '<dl class="menu">';
        foreach ($content as $item) {
            $output .= '<dt>' . l($item['title'], $item['href'], $item['localized_options']) . '</dt>';
            // use definition list per compact mode
        }
        $output .= '</dl>';
    } else {
        $output = '<dl class="admin-list">';
        foreach ($content as $item) {
            $output .= '<dt>' . l($item['title'], $item['href'], $item['localized_options']) . '</dt>';
            $output .= '<dd>' . $item['description'] . '</dd>';
        }
        $output .= '</dl>';
    }
    return $output;
}
开发者ID:BackupTheBerlios,项目名称:web-cpan-svn,代码行数:22,代码来源:template.php

示例12: badm_admin_block_content

/**
 * Overrides theme_admin_block_content().
 */
function badm_admin_block_content($variables)
{
    $content = $variables['content'];
    $output = '';
    if (!empty($content)) {
        $compact = system_admin_compact_mode();
        $output .= '<dl>';
        foreach ($content as $item) {
            $output .= '<dt>' . l($item['title'], $item['href'], $item['localized_options']) . '</dt>';
            if (!$compact && isset($item['description'])) {
                $output .= '<dd>' . filter_xss_admin($item['description']) . '</dd>';
            }
        }
        $output .= '</dl>';
    }
    return $output;
}
开发者ID:pounard,项目名称:drupal-badm,代码行数:20,代码来源:template.php


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