Example #1
0
/**
 * 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];
    }
}
Example #2
0
/**
 * 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']];
    }
}
Example #3
0
/**
 * 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;
                }
            }
        }
    }
}
 /**
  * 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)));
     }
 }
Example #5
0
/**
 * 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];
    }
}
Example #6
0
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();
        }
    }
}
 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);
 }
Example #8
0
/**
 * 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;
        }
    }
}
 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);
 }
Example #10
0
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;
}
Example #11
0
 /**
  * {@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;
 }
Example #12
0
/**
 * 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();
        }
    }
}
Example #13
0
/**
 * 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')));
        }
    }
}
Example #14
0
 /**
  * {@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] : ''];
     }
 }
Example #15
0
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')); //
}
Example #16
0
/**
 * 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']];
    }
}
Example #17
0
/**
 * 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;
}
Example #18
0
 /**
  * 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));
     }
 }
 /**
  * Wraps system_region_list().
  */
 protected function systemRegionList($theme, $show = REGIONS_ALL)
 {
     return system_region_list($theme, $show);
 }
/**
 * 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;
            }
        }
    }
}
 /**
  * Returns the human-readable list of regions keyed by machine name.
  *
  * @return array
  *   An array of human-readable region names keyed by machine name.
  */
 protected function getRegionNames()
 {
     return system_region_list($this->getTheme());
 }
/**
 * Implements hook_form_system_theme_settings_alter().
 */
