Ejemplo n.º 1
0
 /**
  * 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)));
     }
 }
Ejemplo n.º 2
0
/**
 * Add the update task list to the current page.
 */
function update_task_list($active = NULL)
{
    // Default list of tasks.
    $tasks = array('requirements' => 'Verify requirements', 'info' => 'Overview', 'select' => 'Review updates', 'run' => 'Run updates', 'finished' => 'Review log');
    drupal_add_region_content('left', theme('task_list', $tasks, $active));
}
Ejemplo n.º 3
0
/**
 * Display themed installer output and end the page request.
 *
 * Installation tasks should use drupal_set_title() to set the desired page
 * title, but otherwise this function takes care of theming the overall page
 * output during every step of the installation.
 *
 * @param $output
 *   The content to display on the main part of the page.
 * @param $install_state
 *   An array of information about the current installation state.
 */
function install_display_output($output, $install_state)
{
    drupal_page_header();
    // Only show the task list if there is an active task; otherwise, the page
    // request has ended before tasks have even been started, so there is nothing
    // meaningful to show.
    if (isset($install_state['active_task'])) {
        // Let the theming function know when every step of the installation has
        // been completed.
        $active_task = $install_state['installation_finished'] ? NULL : $install_state['active_task'];
        drupal_add_region_content('sidebar_first', theme('task_list', array('items' => install_tasks_to_display($install_state), 'active' => $active_task)));
    }
    print theme($install_state['database_tables_exist'] ? 'maintenance_page' : 'install_page', array('content' => $output));
    exit;
}
Ejemplo n.º 4
0
/**
 * Add the installation task list to the current page.
 */
function install_task_list($active = NULL)
{
    // Default list of tasks.
    $tasks = array('profile-select' => st('Choose profile'), 'locale-select' => st('Choose language'), 'requirements' => st('Verify requirements'), 'database' => st('Set up database'), 'profile-install-batch' => st('Install profile'), 'locale-initial-batch' => st('Set up translations'), 'configure' => st('Configure site'));
    $profiles = install_find_profiles();
    $profile = isset($_GET['profile']) && isset($profiles[$_GET['profile']]) ? $_GET['profile'] : '.';
    $locales = install_find_locales($profile);
    // If we have only one profile, remove 'Choose profile'
    // and rename 'Install profile'.
    if (count($profiles) == 1) {
        unset($tasks['profile-select']);
        $tasks['profile-install-batch'] = st('Install site');
    }
    // Add tasks defined by the profile.
    if ($profile) {
        $function = $profile . '_profile_task_list';
        if (function_exists($function)) {
            $result = $function();
            if (is_array($result)) {
                $tasks += $result;
            }
        }
    }
    if (count($locales) < 2 || empty($_GET['locale']) || $_GET['locale'] == 'en') {
        // If not required, remove translation import from the task list.
        unset($tasks['locale-initial-batch']);
    } else {
        // If required, add remaining translations import task.
        $tasks += array('locale-remaining-batch' => st('Finish translations'));
    }
    // Add finished step as the last task.
    $tasks += array('finished' => st('Finished'));
    // Let the theming function know that 'finished' and 'done'
    // include everything, so every step is completed.
    if (in_array($active, array('finished', 'done'))) {
        $active = NULL;
    }
    drupal_add_region_content('left', theme_task_list($tasks, $active));
}
Ejemplo n.º 5
0
/**
 * Mess with the breadcrumb
 **/
function layoutstudio_preprocess_breadcrumb(&$vars)
{
    $layoutstudio_enable_breadcrumb = theme_get_setting('layoutstudio_enable_breadcrumb');
    $layoutstudio_breadcrumb_region = theme_get_setting('layoutstudio_breadcrumb_region');
    $layoutstudio_breadcrumb_region_placement = theme_get_setting('layoutstudio_breadcrumb_region_placement');
    if (!$layoutstudio_enable_breadcrumb) {
        $vars['breadcrumb'] = array();
        return;
    }
    // This doesnt work. need new idea.
    drupal_add_region_content($layoutstudio_breadcrumb_region, theme_breadcrumb($vars['breadcrumb']));
    // kill default breadcrumb
}