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


PHP list_themes函数代码示例

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


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

示例1: ginkgo_settings

/**
 * Implementation of hook_settings() for themes.
 */
function ginkgo_settings($settings)
{
    // Add js & css
    drupal_add_css('misc/farbtastic/farbtastic.css', 'module', 'all', FALSE);
    drupal_add_js('misc/farbtastic/farbtastic.js');
    drupal_add_css(drupal_get_path('theme', 'ginkgo') . '/settings.css');
    drupal_add_js(drupal_get_path('theme', 'ginkgo') . '/js/settings.js');
    $form = array();
    $form['settings'] = array('#type' => 'fieldset', '#tree' => FALSE, '#title' => t('Settings'));
    $form['settings']['emblem'] = array('#title' => t('Show site emblem'), '#type' => 'checkbox', '#default_value' => isset($settings['emblem']) ? $settings['emblem'] : 1);
    // Build color defaults
    $themes = list_themes();
    $theme_info = !empty($themes['ginkgo']->info) ? $themes['ginkgo']->info : array();
    $defaults = array();
    foreach (array('site', 'og', 'user') as $type) {
        // Retrieve default colors from info file
        if (isset($theme_info["spaces_design_{$type}"])) {
            $defaults[$type] = $theme_info["spaces_design_{$type}"];
        } else {
            $defaults[$type] = '#3399aa';
        }
    }
    $form['color'] = array('#type' => 'fieldset', '#tree' => FALSE, '#title' => t('Color'), '#value' => "<div class='description'>" . t('These color settings can be overridden by color customizations per space.') . "</div>");
    $form['color']['color_site'] = array('#title' => t('Default site color'), '#type' => 'textfield', '#size' => '7', '#maxlength' => '7', '#default_value' => !empty($settings['color_site']) ? $settings['color_site'] : $defaults['site'], '#suffix' => '<div class="colorpicker" id="edit-color-site-colorpicker"></div>', '#attributes' => array('class' => 'colorpicker'));
    $form['color']['color_og'] = array('#title' => t('Default group color'), '#type' => 'textfield', '#size' => '7', '#maxlength' => '7', '#default_value' => !empty($settings['color_og']) ? $settings['color_og'] : $defaults['og'], '#suffix' => '<div class="colorpicker" id="edit-color-og-colorpicker"></div>', '#attributes' => array('class' => 'colorpicker'));
    $form['color']['color_user'] = array('#title' => t('Default profile color'), '#type' => 'textfield', '#size' => '7', '#maxlength' => '7', '#default_value' => !empty($settings['color_user']) ? $settings['color_user'] : $defaults['user'], '#suffix' => '<div class="colorpicker" id="edit-color-user-colorpicker"></div>', '#attributes' => array('class' => 'colorpicker'));
    return $form;
}
开发者ID:kkaefer,项目名称:Atrium,代码行数:31,代码来源:theme-settings.php

示例2: rootcandy_settings

/**
 * Implementation of THEMEHOOK_settings() function.
 *
 * @param $saved_settings
 *   array An array of saved settings for this theme.
 * @return
 *   array A form array.
 */