function color_glass_form_system_theme_settings_alter(&$form, $form_state)
{
    // Get the theme name.
    $theme = !empty($form_state['build_info']['args'][0]) ? $form_state['build_info']['args'][0] : FALSE;
    $jquery_message = t('jQuery Update is not enabled, Bootstrap requires a minimum jQuery version of 1.9 or higher. Please enable the <a href="!jquery_update_project_url">jQuery Update</a> module @jquery_update_version or higher. If you are seeing this, then you must <a href="!jquery_update_configure">manually configuration</a> this setting or optionally <a href="!bootstrap_suppress_jquery_error">suppress this message</a> instead.', array('@jquery_update_version' => '7.x-2.5', '!jquery_update_project_url' => 'https://www.drupal.org/project/jquery_update', '!jquery_update_configure' => url('admin/config/development/jquery_update'), '!bootstrap_suppress_jquery_error' => url('admin/appearance/settings/' . $theme, array('fragment' => 'edit-bootstrap-toggle-jquery-error'))));
    // Display a warning if jquery_update isn't enabled.
    if ((!module_exists('jquery_update') || !version_compare(variable_get('jquery_update_jquery_version', '1.10'), '1.9', '>=')) && !_bootstrap_setting('toggle_jquery_error', $theme)) {
        drupal_set_message(filter_xss($jquery_message), 'error', FALSE);
    }
    // Create vertical tabs for all Bootstrap related settings.
    $form['bootstrap'] = array('#type' => 'vertical_tabs', '#attached' => array('js' => array(drupal_get_path('theme', 'bootstrap') . '/js/bootstrap.admin.js')), '#prefix' => '<h2><small>' . t('Bootstrap Settings') . '</small></h2>', '#weight' => -10);
    // General.
    $form['general'] = array('#type' => 'fieldset', '#title' => t('General'), '#group' => 'bootstrap');
    // Container.
    $form['general']['container'] = array('#type' => 'fieldset', '#title' => t('Container'), '#collapsible' => TRUE, '#collapsed' => TRUE);
    $form['general']['container']['bootstrap_fluid_container'] = array('#type' => 'checkbox', '#title' => t('Fluid container'), '#default_value' => _bootstrap_setting('fluid_container', $theme), '#description' => t('Use <code>.container-fluid</code> class. See <a href="http://getbootstrap.com/css/#grid-example-fluid">Fluid container</a>'));
    // Buttons.
    $form['general']['buttons'] = array('#type' => 'fieldset', '#title' => t('Buttons'), '#collapsible' => TRUE, '#collapsed' => TRUE);
    $form['general']['buttons']['bootstrap_button_size'] = array('#type' => 'select', '#title' => t('Default button size'), '#default_value' => _bootstrap_setting('button_size', $theme), '#empty_option' => t('Normal'), '#options' => array('btn-xs' => t('Extra Small'), 'btn-sm' => t('Small'), 'btn-lg' => t('Large')));
    $form['general']['buttons']['bootstrap_button_colorize'] = array('#type' => 'checkbox', '#title' => t('Colorize Buttons'), '#default_value' => _bootstrap_setting('button_colorize', $theme), '#description' => t('Adds classes to buttons based on their text value. See: <a href="!bootstrap_url" target="_blank">Buttons</a> and <a href="!api_url" target="_blank">hook_bootstrap_colorize_text_alter()</a>', array('!bootstrap_url' => 'http://getbootstrap.com/css/#buttons', '!api_url' => 'http://drupalcode.org/project/bootstrap.git/blob/refs/heads/7.x-3.x:/bootstrap.api.php#l13')));
    $form['general']['buttons']['bootstrap_button_iconize'] = array('#type' => 'checkbox', '#title' => t('Iconize Buttons'), '#default_value' => _bootstrap_setting('button_iconize', $theme), '#description' => t('Adds icons to buttons based on the text value. See: <a href="!api_url" target="_blank">hook_bootstrap_iconize_text_alter()</a>', array('!api_url' => 'http://drupalcode.org/project/bootstrap.git/blob/refs/heads/7.x-3.x:/bootstrap.api.php#l37')));
    // Forms.
    $form['general']['forms'] = array('#type' => 'fieldset', '#title' => t('Forms'), '#collapsible' => TRUE, '#collapsed' => TRUE);
    $form['general']['forms']['bootstrap_forms_required_has_error'] = array('#type' => 'checkbox', '#title' => t('Make required elements display as an error'), '#default_value' => _bootstrap_setting('forms_required_has_error', $theme), '#description' => t('If an element in a form is required, enabling this will always display the element with a <code>.has-error</code> class. This turns the element red and helps in usability for determining which form elements are required to submit the form.  This feature compliments the "JavaScript > Forms > Automatically remove error classes when values have been entered" feature.'));
    $form['general']['forms']['bootstrap_forms_smart_descriptions'] = array('#type' => 'checkbox', '#title' => t('Smart form descriptions (via Tooltips)'), '#description' => t('Convert descriptions into tooltips (must be enabled) automatically based on certain criteria. This helps reduce the, sometimes unnecessary, amount of noise on a page full of form elements.'), '#default_value' => _bootstrap_setting('forms_smart_descriptions', $theme));
    $form['general']['forms']['bootstrap_forms_smart_descriptions_limit'] = array('#type' => 'textfield', '#title' => t('"Smart form descriptions" maximum character limit'), '#description' => t('Prevents descriptions from becoming tooltips by checking the character length of the description (HTML is not counted towards this limit). To disable this filtering criteria, leave an empty value.'), '#default_value' => _bootstrap_setting('forms_smart_descriptions_limit', $theme), '#states' => array('visible' => array(':input[name="bootstrap_forms_smart_descriptions"]' => array('checked' => TRUE))));
    $form['general']['forms']['bootstrap_forms_smart_descriptions_allowed_tags'] = array('#type' => 'textfield', '#title' => t('"Smart form descriptions" allowed (HTML) tags'), '#description' => t('Prevents descriptions from becoming tooltips by checking for HTML not in the list above (i.e. links). Separate by commas. To disable this filtering criteria, leave an empty value.'), '#default_value' => _bootstrap_setting('forms_smart_descriptions_allowed_tags', $theme), '#states' => array('visible' => array(':input[name="bootstrap_forms_smart_descriptions"]' => array('checked' => TRUE))));
    // Images.
    $form['general']['images'] = array('#type' => 'fieldset', '#title' => t('Images'), '#collapsible' => TRUE, '#collapsed' => TRUE);
    $form['general']['images']['bootstrap_image_shape'] = array('#type' => 'select', '#title' => t('Default image shape'), '#description' => t('Add classes to an <code>&lt;img&gt;</code> element to easily style images in any project. Note: Internet Explorer 8 lacks support for rounded corners. See: <a href="!bootstrap_url" target="_blank">Image Shapes</a>', array('!bootstrap_url' => 'http://getbootstrap.com/css/#images-shapes')), '#default_value' => _bootstrap_setting('image_shape', $theme), '#empty_option' => t('None'), '#options' => array('img-rounded' => t('Rounded'), 'img-circle' => t('Circle'), 'img-thumbnail' => t('Thumbnail')));
    $form['general']['images']['bootstrap_image_responsive'] = array('#type' => 'checkbox', '#title' => t('Responsive Images'), '#default_value' => _bootstrap_setting('image_responsive', $theme), '#description' => t('Images in Bootstrap 3 can be made responsive-friendly via the addition of the <code>.img-responsive</code> class. This applies <code>max-width: 100%;</code> and <code>height: auto;</code> to the image so that it scales nicely to the parent element.'));
    // Tables.
    $form['general']['tables'] = array('#type' => 'fieldset', '#title' => t('Tables'), '#collapsible' => TRUE, '#collapsed' => TRUE);
    $form['general']['tables']['bootstrap_table_bordered'] = array('#type' => 'checkbox', '#title' => t('Bordered table'), '#default_value' => _bootstrap_setting('table_bordered', $theme), '#description' => t('Add borders on all sides of the table and cells.'));
    $form['general']['tables']['bootstrap_table_condensed'] = array('#type' => 'checkbox', '#title' => t('Condensed table'), '#default_value' => _bootstrap_setting('table_condensed', $theme), '#description' => t('Make tables more compact by cutting cell padding in half.'));
    $form['general']['tables']['bootstrap_table_hover'] = array('#type' => 'checkbox', '#title' => t('Hover rows'), '#default_value' => _bootstrap_setting('table_hover', $theme), '#description' => t('Enable a hover state on table rows.'));
    $form['general']['tables']['bootstrap_table_striped'] = array('#type' => 'checkbox', '#title' => t('Striped rows'), '#default_value' => _bootstrap_setting('table_striped', $theme), '#description' => t('Add zebra-striping to any table row within the <code>&lt;tbody&gt;</code>. <strong>Note:</strong> Striped tables are styled via the <code>:nth-child</code> CSS selector, which is not available in Internet Explorer 8.'));
    $form['general']['tables']['bootstrap_table_responsive'] = array('#type' => 'checkbox', '#title' => t('Responsive tables'), '#default_value' => _bootstrap_setting('table_responsive', $theme), '#description' => t('Makes tables responsive by wrapping them in <code>.table-responsive</code> to make them scroll horizontally up to small devices (under 768px). When viewing on anything larger than 768px wide, you will not see any difference in these tables.'));
    // Components.
    $form['components'] = array('#type' => 'fieldset', '#title' => t('Components'), '#group' => 'bootstrap');
    // Breadcrumbs.
    $form['components']['breadcrumbs'] = array('#type' => 'fieldset', '#title' => t('Breadcrumbs'), '#collapsible' => TRUE, '#collapsed' => TRUE);
    $form['components']['breadcrumbs']['bootstrap_breadcrumb'] = array('#type' => 'select', '#title' => t('Breadcrumb visibility'), '#default_value' => _bootstrap_setting('breadcrumb', $theme), '#options' => array(0 => t('Hidden'), 1 => t('Visible'), 2 => t('Only in admin areas')));
    $form['components']['breadcrumbs']['bootstrap_breadcrumb_home'] = array('#type' => 'checkbox', '#title' => t('Show "Home" breadcrumb link'), '#default_value' => _bootstrap_setting('breadcrumb_home', $theme), '#description' => t('If your site has a module dedicated to handling breadcrumbs already, ensure this setting is enabled.'), '#states' => array('invisible' => array(':input[name="bootstrap_breadcrumb"]' => array('value' => 0))));
    $form['components']['breadcrumbs']['bootstrap_breadcrumb_title'] = array('#type' => 'checkbox', '#title' => t('Show current page title at end'), '#default_value' => _bootstrap_setting('breadcrumb_title', $theme), '#description' => t('If your site has a module dedicated to handling breadcrumbs already, ensure this setting is disabled.'), '#states' => array('invisible' => array(':input[name="bootstrap_breadcrumb"]' => array('value' => 0))));
    // Navbar.
    $form['components']['navbar'] = array('#type' => 'fieldset', '#title' => t('Navbar'), '#collapsible' => TRUE, '#collapsed' => TRUE);
    $form['components']['navbar']['bootstrap_navbar_position'] = array('#type' => 'select', '#title' => t('Navbar Position'), '#description' => t('Select your Navbar position.'), '#default_value' => _bootstrap_setting('navbar_position', $theme), '#options' => array('static-top' => t('Static Top'), 'fixed-top' => t('Fixed Top'), 'fixed-bottom' => t('Fixed Bottom')), '#empty_option' => t('Normal'));
    $form['components']['navbar']['bootstrap_navbar_inverse'] = array('#type' => 'checkbox', '#title' => t('Inverse navbar style'), '#description' => t('Select if you want the inverse navbar style.'), '#default_value' => _bootstrap_setting('navbar_inverse', $theme));
    // Region wells.
    $wells = array('' => t('None'), 'well' => t('.well (normal)'), 'well well-sm' => t('.well-sm (small)'), 'well well-lg' => t('.well-lg (large)'));
    $form['components']['region_wells'] = array('#type' => 'fieldset', '#title' => t('Region wells'), '#description' => t('Enable the <code>.well</code>, <code>.well-sm</code> or <code>.well-lg</code> classes for specified regions. See: documentation on !wells.', array('!wells' => l(t('Bootstrap Wells'), 'http://getbootstrap.com/components/#wells'))), '#collapsible' => TRUE, '#collapsed' => TRUE);
    // Get defined regions.
    $regions = system_region_list($theme);
    foreach ($regions as $name => $title) {
        $form['components']['region_wells']['bootstrap_region_well-' . $name] = array('#title' => $title, '#type' => 'select', '#attributes' => array('class' => array('input-sm')), '#options' => $wells, '#default_value' => _bootstrap_setting('region_well-' . $name, $theme));
    }
    // JavaScript settings.
    $form['javascript'] = array('#type' => 'fieldset', '#title' => t('JavaScript'), '#group' => 'bootstrap');
    // Anchors.
    $form['javascript']['anchors'] = array('#type' => 'fieldset', '#title' => t('Anchors'), '#collapsible' => TRUE, '#collapsed' => TRUE);
    $form['javascript']['anchors']['bootstrap_anchors_fix'] = array('#type' => 'checkbox', '#title' => t('Fix anchor positions'), '#default_value' => _bootstrap_setting('anchors_fix', $theme), '#description' => t('Ensures anchors are correctly positioned only when there is margin or padding detected on the BODY element. This is useful when fixed navbar or administration menus are used.'));
    $form['javascript']['anchors']['bootstrap_anchors_smooth_scrolling'] = array('#type' => 'checkbox', '#title' => t('Enable smooth scrolling'), '#default_value' => _bootstrap_setting('anchors_smooth_scrolling', $theme), '#description' => t('Animates page by scrolling to an anchor link target smoothly when clicked.'), '#states' => array('invisible' => array(':input[name="bootstrap_anchors_fix"]' => array('checked' => FALSE))));
    // Forms.
    $form['javascript']['forms'] = array('#type' => 'fieldset', '#title' => t('Forms'), '#collapsible' => TRUE, '#collapsed' => TRUE);
    $form['javascript']['forms']['bootstrap_forms_has_error_value_toggle'] = array('#type' => 'checkbox', '#title' => t('Automatically remove error classes when values have been entered'), '#default_value' => _bootstrap_setting('forms_has_error_value_toggle', $theme), '#description' => t('If an element has a <code>.has-error</code> class attached to it, enabling this will automatically remove that class when a value is entered. This feature compliments the "General > Forms > Make required elements display as an error" feature.'));
    // Popovers.
    $form['javascript']['popovers'] = array('#type' => 'fieldset', '#title' => t('Popovers'), '#description' => t('Add small overlays of content, like those on the iPad, to any element for housing secondary information.'), '#collapsible' => TRUE, '#collapsed' => TRUE);
    $form['javascript']['popovers']['bootstrap_popover_enabled'] = array('#type' => 'checkbox', '#title' => t('Enable popovers.'), '#description' => t('Elements that have the !code attribute set will automatically initialize the popover upon page load. !warning', array('!code' => '<code>data-toggle="popover"</code>', '!warning' => '<strong class="error text-error">WARNING: This feature can sometimes impact performance. Disable if pages appear to "hang" after initial load.</strong>')), '#default_value' => _bootstrap_setting('popover_enabled', $theme));
    $form['javascript']['popovers']['options'] = array('#type' => 'fieldset', '#title' => t('Options'), '#description' => t('These are global options. Each popover can independently override desired settings by appending the option name to !data. Example: !data-animation.', array('!data' => '<code>data-</code>', '!data-animation' => '<code>data-animation="false"</code>')), '#collapsible' => TRUE, '#collapsed' => TRUE, '#states' => array('visible' => array(':input[name="bootstrap_popover_enabled"]' => array('checked' => TRUE))));
    $form['javascript']['popovers']['options']['bootstrap_popover_animation'] = array('#type' => 'checkbox', '#title' => t('animate'), '#description' => t('Apply a CSS fade transition to the popover.'), '#default_value' => _bootstrap_setting('popover_animation', $theme));
    $form['javascript']['popovers']['options']['bootstrap_popover_html'] = array('#type' => 'checkbox', '#title' => t('HTML'), '#description' => t("Insert HTML into the popover. If false, jQuery's text method will be used to insert content into the DOM. Use text if you're worried about XSS attacks."), '#default_value' => _bootstrap_setting('popover_html', $theme));
    $form['javascript']['popovers']['options']['bootstrap_popover_placement'] = array('#type' => 'select', '#title' => t('placement'), '#description' => t('Where to position the popover. When "auto" is specified, it will dynamically reorient the popover. For example, if placement is "auto left", the popover will display to the left when possible, otherwise it will display right.'), '#default_value' => _bootstrap_setting('popover_placement', $theme), '#options' => drupal_map_assoc(array('top', 'bottom', 'left', 'right', 'auto', 'auto top', 'auto bottom', 'auto left', 'auto right')));
    $form['javascript']['popovers']['options']['bootstrap_popover_selector'] = array('#type' => 'textfield', '#title' => t('selector'), '#description' => t('If a selector is provided, tooltip objects will be delegated to the specified targets. In practice, this is used to enable dynamic HTML content to have popovers added. See !this and !example.', array('!this' => l(t('this'), 'https://github.com/twbs/bootstrap/issues/4215'), '!example' => l(t('an informative example'), 'http://jsfiddle.net/fScua/'))), '#default_value' => _bootstrap_setting('popover_selector', $theme));
    $form['javascript']['popovers']['options']['bootstrap_popover_trigger'] = array('#type' => 'checkboxes', '#title' => t('trigger'), '#description' => t('How a popover is triggered.'), '#default_value' => _bootstrap_setting('popover_trigger', $theme), '#options' => drupal_map_assoc(array('click', 'hover', 'focus', 'manual')));
    $form['javascript']['popovers']['options']['bootstrap_popover_trigger_autoclose'] = array('#type' => 'checkbox', '#title' => t('Auto-close on document click'), '#description' => t('Will automatically close the current popover if a click occurs anywhere else other than the popover element.'), '#default_value' => _bootstrap_setting('popover_trigger_autoclose', $theme));
    $form['javascript']['popovers']['options']['bootstrap_popover_title'] = array('#type' => 'textfield', '#title' => t('title'), '#description' => t("Default title value if \"title\" attribute isn't present."), '#default_value' => _bootstrap_setting('popover_title', $theme));
    $form['javascript']['popovers']['options']['bootstrap_popover_content'] = array('#type' => 'textfield', '#title' => t('content'), '#description' => t('Default content value if "data-content" or "data-target" attributes are not present.'), '#default_value' => _bootstrap_setting('popover_content', $theme));
    $form['javascript']['popovers']['options']['bootstrap_popover_delay'] = array('#type' => 'textfield', '#title' => t('delay'), '#description' => t('The amount of time to delay showing and hiding the popover (in milliseconds). Does not apply to manual trigger type.'), '#default_value' => _bootstrap_setting('popover_delay', $theme));
    $form['javascript']['popovers']['options']['bootstrap_popover_container'] = array('#type' => 'textfield', '#title' => t('container'), '#description' => t('Appends the popover to a specific element. Example: "body". This option is particularly useful in that it allows you to position the popover in the flow of the document near the triggering element - which will prevent the popover from floating away from the triggering element during a window resize.'), '#default_value' => _bootstrap_setting('popover_container', $theme));
    // Tooltips.
    $form['javascript']['tooltips'] = array('#type' => 'fieldset', '#title' => t('Tooltips'), '#description' => t("Inspired by the excellent jQuery.tipsy plugin written by Jason Frame; Tooltips are an updated version, which don't rely on images, use CSS3 for animations, and data-attributes for local title storage. See !link for more documentation.", array('!link' => l(t('Bootstrap tooltips'), 'http://getbootstrap.com/javascript/#tooltips'))), '#collapsible' => TRUE, '#collapsed' => TRUE);
    $form['javascript']['tooltips']['bootstrap_tooltip_enabled'] = array('#type' => 'checkbox', '#title' => t('Enable tooltips'), '#description' => t('Elements that have the !code attribute set will automatically initialize the tooltip upon page load. !warning', array('!code' => '<code>data-toggle="tooltip"</code>', '!warning' => '<strong class="error text-error">WARNING: This feature can sometimes impact performance. Disable if pages appear to "hang" after initial load.</strong>')), '#default_value' => _bootstrap_setting('tooltip_enabled', $theme));
    $form['javascript']['tooltips']['options'] = array('#type' => 'fieldset', '#title' => t('Options'), '#description' => t('These are global options. Each tooltip can independently override desired settings by appending the option name to !data. Example: !data-animation.', array('!data' => '<code>data-</code>', '!data-animation' => '<code>data-animation="false"</code>')), '#collapsible' => TRUE, '#collapsed' => TRUE, '#states' => array('visible' => array(':input[name="bootstrap_tooltip_enabled"]' => array('checked' => TRUE))));
    $form['javascript']['tooltips']['options']['bootstrap_tooltip_animation'] = array('#type' => 'checkbox', '#title' => t('animate'), '#description' => t('Apply a CSS fade transition to the tooltip.'), '#default_value' => _bootstrap_setting('tooltip_animation', $theme));
    $form['javascript']['tooltips']['options']['bootstrap_tooltip_html'] = array('#type' => 'checkbox', '#title' => t('HTML'), '#description' => t("Insert HTML into the tooltip. If false, jQuery's text method will be used to insert content into the DOM. Use text if you're worried about XSS attacks."), '#default_value' => _bootstrap_setting('tooltip_html', $theme));
    $form['javascript']['tooltips']['options']['bootstrap_tooltip_placement'] = array('#type' => 'select', '#title' => t('placement'), '#description' => t('Where to position the tooltip. When "auto" is specified, it will dynamically reorient the tooltip. For example, if placement is "auto left", the tooltip will display to the left when possible, otherwise it will display right.'), '#default_value' => _bootstrap_setting('tooltip_placement', $theme), '#options' => drupal_map_assoc(array('top', 'bottom', 'left', 'right', 'auto', 'auto top', 'auto bottom', 'auto left', 'auto right')));
    $form['javascript']['tooltips']['options']['bootstrap_tooltip_selector'] = array('#type' => 'textfield', '#title' => t('selector'), '#description' => t('If a selector is provided, tooltip objects will be delegated to the specified targets.'), '#default_value' => _bootstrap_setting('tooltip_selector', $theme));
    $form['javascript']['tooltips']['options']['bootstrap_tooltip_trigger'] = array('#type' => 'checkboxes', '#title' => t('trigger'), '#description' => t('How a tooltip is triggered.'), '#default_value' => _bootstrap_setting('tooltip_trigger', $theme), '#options' => drupal_map_assoc(array('click', 'hover', 'focus', 'manual')));
    $form['javascript']['tooltips']['options']['bootstrap_tooltip_delay'] = array('#type' => 'textfield', '#title' => t('delay'), '#description' => t('The amount of time to delay showing and hiding the tooltip (in milliseconds). Does not apply to manual trigger type.'), '#default_value' => _bootstrap_setting('tooltip_delay', $theme));
    $form['javascript']['tooltips']['options']['bootstrap_tooltip_container'] = array('#type' => 'textfield', '#title' => t('container'), '#description' => t('Appends the tooltip to a specific element. Example: "body"'), '#default_value' => _bootstrap_setting('tooltip_container', $theme));
    // Fonts settings.
    $form['cdn'] = array('#type' => 'fieldset', '#title' => t('CDNs'), '#group' => 'bootstrap');
    // Bootstrap CSS CDN URL.
    $form['cdn']['bootstrap_bscdn_css'] = array('#type' => 'textfield', '#title' => t('Bootstrap CSS URL'), '#description' => t('It is best to use protocol relative URLs (i.e. without http: or https:) here as it will allow more flexibility if the need ever arises. You can use either minified or normal version. Leave blank if you want add bootstrap library by other means.'), '#default_value' => _bootstrap_setting('bscdn_css', $theme));
    // Bootstrap JS CDN URL.
    $form['cdn']['bootstrap_bscdn_js'] = array('#type' => 'textfield', '#title' => t('Bootstrap JS URL'), '#description' => t('Additionally, you can provide the minimized version of the file. It will be used instead if site aggregation is enabled. You can use either minified or normal version. Leave blank if you want add bootstrap library by other means.'), '#default_value' => _bootstrap_setting('bscdn_js', $theme));
    // Font awesome link.
    $form['cdn']['bootstrap_fontawesome'] = array('#type' => 'textfield', '#title' => t('Font Awesome link'), '#description' => t('Enter the CDN link for fontawesome, Leave it blank if dont want or load via other modules like iconapi.'), '#default_value' => _bootstrap_setting('fontawesome', $theme));
    // Google Fonts link.
    $form['cdn']['bootstrap_googlefont'] = array('#type' => 'textfield', '#title' => t('Google Font link'), '#description' => t('Enter the google font link. Leave it blank if you dont want, or if you like to load via fontyourface module.'), '#default_value' => _bootstrap_setting('googlefont', $theme));
    // Advanced settings.
    $form['advanced'] = array('#type' => 'fieldset', '#title' => t('Advanced'), '#group' => 'bootstrap');
    // jQuery Update error suppression.
    $form['advanced']['bootstrap_toggle_jquery_error'] = array('#type' => 'checkbox', '#title' => t('Suppress jQuery version error message'), '#default_value' => _bootstrap_setting('toggle_jquery_error', $theme), '#description' => t('Enable this if the version of jQuery has been upgraded to 1.9+ using a method other than the <a href="!jquery_update" target="_blank">jQuery Update</a> module.', array('!jquery_update' => 'https://drupal.org/project/jquery_update')));
    $form['advanced']['bootstrap_search_box'] = array('#type' => 'checkbox', '#title' => t('Show Searchbox'), '#default_value' => _bootstrap_setting('search_box', $theme), '#description' => t('Show search box in navigation.'));
    $form['advanced']['bootstrap_flatit'] = array('#type' => 'checkbox', '#title' => t('Flat it'), '#default_value' => _bootstrap_setting('flatit', $theme), '#description' => t('Overrides all the border radius to zero.'));
    $form['advanced']['bootstrap_credits'] = array('#type' => 'checkbox', '#title' => t('Display credits'), '#default_value' => _bootstrap_setting('credits', $theme), '#description' => t('Display the theme credits to cmsbots.com at bottom of footer.'));
    // Settings for some default content for home page.
    $form['contents'] = array('#type' => 'fieldset', '#title' => t('Homepage Content settings'), '#group' => 'bootstrap', '#description' => t('This portion helps you to setup some default contents without using drupal block system for frontpage, but still you can use blocks to override this'));
    $form['contents']['home_welcome'] = array('#title' => t('Content for Home page Welcome block'), '#description' => t('Content for Home page Welcome block. Use &lt;disable&gt; to disable this region.'), '#default_value' => _bootstrap_helper_theme_get_setting('home_welcome'), '#type' => 'textarea', '#required' => FALSE);
    $form['contents']['home_cta'] = array('#title' => t('Content for Home page CTA'), '#description' => t('Content for Home page Call to action block. Use &lt;disable&gt; to disable this region.'), '#default_value' => _bootstrap_helper_theme_get_setting('home_cta'), '#type' => 'textarea', '#required' => FALSE);
    $form['contents']['home_features'] = array('#title' => t('Content for Home page Features Area'), '#description' => t('Content for Home page Features Area. Use &lt;disable&gt; to disable this region.'), '#default_value' => _bootstrap_helper_theme_get_setting('home_features'), '#type' => 'textarea', '#required' => FALSE);
    $form['contents']['home_bottom'] = array('#title' => t('Content for Home page Bottom Content'), '#description' => t('Content for Home page Bottom Content. Use &lt;disable&gt; to disable this region.'), '#default_value' => _bootstrap_helper_theme_get_setting('home_bottom'), '#type' => 'textarea', '#required' => FALSE);
    $form['contents']['footer_copyright'] = array('#title' => t('Content for Home page footer_copyright'), '#description' => t('Content for Home page footer_copyright. Use &lt;disable&gt; to disable this region.'), '#default_value' => _bootstrap_helper_theme_get_setting('footer_copyright'), '#type' => 'textarea', '#required' => FALSE);
    $form['contents']['footer_message'] = array('#title' => t('Content for Home page footer_message'), '#description' => t('Content for Home page footer_message. Use &lt;disable&gt; to disable this region.'), '#default_value' => _bootstrap_helper_theme_get_setting('footer_message'), '#type' => 'textarea', '#required' => FALSE);
}
Example #23
0
 /**
  * Returns the human-readable list of regions keyed by machine name.
  *
  * @param string $theme
  *   The name of the theme.
  *
  * @return array
  *   An array of human-readable region names keyed by machine name.
  */
 protected function getVisibleRegionNames($theme)
 {
     return system_region_list($theme, REGIONS_VISIBLE);
 }
Example #24
0
/**
 * Implements hook_page_alter().
 */
function omega_page_alter(&$page)
{
    // Place dummy blocks in each region if the 'demo regions' setting is active
    // to force regions to be rendered.
    if (omega_extension_enabled('development') && omega_theme_get_setting('omega_demo_regions', TRUE) && user_access('administer site configuration')) {
        $item = menu_get_item();
        // Don't interfere with the 'Demonstrate block regions' page.
        if (strpos('admin/structure/block/demo/', $item['path']) !== 0) {
            $regions = system_region_list($GLOBALS['theme_key'], REGIONS_VISIBLE);
            $configured = omega_theme_get_setting('omega_demo_regions_list', array_keys($regions));
            // We don't explicitly load possible layout regions and instead really
            // just show demo regions for those regions that we can actually place
            // blocks in. Hence, there will only be demo regions for those regions
            // that have been declared through the theme's .info file.
            foreach (array_intersect_key($regions, array_flip($configured)) as $region => $name) {
                if (empty($page[$region])) {
                    $page[$region]['#theme_wrappers'] = array('region');
                    $page[$region]['#region'] = $region;
                }
                $page[$region]['#name'] = $name;
                $page[$region]['#debug'] = TRUE;
            }
        }
    }
}
Example #25
0
 /**
  * Handles switching the available regions based on the selected theme.
  */
 public function themeSwitch($form, FormStateInterface $form_state)
 {
     $form['region']['#options'] = system_region_list($form_state->getValue('theme'), REGIONS_VISIBLE);
     return $form['region'];
 }