function rootcandy_settings($saved_settings, $subtheme_defaults = array())
{
    // Get the default values from the .info file.
    $themes = list_themes();
    $defaults = $themes['rootcandy']->info['settings'];
    // Allow a subtheme to override the default values.
    $defaults = array_merge($defaults, $subtheme_defaults);
    // Merge the saved variables and their default values.
    $settings = array_merge($defaults, $saved_settings);
    // Create the form widgets using Forms API
    $form['header'] = array('#type' => 'fieldset', '#title' => t('Header'), '#weight' => 1, '#collapsible' => TRUE, '#collapsed' => TRUE);
    $form['header']['rootcandy_header_display'] = array('#type' => 'checkbox', '#title' => t('Disable header'), '#default_value' => $settings['rootcandy_header_display']);
    $form['dashboard'] = array('#type' => 'fieldset', '#title' => t('Dashboard'), '#weight' => 1, '#collapsible' => TRUE, '#collapsed' => TRUE);
    $form['dashboard']['rootcandy_dashboard_display'] = array('#type' => 'checkbox', '#title' => t('Disable dashboard'), '#default_value' => $settings['rootcandy_dashboard_display']);
    $form['dashboard']['rootcandy_dashboard_help'] = array('#type' => 'select', '#options' => array('left' => t('Left'), 'right' => t('Right'), 'content' => t('Content')), '#title' => t('Help box position'), '#default_value' => $settings['rootcandy_dashboard_help']);
    $form['dashboard']['rootcandy_dashboard_messages'] = array('#type' => 'select', '#options' => array('left' => t('Left'), 'right' => t('Right'), 'content' => t('Content')), '#title' => t('Messages box position'), '#default_value' => $settings['rootcandy_dashboard_messages']);
    $form['dashboard']['rootcandy_dashboard_content_display'] = array('#type' => 'checkbox', '#title' => t('Disable content on a dashboard'), '#default_value' => $settings['rootcandy_dashboard_content_display']);
    $form['navigation'] = array('#type' => 'fieldset', '#title' => t('Navigation'), '#weight' => 1, '#collapsible' => TRUE, '#collapsed' => TRUE);
    // Create the form widgets using Forms API
    $form['navigation']['rootcandy_navigation_icons'] = array('#type' => 'checkbox', '#title' => t('Disable icons for main navigation'), '#default_value' => $settings['rootcandy_navigation_icons']);
    $form['navigation']['rootcandy_navigation_icons_size'] = array('#type' => 'select', '#options' => array(16 => 16, 24 => 24, 32 => 32), '#title' => t('Set icons size for main navigation'), '#default_value' => $settings['rootcandy_navigation_icons_size']);
    $form['navigation']['nav-by-role'] = array('#type' => 'fieldset', '#title' => t('Menu source by role'), '#weight' => 1, '#collapsible' => TRUE, '#collapsed' => TRUE);
    $primary_options = array(NULL => t('None'), '_rootcandy_default_navigation' => t('default navigation'));
    $primary_options = array_merge($primary_options, menu_get_menus());
    $roles = user_roles(FALSE);
    foreach ($roles as $rid => $role) {
        $form['navigation']['nav-by-role']['rootcandy_navigation_source_' . $rid] = array('#type' => 'select', '#title' => t('@role navigation', array('@role' => $role)), '#default_value' => $settings['rootcandy_navigation_source_' . $rid], '#options' => $primary_options, '#tree' => FALSE, '#description' => t('Select what should be displayed as the navigation menu for role @role.', array('@role' => $role)));
    }
    $form['navigation']['custom-icons'] = array('#type' => 'fieldset', '#title' => t('Custom icons'), '#weight' => 1, '#collapsible' => TRUE, '#collapsed' => TRUE);
    $form['navigation']['custom-icons']['rootcandy_navigation_custom_icons'] = array('#type' => 'textarea', '#title' => t('Custom icons'), '#default_value' => $settings['rootcandy_navigation_custom_icons'], '#description' => t('Format: menu href|icon path (relative to drupal root) - one item per row. eg. admin/build|files/myicons/admin-build.png'), '#required' => FALSE);
    // Return the additional form widgets
    return $form;
}
开发者ID:ntulip,项目名称:tattler,代码行数:41,代码来源:theme-settings.php