Example #26
0
/**
 * Implements hook_page_alter
 */
function omega_page_alter($page) {
/**
 * 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.
 */
  // 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;
      }
    }
  }
}
Example #27
0
 /**
  * Tests that theme info can be altered by a module.
  *
  * @see module_test_system_info_alter()
  */
 function testThemeInfoAlter()
 {
     $name = 'seven';
     $this->container->get('state')->set('module_test.hook_system_info_alter', TRUE);
     $module_handler = $this->container->get('module_handler');
     $this->themeHandler()->enable(array($name));
     $themes = $this->themeHandler()->listInfo();
     $this->assertFalse(isset($themes[$name]->info['regions']['test_region']));
     $module_handler->install(array('module_test'), FALSE);
     $this->assertTrue($module_handler->moduleExists('module_test'));
     $themes = $this->themeHandler()->listInfo();
     $this->assertTrue(isset($themes[$name]->info['regions']['test_region']));
     // Legacy assertions.
     // @todo Remove once theme initialization/info has been modernized.
     // @see https://drupal.org/node/2228093
     $info = system_get_info('theme', $name);
     $this->assertTrue(isset($info['regions']['test_region']));
     $regions = system_region_list($name);
     $this->assertTrue(isset($regions['test_region']));
     $system_list = system_list('theme');
     $this->assertTrue(isset($system_list[$name]->info['regions']['test_region']));
     $module_handler->uninstall(array('module_test'));
     $this->assertFalse($module_handler->moduleExists('module_test'));
     $themes = $this->themeHandler()->listInfo();
     $this->assertFalse(isset($themes[$name]->info['regions']['test_region']));
     // Legacy assertions.
     // @todo Remove once theme initialization/info has been modernized.
     // @see https://drupal.org/node/2228093
     $info = system_get_info('theme', $name);
     $this->assertFalse(isset($info['regions']['test_region']));
     $regions = system_region_list($name);
     $this->assertFalse(isset($regions['test_region']));
     $system_list = system_list('theme');
     $this->assertFalse(isset($system_list[$name]->info['regions']['test_region']));
 }
Example #28
0
/**
 * Generate initial grid info.
 */
function webpro_core_grid_info()
{
    global $theme_key;
    $grid =& drupal_static(__FUNCTION__);
    if (isset($grid)) {
        return $grid;
    }
    $grid = array();
    $grid['name'] = substr(theme_get_setting('theme_grid'), 0, 7);
    $grid['type'] = substr(theme_get_setting('theme_grid'), 7);
    $grid['fixed'] = substr(theme_get_setting('theme_grid'), 7) != 'fluid' ? TRUE : FALSE;
    $grid['width'] = (int) substr($grid['name'], 4, 2);
    // Set sidebar width if this is the block demonstration page.
    global $theme;
    $item = menu_get_item();
    if ($item['path'] == 'admin/structure/block/demo/' . $theme) {
        $grid['sidebar_first_width'] = theme_get_setting('sidebar_first_width');
        $grid['sidebar_second_width'] = theme_get_setting('sidebar_second_width');
    } else {
        $grid['sidebar_first_width'] = webpro_core_block_list('sidebar_first') ? theme_get_setting('sidebar_first_width') : 0;
        $grid['sidebar_second_width'] = webpro_core_block_list('sidebar_second') ? theme_get_setting('sidebar_second_width') : 0;
    }
    $grid['regions'] = array();
    $regions = array_keys(system_region_list($theme_key, REGIONS_VISIBLE));
    $nested_regions = theme_get_setting('grid_nested_regions');
    $adjusted_regions = theme_get_setting('grid_adjusted_regions');
    foreach ($regions as $region) {
        $region_style = 'full-width';
        $region_width = $grid['width'];
        if ($region == 'sidebar_first' || $region == 'sidebar_second') {
            $region_width = $region == 'sidebar_first' ? $grid['sidebar_first_width'] : $grid['sidebar_second_width'];
        }
        if ($nested_regions && in_array($region, $nested_regions)) {
            $region_style = 'nested';
            if ($adjusted_regions && in_array($region, array_keys($adjusted_regions))) {
                foreach ($adjusted_regions[$region] as $adjacent_region) {
                    $region_width = $region_width - $grid[$adjacent_region . '_width'];
                }
            }
        }
        $grid['regions'][$region] = array('width' => $region_width, 'style' => $region_style, 'total' => count(webpro_core_block_list($region)), 'count' => 0);
    }
    // Adjustments for fluid width regions & groups
    $grid['fluid_adjustments'] = array();
    // Regions
    $adjusted_regions_fluid = theme_get_setting('grid_adjusted_regions_fluid') ? theme_get_setting('grid_adjusted_regions_fluid') : array();
    foreach (array_keys($adjusted_regions_fluid) as $adjusted_region) {
        $width = $grid['width'];
        foreach ($adjusted_regions_fluid[$adjusted_region] as $region) {
            $width = $width - $grid['regions'][$region]['width'];
            // Subtract regions outside parent group to get correct parent width
        }
        $grid['fluid_adjustments'][$adjusted_region] = round($grid['regions'][$adjusted_region]['width'] / $width * 100, 2);
    }
    // Groups
    $adjusted_groups_fluid = theme_get_setting('grid_adjusted_groups_fluid') ? theme_get_setting('grid_adjusted_groups_fluid') : array();
    foreach (array_keys($adjusted_groups_fluid) as $adjusted_group) {
        $width = 100;
        foreach ($adjusted_groups_fluid[$adjusted_group] as $region) {
            $width = $width - $grid['fluid_adjustments'][$region];
            // Subtract previously calculated sibling region fluid adjustments
        }
        $grid['fluid_adjustments'][$adjusted_group] = $width;
        // Group gets remaining width
    }
    return $grid;
}
Example #29
0
function falkor_preprocess_region(&$vars)
{
    /* Getting the human-readable name of a region for use in templates */
    $regions_list = system_region_list('falkor', $show = REGIONS_ALL);
    $vars['region_name'] = $regions_list[$vars['region']];
}
Example #30
0
/**
 * Implements hook_form_FORM_ID_alter().
 */