示例3: form

 /**
  * {@inheritdoc}
  */
 public function form(array $form, array &$form_state)
 {
     $entity = $this->entity;
     // Store theme settings in $form_state for use below.
     if (!($theme = $entity->get('theme'))) {
         $theme = $this->config('system.theme')->get('default');
     }
     $form_state['block_theme'] = $theme;
     $form['#tree'] = TRUE;
     $form['settings'] = $entity->getPlugin()->buildConfigurationForm(array(), $form_state);
     // If creating a new block, calculate a safe default machine name.
     $form['id'] = array('#type' => 'machine_name', '#maxlength' => 64, '#description' => $this->t('A unique name for this block instance. Must be alpha-numeric and underscore separated.'), '#default_value' => !$entity->isNew() ? $entity->id() : $this->getUniqueMachineName($entity), '#machine_name' => array('exists' => '\\Drupal\\block\\Entity\\Block::load', 'replace_pattern' => '[^a-z0-9_.]+', 'source' => array('settings', 'label')), '#required' => TRUE, '#disabled' => !$entity->isNew());
     // Theme settings.
     if ($entity->get('theme')) {
         $form['theme'] = array('#type' => 'value', '#value' => $theme);
     } else {
         $theme_options = array();
         foreach (list_themes() as $theme_name => $theme_info) {
             if (!empty($theme_info->status)) {
                 $theme_options[$theme_name] = $theme_info->info['name'];
             }
         }
         $form['theme'] = array('#type' => 'select', '#options' => $theme_options, '#title' => t('Theme'), '#default_value' => $theme, '#ajax' => array('callback' => array($this, 'themeSwitch'), 'wrapper' => 'edit-block-region-wrapper'));
     }
     // Region settings.
     $form['region'] = array('#type' => 'select', '#title' => $this->t('Region'), '#description' => $this->t('Select the region where this block should be displayed.'), '#default_value' => $entity->get('region'), '#empty_value' => BlockInterface::BLOCK_REGION_NONE, '#options' => system_region_list($theme, REGIONS_VISIBLE), '#prefix' => '<div id="edit-block-region-wrapper">', '#suffix' => '</div>');
     $form['#attached']['css'] = array(drupal_get_path('module', 'block') . '/css/block.admin.css');
     return $form;
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:32,代码来源:BlockForm.php

示例4: path_to_subtheme

/**
 * Return the path to the sub-theme directory or FALSE if there is no sub-theme.
 *
 * This function also fixes sub-themes that are mistakenly seen by PHPTemplate
 * as separate from their base theme.
 */
function path_to_subtheme()
{
    $base_theme = 'zen';
    global $theme, $theme_key;
    static $theme_path;
    if (!isset($theme_path)) {
        if ($theme_key == $base_theme) {
            // This is not a sub-theme.
            $theme_path = FALSE;
        } else {
            // Extract current files from database.
            $themes = list_themes();
            // Sub-themes with their own page.tpl.php files are seen by PHPTemplate as
            // their own theme (seperate from Zen). So we need to re-connect those
            // sub-themes with the base Zen theme.
            if ($theme == $theme_key) {
                // Update database
                $parent_path = $themes[$base_theme]->filename;
                $subtheme_path = str_replace('page.tpl.php', 'style.css', $themes[$theme]->filename);
                db_query("UPDATE {system} SET description='%s', filename='%s' WHERE name='%s' AND type='theme'", $parent_path, $subtheme_path, $theme);
                // Refresh Drupal internals.
                $theme = $base_theme;
                $themes = list_themes(TRUE);
            }
            $theme_path = dirname($themes[$theme_key]->filename);
        }
    }
    return $theme_path;
}
开发者ID:nabuur,项目名称:nabuur-d5,代码行数:35,代码来源:template-subtheme.php

示例5: STARTERKIT_settings

/**
 * Implementation of THEMEHOOK_settings() function.
 *
 * @param $saved_settings
 *   An array of saved settings for this theme.
 * @return
 *   A form array.
 */
function STARTERKIT_settings($saved_settings)
{
    // Get the default values from the .info file.
    $themes = list_themes();
    $defaults = $themes['STARTERKIT']->info['settings'];
    // Merge the saved variables and their default values.
    $settings = array_merge($defaults, $saved_settings);
    /*
     * Create the form using Forms API: http://api.drupal.org/api/6
     */
    $form = array();
    /* -- Delete this line if you want to use this setting
      $form['subtheme_example'] = array(
        '#type'          => 'checkbox',
        '#title'         => t('Use this sample setting'),
        '#default_value' => $settings['subtheme_example'],
        '#description'   => t("This option doesn't do anything; it's just an example."),
      );
      // */
    // Add the base theme's settings.
    include_once './' . drupal_get_path('theme', 'zen') . '/theme-settings.php';
    $form += zen_settings($saved_settings, $defaults);
    // Remove some of the base theme's settings.
    unset($form['themedev']['zen_layout']);
    // We don't need to select the base stylesheet.
    // Return the form
    return $form;
}
开发者ID:patdunlavey,项目名称:Williamstown-Beat,代码行数:36,代码来源:theme-settings.php

示例6: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state)
 {
     $form = parent::buildForm($form, $form_state);
     $config = $this->config('views.settings');
     $options = array();
     foreach (list_themes() as $name => $theme) {
         if ($theme->status) {
             $options[$name] = $theme->info['name'];
         }
     }
     // This is not currently a fieldset but we may want it to be later,
     // so this will make it easier to change if we do.
     $form['basic'] = array();
     $form['basic']['ui_show_master_display'] = array('#type' => 'checkbox', '#title' => $this->t('Always show the master (default) display'), '#default_value' => $config->get('ui.show.master_display'));
     $form['basic']['ui_show_advanced_column'] = array('#type' => 'checkbox', '#title' => $this->t('Always show advanced display settings'), '#default_value' => $config->get('ui.show.advanced_column'));
     $form['basic']['ui_show_display_embed'] = array('#type' => 'checkbox', '#title' => t('Allow embedded displays'), '#description' => t('Embedded displays can be used in code via views_embed_view().'), '#default_value' => $config->get('ui.show.display_embed'));
     $form['basic']['ui_exposed_filter_any_label'] = array('#type' => 'select', '#title' => $this->t('Label for "Any" value on non-required single-select exposed filters'), '#options' => array('old_any' => '<Any>', 'new_any' => $this->t('- Any -')), '#default_value' => $config->get('ui.exposed_filter_any_label'));
     $form['live_preview'] = array('#type' => 'details', '#title' => $this->t('Live preview settings'), '#open' => TRUE);
     $form['live_preview']['ui_always_live_preview'] = array('#type' => 'checkbox', '#title' => $this->t('Automatically update preview on changes'), '#default_value' => $config->get('ui.always_live_preview'));
     $form['live_preview']['ui_show_preview_information'] = array('#type' => 'checkbox', '#title' => $this->t('Show information and statistics about the view during live preview'), '#default_value' => $config->get('ui.show.preview_information'));
     $form['live_preview']['options'] = array('#type' => 'container', '#states' => array('visible' => array(':input[name="ui_show_preview_information"]' => array('checked' => TRUE))));
     $form['live_preview']['options']['ui_show_sql_query_where'] = array('#type' => 'radios', '#title' => t('Show SQL query'), '#options' => array('above' => $this->t('Above the preview'), 'below' => $this->t('Below the preview')), '#default_value' => $config->get('ui.show.sql_query.where'));
     $form['live_preview']['options']['ui_show_sql_query_enabled'] = array('#type' => 'checkbox', '#title' => $this->t('Show the SQL query'), '#default_value' => $config->get('ui.show.sql_query.enabled'));
     $form['live_preview']['options']['ui_show_performance_statistics'] = array('#type' => 'checkbox', '#title' => $this->t('Show performance statistics'), '#default_value' => $config->get('ui.show.performance_statistics'));
     $form['live_preview']['options']['ui_show_additional_queries'] = array('#type' => 'checkbox', '#title' => $this->t('Show other queries run during render during live preview'), '#description' => $this->t("Drupal has the potential to run many queries while a view is being rendered. Checking this box will display every query run during view render as part of the live preview."), '#default_value' => $config->get('ui.show.additional_queries'));
     return $form;
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:30,代码来源:BasicSettingsForm.php

示例7: gavias_laikafood_get_predefined_param

function gavias_laikafood_get_predefined_param($param, $pre_array = array(), $suf_array = array())
{
    global $theme_key;
    $theme_data = list_themes();
    $result = isset($theme_data[$theme_key]->info[$param]) ? $theme_data[$theme_key]->info[$param] : array();
    return $pre_array + $result + $suf_array;
}
开发者ID:ucaka,项目名称:forestway,代码行数:7,代码来源:functions.php

示例8: zen_settings

/**
 * Implementation of THEMEHOOK_settings() function.
 *
 * @param $saved_settings
 *   An array of saved settings for this theme.
 * @param $subtheme_defaults
 *   Allow a subtheme to override the default values.
 * @return
 *   A form array.
 */
function zen_settings($saved_settings, $subtheme_defaults = array())
{
    // Add the form's CSS
    drupal_add_css(drupal_get_path('theme', 'zen') . '/theme-settings.css', 'theme');
    // Add javascript to show/hide optional settings
    drupal_add_js(drupal_get_path('theme', 'zen') . '/theme-settings.js', 'theme');
    // Get the default values from the .info file.
    $themes = list_themes();
    $defaults = $themes['zen']->info['settings'];
    // Allow a subtheme to override the default values.
    $defaults = array_merge($defaults, $subtheme_defaults);
    // Merge the saved variables and their default values.
    $settings = array_merge($defaults, $saved_settings);
    /*
     * Create the form using Forms API
     */
    $form['zen-div-opening'] = array('#value' => '<div id="zen-settings">');
    $form['zen_block_editing'] = array('#type' => 'checkbox', '#title' => t('Show block editing on hover'), '#description' => t('When hovering over a block, privileged users will see block editing links.'), '#default_value' => $settings['zen_block_editing']);
    $form['breadcrumb'] = array('#type' => 'fieldset', '#title' => t('Breadcrumb settings'), '#attributes' => array('id' => 'zen-breadcrumb'));
    $form['breadcrumb']['zen_breadcrumb'] = array('#type' => 'select', '#title' => t('Display breadcrumb'), '#default_value' => $settings['zen_breadcrumb'], '#options' => array('yes' => t('Yes'), 'admin' => t('Only in admin section'), 'no' => t('No')));
    $form['breadcrumb']['zen_breadcrumb_separator'] = array('#type' => 'textfield', '#title' => t('Breadcrumb separator'), '#description' => t('Text only. Don’t forget to include spaces.'), '#default_value' => $settings['zen_breadcrumb_separator'], '#size' => 5, '#maxlength' => 10, '#prefix' => '<div id="div-zen-breadcrumb-collapse">');
    $form['breadcrumb']['zen_breadcrumb_home'] = array('#type' => 'checkbox', '#title' => t('Show home page link in breadcrumb'), '#default_value' => $settings['zen_breadcrumb_home']);
    $form['breadcrumb']['zen_breadcrumb_trailing'] = array('#type' => 'checkbox', '#title' => t('Append a separator to the end of the breadcrumb'), '#default_value' => $settings['zen_breadcrumb_trailing'], '#description' => t('Useful when the breadcrumb is placed just before the title.'));
    $form['breadcrumb']['zen_breadcrumb_title'] = array('#type' => 'checkbox', '#title' => t('Append the content title to the end of the breadcrumb'), '#default_value' => $settings['zen_breadcrumb_title'], '#description' => t('Useful when the breadcrumb is not placed just before the title.'), '#suffix' => '</div>');
    $form['themedev'] = array('#type' => 'fieldset', '#title' => t('Theme development settings'), '#attributes' => array('id' => 'zen-themedev'));
    // drupal_rebuild_theme_registry()
    $form['themedev']['zen_layout'] = array('#type' => 'radios', '#title' => t('Layout method'), '#options' => array('border-politics-liquid' => t('Liquid layout') . ' <small>(layout-liquid.css)</small>', 'border-politics-fixed' => t('Fixed layout') . ' <small>(layout-fixed.css)</small>'), '#default_value' => $settings['zen_layout']);
    $form['themedev']['zen_wireframes'] = array('#type' => 'checkbox', '#title' => t('Display borders around main layout elements'), '#default_value' => $settings['zen_wireframes'], '#description' => l(t('Wireframes'), 'http://www.boxesandarrows.com/view/html_wireframes_and_prototypes_all_gain_and_no_pain') . t(' are useful when prototyping a website.'), '#prefix' => '<div id="div-zen-wireframes"><strong>' . t('Wireframes:') . '</strong>', '#suffix' => '</div>');
    $form['zen-div-closing'] = array('#value' => '</div>');
    // Return the form
    return $form;
}
开发者ID:patdunlavey,项目名称:Williamstown-Beat,代码行数:42,代码来源:theme-settings.php

示例9: testCustomBlock

 /**
  * Test creating custom block, moving it to a specific region and then
  * deleting it.
  */
 function testCustomBlock()
 {
     // Confirm that the add block link appears on block overview pages.
     $this->drupalGet('admin/structure/block');
     $this->assertRaw(l(t('Add block'), 'admin/structure/block/add'), t('Add block link is present on block overview page for default theme.'));
     $this->drupalGet('admin/structure/block/list/seven');
     $this->assertRaw(l(t('Add block'), 'admin/structure/block/list/seven/add'), t('Add block link is present on block overview page for non-default theme.'));
     // Confirm that hidden regions are not shown as options for block placement
     // when adding a new block.
     theme_enable(array('stark'));
     $themes = list_themes();
     $this->drupalGet('admin/structure/block/add');
     foreach ($themes as $key => $theme) {
         if ($theme->status) {
             foreach ($theme->info['regions_hidden'] as $hidden_region) {
                 $elements = $this->xpath('//select[@id=:id]//option[@value=:value]', array(':id' => 'edit-regions-' . $key, ':value' => $hidden_region));
                 $this->assertFalse(isset($elements[0]), t('The hidden region @region is not available for @theme.', array('@region' => $hidden_region, '@theme' => $key)));
             }
         }
     }
     // Add a new custom block by filling out the input form on the
     // admin/structure/block/add page.
     $custom_block = array();
     $custom_block['info'] = $this->randomName(8);
     $custom_block['title'] = $this->randomName(8);
     $custom_block['body[value]'] = $this->randomName(32);
     $this->drupalPost('admin/structure/block/add', $custom_block, t('Save block'));
     // Confirm that the custom block has been created, and then query the
     // created bid.
     $this->assertText(t('The block has been created.'), t('Custom block successfully created.'));
     $bid = db_query("SELECT bid FROM {block_custom} WHERE info = :info", array(':info' => $custom_block['info']))->fetchField();
     // Check to see if the custom block was created by checking that it's in
     // the database..
     $this->assertNotNull($bid, t('Custom block found in database'));
     // Check if the block can be moved to all available regions.
     $custom_block['module'] = 'block';
     $custom_block['delta'] = $bid;
     foreach ($this->regions as $region) {
         $this->moveBlockToRegion($custom_block, $region);
     }
     // Verify presence of configure and delete links for custom block.
     $this->drupalGet('admin/structure/block');
     $this->assertRaw(l(t('configure'), 'admin/structure/block/manage/block/' . $bid . '/configure'), t('Custom block configure link found.'));
     $this->assertRaw(l(t('delete'), 'admin/structure/block/manage/block/' . $bid . '/delete'), t('Custom block delete link found.'));
     // Set visibility only for authenticated users, to verify delete
     // functionality.
     $edit = array();
     $edit['roles[2]'] = TRUE;
     $this->drupalPost('admin/structure/block/manage/block/' . $bid . '/configure', $edit, t('Save block'));
     // Delete the created custom block & verify that it's been deleted and no
     // longer appearing on the page.
     $this->clickLink(t('delete'));
     $this->drupalPost('admin/structure/block/manage/block/' . $bid . '/delete', array(), t('Delete'));
     $this->assertRaw(t('The block %title has been removed.', array('%title' => $custom_block['info'])), t('Custom block successfully deleted.'));
     $this->assertNoText(t($custom_block['title']), t('Custom block no longer appears on page.'));
     $count = db_query("SELECT 1 FROM {block_role} WHERE module = :module AND delta = :delta", array(':module' => $custom_block['module'], ':delta' => $custom_block['delta']))->fetchField();
     $this->assertFalse($count, t('Table block_role being cleaned.'));
 }
开发者ID:pjcdawkins,项目名称:drupal7mongodb,代码行数:62,代码来源:BlockTest.php

示例10: az_branded_form_system_theme_settings_alter

function az_branded_form_system_theme_settings_alter(&$form, &$form_state)
{
    unset($form['#submit']);
    $form['#submit'][] = 'az_branded_settings_form_submit';
    $themes = list_themes();
    $active_theme = $GLOBALS['theme_key'];
    $form_state['build_info']['files'][] = str_replace("/{$active_theme}.info", '', $themes[$active_theme]->filename) . '/theme-settings.php';
    return $form;
}
开发者ID:ehazell,项目名称:AWBA,代码行数:9,代码来源:theme-settings.php

示例11: setAdminTheme

 /**
  * Set admin theme given its machine name.
  *
  * @param string $name
  *    Theme machine name.
  *
  * @return bool
  *    TRUE if theme is found and enabled, FALSE otherwise.
  */
 public function setAdminTheme($name)
 {
     $themes = list_themes(TRUE);
     if (isset($themes[$name])) {
         theme_enable(array($name));
         variable_set('admin_theme', $name);
         return TRUE;
     } else {
         return FALSE;
     }
 }
开发者ID:janoka,项目名称:platform-dev,代码行数:20,代码来源:Config.php

示例12: addForm

 /**
  * Presents the custom block creation form.
  *
  * @param \Drupal\block_content\BlockContentTypeInterface $block_content_type
  *   The custom block type to add.
  * @param \Symfony\Component\HttpFoundation\Request $request
  *   The current request object.
  *
  * @return array
  *   A form array as expected by drupal_render().
  */
 public function addForm(BlockContentTypeInterface $block_content_type, Request $request)
 {
     $block = $this->blockContentStorage->create(array('type' => $block_content_type->id()));
     if (($theme = $request->query->get('theme')) && in_array($theme, array_keys(list_themes()))) {
         // We have navigated to this page from the block library and will keep track
         // of the theme for redirecting the user to the configuration page for the
         // newly created block in the given theme.
         $block->setTheme($theme);
     }
     return $this->entityFormBuilder()->getForm($block);
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:22,代码来源:BlockContentController.php

示例13: kurr_form_system_theme_settings_alter

function kurr_form_system_theme_settings_alter(&$form, &$form_state)
{
    // Cocoon Options
    $form['cocoon_options'] = array('#type' => 'vertical_tabs', '#title' => t('Cocoon Theme Options'), '#weight' => 0, '#collapsible' => TRUE, '#collapsed' => FALSE);
    // Cocoon Theme Skin Panel
    $form['cocoon_options']['cocoon_skin'] = array('#type' => 'fieldset', '#title' => t('Cocoon Theme Skin'), '#collapsible' => TRUE, '#collapsed' => FALSE);
    // Cocoon Theme Skin Panel: Select Skin
    $form['cocoon_options']['cocoon_skin']['skin'] = array('#type' => 'select', '#title' => t('Select Skin'), '#description' => t('Choose a default skin color for the theme.'), '#options' => array('brown' => t('Brown'), 'green' => t('Green'), 'orange' => t('Orange'), 'red' => t('Red'), 'turquoise' => t('Turquoise'), 'violet' => t('Violet')), '#default_value' => theme_get_setting('skin'));
    // Cocoon Theme Skin Panel: Color
    $form['cocoon_options']['cocoon_skin']['color'] = array('#type' => 'select', '#title' => t('Base Color'), '#description' => t('Choose a base color for the theme.'), '#options' => array('light' => t('Light'), 'dark' => t('Dark')), '#default_value' => theme_get_setting('color'));
    // Cocoon Theme Skin Panel: Menu Position
    $form['cocoon_options']['cocoon_skin']['menu_position'] = array('#type' => 'select', '#title' => t('Menu Position'), '#description' => t('Choose a position for the menu.'), '#options' => array('left' => t('Left'), 'right' => t('Right')), '#default_value' => theme_get_setting('menu_position'));
    // Cocoon Theme Skin Panel: Custom CSS
    $form['cocoon_options']['cocoon_skin']['custom_css'] = array('#type' => 'textarea', '#title' => t('Custom CSS'), '#description' => t('Specify custom CSS tags and styling to apply to the theme. You can also override default styles here.'), '#rows' => '5', '#default_value' => theme_get_setting('custom_css'));
    // Cocoon Theme Features Panel
    $form['cocoon_options']['cocoon_features'] = array('#type' => 'fieldset', '#title' => t('Cocoon Theme Features'), '#collapsible' => TRUE, '#collapsed' => FALSE);
    // Cocoon Theme Features Panel: Header title
    $form['cocoon_options']['cocoon_features']['header_title'] = array('#type' => 'textfield', '#title' => t('Header Title'), '#default_value' => theme_get_setting('header_title'), '#description' => t("Title in the header."));
    // Cocoon Theme Features Panel: Header subtitle
    $form['cocoon_options']['cocoon_features']['header_subtitle'] = array('#type' => 'textfield', '#title' => t('Header Subtitle'), '#default_value' => theme_get_setting('header_subtitle'), '#description' => t("Subtitle in the header."));
    // Cocoon Theme Features Panel: Copyright
    $form['cocoon_options']['cocoon_features']['copyright'] = array('#type' => 'textfield', '#title' => t('Footer Copyright Message'), '#default_value' => theme_get_setting('copyright'), '#description' => t("The copyright/disclaimer text in the footer."));
    // Cocoon Theme Features Panel: Menu info line 1
    $form['cocoon_options']['cocoon_features']['menu_line_1'] = array('#type' => 'textfield', '#title' => t('Menu Info Line 1'), '#default_value' => theme_get_setting('menu_line_1'), '#description' => t("First line of menu info. You may include HTML."));
    // Cocoon Theme Features Panel: Menu info line 2
    $form['cocoon_options']['cocoon_features']['menu_line_2'] = array('#type' => 'textfield', '#title' => t('Menu Info Line 2'), '#default_value' => theme_get_setting('menu_line_2'), '#description' => t("Second line of menu info. You may include HTML."));
    // Cocoon Theme Features Panel: Menu info line 3
    $form['cocoon_options']['cocoon_features']['menu_line_3'] = array('#type' => 'textfield', '#title' => t('Menu Info Line 3'), '#default_value' => theme_get_setting('menu_line_3'), '#description' => t("Third line of menu info. You may include HTML."));
    // Cocoon Theme Features Panel: Preloader
    $form['cocoon_options']['cocoon_features']['preloader'] = array('#type' => 'select', '#title' => t('Homepage Preloader'), '#description' => t('Display loading screen while page loads?'), '#options' => array(0 => t('No'), 1 => t('Yes')), '#default_value' => theme_get_setting('preloader'));
    // Cocoon Theme Features Panel: Testimonials BG
    $form['cocoon_options']['cocoon_features']['testimonials_bg'] = array('#type' => 'managed_file', '#title' => t('Testimonials Background Image'), '#description' => t('Upload a background image for the testimonials section.'), '#required' => FALSE, '#upload_location' => 'public://kurr/backgrounds', '#default_value' => theme_get_setting('testimonials_bg'), '#upload_validators' => array('file_validate_extensions' => array('gif png jpg jpeg')));
    // Cocoon Theme Features Panel: Quote BG
    $form['cocoon_options']['cocoon_features']['quote_bg'] = array('#type' => 'managed_file', '#title' => t('Quote Background Image'), '#description' => t('Upload a background image for the quote section.'), '#required' => FALSE, '#upload_location' => 'public://kurr/backgrounds', '#default_value' => theme_get_setting('quote_bg'), '#upload_validators' => array('file_validate_extensions' => array('gif png jpg jpeg')));
    // Cocoon Theme Features Panel: Social BG
    $form['cocoon_options']['cocoon_features']['social_bg'] = array('#type' => 'managed_file', '#title' => t('Social Links Background Image'), '#description' => t('Upload a background image for the social links section.'), '#required' => FALSE, '#upload_location' => 'public://kurr/backgrounds', '#default_value' => theme_get_setting('social_bg'), '#upload_validators' => array('file_validate_extensions' => array('gif png jpg jpeg')));
    $form['cocoon_branding'] = array('#prefix' => '<div class="cocoon-branding">', '#markup' => '<span>Created by Cocoon</span>', '#suffix' => '</div>', '#weight' => -100);
    $path_to_theme = drupal_get_path('theme', 'kurr');
    $form['#attached'] = array('css' => array($path_to_theme . '/css/cocoon-theme-settings.css'));
    $form['cocoon_options']['drupal_settings'] = array('#type' => 'fieldset', '#title' => t('Drupal Core Settings'));
    $form['cocoon_options']['drupal_settings']['theme_settings'] = $form['theme_settings'];
    $form['cocoon_options']['drupal_settings']['logo_settings']['logo'] = $form['logo'];
    $form['cocoon_options']['drupal_settings']['favicon'] = $form['favicon'];
    unset($form['theme_settings']);
    unset($form['logo']);
    unset($form['favicon']);
    $form['#submit'][] = 'kurr_settings_form_submit';
    // Get all themes.
    $themes = list_themes();
    // Get the current theme
    $active_theme = $GLOBALS['theme_key'];
    $form_state['build_info']['files'][] = str_replace("/{$active_theme}.info", '', $themes[$active_theme]->filename) . '/theme-settings.php';
}
开发者ID:hpcalaf,项目名称:henrypleas3,代码行数:53,代码来源:theme-settings.php

示例14: getList

 public function getList()
 {
     $themes = $this->getThemes();
     $themes_list = list_themes();
     $results = array();
     if (!empty($themes) and !empty($themes_list)) {
         foreach ($themes_list as $theme) {
             $db_theme = (isset($themes[$theme['basename']]) and !empty($themes[$theme['basename']])) ? $themes[$theme['basename']] : array();
             $extension_id = !empty($db_theme['extension_id']) ? $db_theme['extension_id'] : 0;
             $theme_name = !empty($db_theme['name']) ? $db_theme['name'] : $theme['basename'];
             $results[$theme['basename']] = array('extension_id' => $extension_id, 'name' => $theme_name, 'title' => isset($theme['config']['title']) ? $theme['config']['title'] : $theme_name, 'version' => isset($theme['config']['version']) ? $theme['config']['version'] : '', 'description' => isset($theme['config']['description']) ? $theme['config']['description'] : '', 'location' => $theme['location'], 'screenshot' => root_url($theme['path'] . '/screenshot.png'), 'path' => $theme['path'], 'is_writable' => is_writable($theme['path']), 'config' => $theme['config'], 'data' => !empty($db_theme['data']) ? $db_theme['data'] : array(), 'customize' => (isset($theme['config']['customize']) and !empty($theme['config']['customize'])) ? TRUE : FALSE);
         }
     }
     return $results;
 }
开发者ID:ududsha,项目名称:TastyIgniter,代码行数:15,代码来源:Themes_model.php

示例15: parse

 /**
  * {@inheritdoc}
  */
 public function parse($name)
 {
     if ($name instanceof TemplateReferenceInterface) {
         return $name;
     } else {
         if (isset($this->cache[$name])) {
             return $this->cache[$name];
         }
     }
     // normalize name
     $name = str_replace(':/', ':', preg_replace('#/{2,}#', '/', str_replace('\\', '/', $name)));
     $matches = [];
     // Little bit of explaination for this nice regex, first of, we cannot
     // check for "starting by" (^ operator) because Drupal theme() function
     // will prepend our identifiers by the file path, we must just drop it
     // silently if it's there. Then, we must absolutely ensure the template
     // name ends up with '.html.twig'. Finally, type:name:path are all
     // mandatory items else we cannot find the template real path.
     if (!preg_match('@([^/]+)\\:([\\w_\\-]+)\\:([^\\:]+)\\.([^\\.]+)\\.([^\\.]+)$@', $name, $matches)) {
         return $this->fallback($name);
     }
     $realname = $matches[0];
     try {
         // Problem is that our convention matches the same as symfony,
         // so we do need to ensure module or theme exists, if not then
         // fallback
         if ('module' === $matches[1]) {
             if (!module_exists($matches[2])) {
                 throw new \InvalidArgumentException();
             }
         } else {
             if ('theme' === $matches[1]) {
                 $themes = list_themes();
                 if (!isset($themes[$matches[2]])) {
                     throw new \InvalidArgumentException();
                 }
             } else {
                 throw new \InvalidArgumentException();
             }
         }
         $template = new DrupalTemplateReference($matches[1], $matches[2], $matches[3], $matches[4], $matches[5]);
         return $this->cache[$realname] = $template;
     } catch (\Exception $e) {
         return $this->fallback($name);
     }
 }
开发者ID:makinacorpus,项目名称:drupal-sf-dic,代码行数:49,代码来源:DrupalTemplateNameParser.php


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