function bootstrap_form_system_theme_settings_alter(&$form, FormStateInterface $form_state, $form_id = NULL)
{
    // Do not add Bootstrap specific settings to non-bootstrap based themes,
    // including a work-around for a core bug affecting admin themes.
    // @see https://drupal.org/node/943212
    $args = $form_state->getBuildInfo()['args'];
    // Do not add Bootstrap specific settings to non-bootstrap based themes.
    $theme = !empty($args[0]) ? $args[0] : FALSE;
    if (isset($form_id) || $theme === FALSE || !in_array('bootstrap', _bootstrap_get_base_themes($theme, TRUE))) {
        return;
    }
    $form['bootstrap'] = array('#type' => 'vertical_tabs', '#attached' => array('library' => array('bootstrap/adminscript')), '#prefix' => '<h2><small>' . t('Bootstrap Settings') . '</small></h2>', '#weight' => -10);
    // General.
    $form['general'] = array('#type' => 'details', '#title' => t('General'), '#group' => 'bootstrap');
    // Container.
    $form['general']['container'] = array('#type' => 'fieldset', '#title' => t('Container'), '#collapsible' => TRUE, '#collapsed' => TRUE);
    $form['general']['container']['bootstrap_fluid_container'] = array('#type' => 'checkbox', '#title' => t('Fluid container'), '#default_value' => bootstrap_setting('fluid_container', $theme), '#description' => t('Use <code>.container-fluid</code> class. See <a href=":url">Fluid container</a>', array(':url' => 'http://getbootstrap.com/css/#grid-example-fluid')));
    // Buttons.
    $form['general']['buttons'] = array('#type' => 'details', '#title' => t('Buttons'), '#collapsible' => TRUE, '#collapsed' => TRUE);
    $form['general']['buttons']['bootstrap_button_size'] = array('#type' => 'select', '#title' => t('Default button size'), '#default_value' => bootstrap_setting('button_size', $theme), '#empty_option' => t('Normal'), '#options' => array('btn-xs' => t('Extra Small'), 'btn-sm' => t('Small'), 'btn-lg' => t('Large')));
    $form['general']['buttons']['bootstrap_button_colorize'] = array('#type' => 'checkbox', '#title' => t('Colorize Buttons'), '#default_value' => bootstrap_setting('button_colorize', $theme), '#description' => t('Adds classes to buttons based on their text value. See: <a href=":bootstrap_url" target="_blank">Buttons</a> and <a href=":api_url" target="_blank">hook_bootstrap_colorize_text_alter()</a>', array(':bootstrap_url' => 'http://getbootstrap.com/css/#buttons', ':api_url' => 'http://drupal-bootstrap.org/apis/hook_bootstrap_colorize_text_alter')));
    $form['general']['buttons']['bootstrap_button_iconize'] = array('#type' => 'checkbox', '#title' => t('Iconize Buttons'), '#default_value' => bootstrap_setting('button_iconize', $theme), '#description' => t('Adds icons to buttons based on the text value. See: <a href=":api_url" target="_blank">hook_bootstrap_iconize_text_alter()</a>', array(':api_url' => 'http://drupal-bootstrap.org/apis/hook_bootstrap_iconize_text_alter')));
    // Forms.
    $form['general']['forms'] = array('#type' => 'details', '#title' => t('Forms'), '#collapsible' => TRUE, '#collapsed' => TRUE);
    $form['general']['forms']['bootstrap_forms_required_has_error'] = array('#type' => 'checkbox', '#title' => t('Make required elements display as an error'), '#default_value' => bootstrap_setting('forms_required_has_error', $theme), '#description' => t('If an element in a form is required, enabling this will always display the element with a <code>.has-error</code> class. This turns the element red and helps in usability for determining which form elements are required to submit the form.  This feature compliments the "JavaScript > Forms > Automatically remove error classes when values have been entered" feature.'));
    $form['general']['forms']['bootstrap_forms_smart_descriptions'] = array('#type' => 'checkbox', '#title' => t('Smart form descriptions (via Tooltips)'), '#description' => t('Convert descriptions into tooltips (must be enabled) automatically based on certain criteria. This helps reduce the, sometimes unnecessary, amount of noise on a page full of form elements.'), '#default_value' => bootstrap_setting('forms_smart_descriptions', $theme));
    $form['general']['forms']['bootstrap_forms_smart_descriptions_limit'] = array('#type' => 'textfield', '#title' => t('"Smart form descriptions" maximum character limit'), '#description' => t('Prevents descriptions from becoming tooltips by checking the character length of the description (HTML is not counted towards this limit). To disable this filtering criteria, leave an empty value.'), '#default_value' => bootstrap_setting('forms_smart_descriptions_limit', $theme), '#states' => array('visible' => array(':input[name="bootstrap_forms_smart_descriptions"]' => array('checked' => TRUE))));
    $form['general']['forms']['bootstrap_forms_smart_descriptions_allowed_tags'] = array('#type' => 'textfield', '#title' => t('"Smart form descriptions" allowed (HTML) tags'), '#description' => t('Prevents descriptions from becoming tooltips by checking for HTML not in the list above (i.e. links). Separate by commas. To disable this filtering criteria, leave an empty value.'), '#default_value' => bootstrap_setting('forms_smart_descriptions_allowed_tags', $theme), '#states' => array('visible' => array(':input[name="bootstrap_forms_smart_descriptions"]' => array('checked' => TRUE))));
    // Images.
    $form['general']['images'] = array('#type' => 'details', '#title' => t('Images'), '#collapsible' => TRUE, '#collapsed' => TRUE);
    $form['general']['images']['bootstrap_image_shape'] = array('#type' => 'select', '#title' => t('Default image shape'), '#description' => t('Add classes to an <code>&lt;img&gt;</code> element to easily style images in any project. Note: Internet Explorer 8 lacks support for rounded corners. See: <a href=":bootstrap_url" target="_blank">Image Shapes</a>', array(':bootstrap_url' => 'http://getbootstrap.com/css/#images-shapes')), '#default_value' => bootstrap_setting('image_shape', $theme), '#empty_option' => t('None'), '#options' => array('img-rounded' => t('Rounded'), 'img-circle' => t('Circle'), 'img-thumbnail' => t('Thumbnail')));
    $form['general']['images']['bootstrap_image_responsive'] = array('#type' => 'checkbox', '#title' => t('Responsive Images'), '#default_value' => bootstrap_setting('image_responsive', $theme), '#description' => t('Images in Bootstrap 3 can be made responsive-friendly via the addition of the <code>.img-responsive</code> class. This applies <code>max-width: 100%;</code> and <code>height: auto;</code> to the image so that it scales nicely to the parent element.'));
    // Tables.
    $form['general']['tables'] = array('#type' => 'details', '#title' => t('Tables'), '#collapsible' => TRUE, '#collapsed' => TRUE);
    $form['general']['tables']['bootstrap_table_bordered'] = array('#type' => 'checkbox', '#title' => t('Bordered table'), '#default_value' => bootstrap_setting('table_bordered', $theme), '#description' => t('Add borders on all sides of the table and cells.'));
    $form['general']['tables']['bootstrap_table_condensed'] = array('#type' => 'checkbox', '#title' => t('Condensed table'), '#default_value' => bootstrap_setting('table_condensed', $theme), '#description' => t('Make tables more compact by cutting cell padding in half.'));
    $form['general']['tables']['bootstrap_table_hover'] = array('#type' => 'checkbox', '#title' => t('Hover rows'), '#default_value' => bootstrap_setting('table_hover', $theme), '#description' => t('Enable a hover state on table rows.'));
    $form['general']['tables']['bootstrap_table_striped'] = array('#type' => 'checkbox', '#title' => t('Striped rows'), '#default_value' => bootstrap_setting('table_striped', $theme), '#description' => t('Add zebra-striping to any table row within the <code>&lt;tbody&gt;</code>. <strong>Note:</strong> Striped tables are styled via the <code>:nth-child</code> CSS selector, which is not available in Internet Explorer 8.'));
    $form['general']['tables']['bootstrap_table_responsive'] = array('#type' => 'checkbox', '#title' => t('Responsive tables'), '#default_value' => bootstrap_setting('table_responsive', $theme), '#description' => t('Makes tables responsive by wrapping them in <code>.table-responsive</code> to make them scroll horizontally up to small devices (under 768px). When viewing on anything larger than 768px wide, you will not see any difference in these tables.'));
    // Components.
    $form['components'] = array('#type' => 'details', '#title' => t('Components'), '#group' => 'bootstrap');
    // Breadcrumbs.
    $form['components']['breadcrumbs'] = array('#type' => 'details', '#title' => t('Breadcrumbs'), '#collapsible' => TRUE, '#collapsed' => TRUE);
    $form['components']['breadcrumbs']['bootstrap_breadcrumb'] = array('#type' => 'select', '#title' => t('Breadcrumb visibility'), '#default_value' => bootstrap_setting('breadcrumb', $theme), '#options' => array(0 => t('Hidden'), 1 => t('Visible'), 2 => t('Only in admin areas')));
    $form['components']['breadcrumbs']['bootstrap_breadcrumb_home'] = array('#type' => 'checkbox', '#title' => t('Show "Home" breadcrumb link'), '#default_value' => bootstrap_setting('breadcrumb_home', $theme), '#description' => t('If your site has a module dedicated to handling breadcrumbs already, ensure this setting is enabled.'), '#states' => array('invisible' => array(':input[name="bootstrap_breadcrumb"]' => array('value' => 0))));
    $form['components']['breadcrumbs']['bootstrap_breadcrumb_title'] = array('#type' => 'checkbox', '#title' => t('Show current page title at end'), '#default_value' => bootstrap_setting('breadcrumb_title', $theme), '#description' => t('If your site has a module dedicated to handling breadcrumbs already, ensure this setting is disabled.'), '#states' => array('invisible' => array(':input[name="bootstrap_breadcrumb"]' => array('value' => 0))));
    // Navbar.
    $form['components']['navbar'] = array('#type' => 'details', '#title' => t('Navbar'), '#collapsible' => TRUE, '#collapsed' => TRUE);
    $form['components']['navbar']['bootstrap_navbar_position'] = array('#type' => 'select', '#title' => t('Navbar Position'), '#description' => t('Select your Navbar position.'), '#default_value' => bootstrap_setting('navbar_position', $theme), '#options' => array('static-top' => t('Static Top'), 'fixed-top' => t('Fixed Top'), 'fixed-bottom' => t('Fixed Bottom')), '#empty_option' => t('Normal'));
    $form['components']['navbar']['bootstrap_navbar_inverse'] = array('#type' => 'checkbox', '#title' => t('Inverse navbar style'), '#description' => t('Select if you want the inverse navbar style.'), '#default_value' => bootstrap_setting('navbar_inverse', $theme));
    // Region wells.
    $wells = array('' => t('None'), 'well' => t('.well (normal)'), 'well well-sm' => t('.well-sm (small)'), 'well well-lg' => t('.well-lg (large)'));
    $form['components']['region_wells'] = array('#type' => 'details', '#title' => t('Region wells'), '#description' => t('Enable the <code>.well</code>, <code>.well-sm</code> or <code>.well-lg</code> classes for specified regions. See: documentation on <a href=":wells" target="_blank">Bootstrap Wells</a>.', array(':wells' => 'http://getbootstrap.com/components/#wells')), '#collapsible' => TRUE, '#collapsed' => TRUE);
    // Get defined regions.
    $regions = system_region_list('bootstrap');
    foreach ($regions as $name => $title) {
        $form['components']['region_wells']['bootstrap_region_well-' . $name] = array('#title' => $title, '#type' => 'select', '#attributes' => array('class' => array('input-sm')), '#options' => $wells, '#default_value' => bootstrap_setting('region_well-' . $name, $theme));
    }
    // JavaScript settings.
    $form['javascript'] = array('#type' => 'details', '#title' => t('JavaScript'), '#group' => 'bootstrap');
    // Anchors.
    $form['javascript']['anchors'] = array('#type' => 'details', '#title' => t('Anchors'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#description' => t('This plugin is not able to be configured from the UI as it is severely broken. In an effort to balance not break backwards compatibility and to prevent new users from running into unforeseen issues, you must manually opt-in/out inside your theme\'s setting configuration file. Please see the following issue for more details: <a href=":url" target="_blank">Replace custom JS with the bootstrap-anchor plugin</a>', array(':url' => 'https://www.drupal.org/node/2462645')));
    $form['javascript']['anchors']['bootstrap_anchors_fix'] = array('#type' => 'checkbox', '#title' => t('Fix anchor positions'), '#default_value' => bootstrap_setting('anchors_fix', $theme), '#description' => t('Ensures anchors are correctly positioned only when there is margin or padding detected on the BODY element. This is useful when fixed navbar or administration menus are used.'), '#disabled' => TRUE);
    $form['javascript']['anchors']['bootstrap_anchors_smooth_scrolling'] = array('#type' => 'checkbox', '#title' => t('Enable smooth scrolling'), '#default_value' => bootstrap_setting('anchors_smooth_scrolling', $theme), '#description' => t('Animates page by scrolling to an anchor link target smoothly when clicked.'), '#states' => array('invisible' => array(':input[name="bootstrap_anchors_fix"]' => array('checked' => FALSE))), '#disabled' => TRUE);
    // Forms.
    $form['javascript']['forms'] = array('#type' => 'details', '#title' => t('Forms'), '#collapsible' => TRUE, '#collapsed' => TRUE);
    $form['javascript']['forms']['bootstrap_forms_has_error_value_toggle'] = array('#type' => 'checkbox', '#title' => t('Automatically remove error classes when values have been entered'), '#default_value' => bootstrap_setting('forms_has_error_value_toggle', $theme), '#description' => t('If an element has a <code>.has-error</code> class attached to it, enabling this will automatically remove that class when a value is entered. This feature compliments the "General > Forms > Make required elements display as an error" feature.'));
    // Popovers.
    $form['javascript']['popovers'] = array('#type' => 'details', '#title' => t('Popovers'), '#description' => t('Add small overlays of content, like those on the iPad, to any element for housing secondary information.'), '#collapsible' => TRUE, '#collapsed' => TRUE);
    $form['javascript']['popovers']['bootstrap_popover_enabled'] = array('#type' => 'checkbox', '#title' => t('Enable popovers.'), '#description' => t('Elements that have the <code>data-toggle="popover"</code> attribute set will automatically initialize the popover upon page load. <strong class="error text-error">WARNING: This feature can sometimes impact performance. Disable if pages appear to "hang" after initial load.</strong>'), '#default_value' => bootstrap_setting('popover_enabled', $theme));
    $form['javascript']['popovers']['options'] = array('#type' => 'details', '#title' => t('Options'), '#description' => t('These are global options. Each popover can independently override desired settings by appending the option name to <code>data-</code>. Example: <code>data-animation="false"</code>.'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#states' => array('visible' => array(':input[name="bootstrap_popover_enabled"]' => array('checked' => TRUE))));
    $form['javascript']['popovers']['options']['bootstrap_popover_animation'] = array('#type' => 'checkbox', '#title' => t('animate'), '#description' => t('Apply a CSS fade transition to the popover.'), '#default_value' => bootstrap_setting('popover_animation', $theme));
    $form['javascript']['popovers']['options']['bootstrap_popover_html'] = array('#type' => 'checkbox', '#title' => t('HTML'), '#description' => t("Insert HTML into the popover. If false, jQuery's text method will be used to insert content into the DOM. Use text if you're worried about XSS attacks."), '#default_value' => bootstrap_setting('popover_html', $theme));
    $options = array('top', 'bottom', 'left', 'right', 'auto', 'auto top', 'auto bottom', 'auto left', 'auto right');
    $form['javascript']['popovers']['options']['bootstrap_popover_placement'] = array('#type' => 'select', '#title' => t('placement'), '#description' => t('Where to position the popover. When "auto" is specified, it will dynamically reorient the popover. For example, if placement is "auto left", the popover will display to the left when possible, otherwise it will display right.'), '#default_value' => bootstrap_setting('popover_placement', $theme), '#options' => array_combine($options, $options));
    $form['javascript']['popovers']['options']['bootstrap_popover_selector'] = array('#type' => 'textfield', '#title' => t('selector'), '#description' => t('If a selector is provided, tooltip objects will be delegated to the specified targets. In practice, this is used to enable dynamic HTML content to have popovers added. See <a href=":this" target="_blank">this</a> and <a href=":example" target="_blank">an informative example</a>.', array(':this' => 'https://github.com/twbs/bootstrap/issues/4215', ':example' => 'http://jsfiddle.net/fScua/')), '#default_value' => bootstrap_setting('popover_selector', $theme));
    $options = array('click', 'hover', 'focus', 'manual');
    $form['javascript']['popovers']['options']['bootstrap_popover_trigger'] = array('#type' => 'checkboxes', '#title' => t('trigger'), '#description' => t('How a popover is triggered.'), '#default_value' => bootstrap_setting('popover_trigger', $theme), '#options' => array_combine($options, $options));
    $form['javascript']['popovers']['options']['bootstrap_popover_trigger_autoclose'] = array('#type' => 'checkbox', '#title' => t('Auto-close on document click'), '#description' => t('Will automatically close the current popover if a click occurs anywhere else other than the popover element.'), '#default_value' => bootstrap_setting('popover_trigger_autoclose', $theme));
    $form['javascript']['popovers']['options']['bootstrap_popover_title'] = array('#type' => 'textfield', '#title' => t('title'), '#description' => t("Default title value if \"title\" attribute isn't present."), '#default_value' => bootstrap_setting('popover_title', $theme));
    $form['javascript']['popovers']['options']['bootstrap_popover_content'] = array('#type' => 'textfield', '#title' => t('content'), '#description' => t('Default content value if "data-content" or "data-target" attributes are not present.'), '#default_value' => bootstrap_setting('popover_content', $theme));
    $form['javascript']['popovers']['options']['bootstrap_popover_delay'] = array('#type' => 'textfield', '#title' => t('delay'), '#description' => t('The amount of time to delay showing and hiding the popover (in milliseconds). Does not apply to manual trigger type.'), '#default_value' => bootstrap_setting('popover_delay', $theme));
    $form['javascript']['popovers']['options']['bootstrap_popover_container'] = array('#type' => 'textfield', '#title' => t('container'), '#description' => t('Appends the popover to a specific element. Example: "body". This option is particularly useful in that it allows you to position the popover in the flow of the document near the triggering element - which will prevent the popover from floating away from the triggering element during a window resize.'), '#default_value' => bootstrap_setting('popover_container', $theme));
    // Tooltips.
    $form['javascript']['tooltips'] = array('#type' => 'details', '#title' => t('Tooltips'), '#description' => t('Inspired by the excellent jQuery.tipsy plugin written by Jason Frame; Tooltips are an updated version, which don\'t rely on images, use CSS3 for animations, and data-attributes for local title storage. See <a href=":url" target="_blank">Bootstrap tooltips</a> for more documentation.', array(':url' => 'http://getbootstrap.com/javascript/#tooltips')), '#collapsible' => TRUE, '#collapsed' => TRUE);
    $form['javascript']['tooltips']['bootstrap_tooltip_enabled'] = array('#type' => 'checkbox', '#title' => t('Enable tooltips'), '#description' => t('Elements that have the <code>data-toggle="tooltip"</code> attribute set will automatically initialize the tooltip upon page load. <strong class="error text-error">WARNING: This feature can sometimes impact performance. Disable if pages appear to "hang" after initial load.</strong>'), '#default_value' => bootstrap_setting('tooltip_enabled', $theme));
    $form['javascript']['tooltips']['options'] = array('#type' => 'details', '#title' => t('Options'), '#description' => t('These are global options. Each tooltip can independently override desired settings by appending the option name to <code>data-</code>. Example: <code>data-animation="false"</code>.'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#states' => array('visible' => array(':input[name="bootstrap_tooltip_enabled"]' => array('checked' => TRUE))));
    $form['javascript']['tooltips']['options']['bootstrap_tooltip_animation'] = array('#type' => 'checkbox', '#title' => t('animate'), '#description' => t('Apply a CSS fade transition to the tooltip.'), '#default_value' => bootstrap_setting('tooltip_animation', $theme));
    $form['javascript']['tooltips']['options']['bootstrap_tooltip_html'] = array('#type' => 'checkbox', '#title' => t('HTML'), '#description' => t("Insert HTML into the tooltip. If false, jQuery's text method will be used to insert content into the DOM. Use text if you're worried about XSS attacks."), '#default_value' => bootstrap_setting('tooltip_html', $theme));
    $options = array('top', 'bottom', 'left', 'right', 'auto', 'auto top', 'auto bottom', 'auto left', 'auto right');
    $form['javascript']['tooltips']['options']['bootstrap_tooltip_placement'] = array('#type' => 'select', '#title' => t('placement'), '#description' => t('Where to position the tooltip. When "auto" is specified, it will dynamically reorient the tooltip. For example, if placement is "auto left", the tooltip will display to the left when possible, otherwise it will display right.'), '#default_value' => bootstrap_setting('tooltip_placement', $theme), '#options' => array_combine($options, $options));
    $form['javascript']['tooltips']['options']['bootstrap_tooltip_selector'] = array('#type' => 'textfield', '#title' => t('selector'), '#description' => t('If a selector is provided, tooltip objects will be delegated to the specified targets.'), '#default_value' => bootstrap_setting('tooltip_selector', $theme));
    $options = array('click', 'hover', 'focus', 'manual');
    $form['javascript']['tooltips']['options']['bootstrap_tooltip_trigger'] = array('#type' => 'checkboxes', '#title' => t('trigger'), '#description' => t('How a tooltip is triggered.'), '#default_value' => bootstrap_setting('tooltip_trigger', $theme), '#options' => array_combine($options, $options));
    $form['javascript']['tooltips']['options']['bootstrap_tooltip_delay'] = array('#type' => 'textfield', '#title' => t('delay'), '#description' => t('The amount of time to delay showing and hiding the tooltip (in milliseconds). Does not apply to manual trigger type.'), '#default_value' => bootstrap_setting('tooltip_delay', $theme));
    $form['javascript']['tooltips']['options']['bootstrap_tooltip_container'] = array('#type' => 'textfield', '#title' => t('container'), '#description' => t('Appends the tooltip to a specific element. Example: "body"'), '#default_value' => bootstrap_setting('tooltip_container', $theme));
    // Advanced settings.
    $form['advanced'] = array('#type' => 'details', '#title' => t('Advanced'), '#group' => 'bootstrap');
    // BootstrapCDN.
    bootstrap_cdn_provider_settings_form($form, $form_state, $theme);
}