/** * Implements hook_form_system_theme_settings_alter() function. * * @param $form * Nested array of form elements that comprise the form. * @param $form_state * A keyed array containing the current state of the form. */ function rubik_form_system_theme_settings_alter(&$form, $form_state, $form_id = NULL) { // Work-around for a core bug affecting admin themes. See issue #943212. if (isset($form_id)) { return; } $form['rubik'] = array('#type' => 'fieldset', '#title' => t('Rubik')); $form['rubik']['rubik_show_branding'] = array('#type' => 'checkbox', '#title' => t('Show branding'), '#description' => t('Display the "branding" line at the top of the page with breadcrumbs and secondary menu.'), '#default_value' => theme_get_setting('rubik_show_branding', 'rubik')); $form['rubik']['rubik_inline_field_descriptions'] = array('#type' => 'checkbox', '#title' => t('Display form field descriptions inline.'), '#description' => t("By default, each field's description is displayed in a pop-up, which is only visible when hovering over that field. Select this option to make all field descriptions visible at all times."), '#default_value' => theme_get_setting('rubik_inline_field_descriptions', 'rubik')); $form['rubik']['rubik_disable_sticky_sidebar'] = array('#type' => 'checkbox', '#title' => t('Disable sticky sidebar'), '#description' => t("By default, the sidebar will fix itself when scrolling down a form. If you have a lot of fields in the sidebar, consider disabling the sticky sidebar to view them all."), '#default_value' => theme_get_setting('rubik_disable_sticky_sidebar', 'rubik')); $form['rubik']['rubik_disable_sidebar_in_form'] = array('#type' => 'checkbox', '#title' => t('Disable sidebar in forms'), '#description' => t("By default, the sidebar is enabled for forms."), '#default_value' => theme_get_setting('rubik_disable_sidebar_in_form', 'rubik')); $form['rubik']['rubik_sidebar_field_ui'] = array('#type' => 'checkbox', '#title' => t('Display fields in the sidebar of the node edit form.'), '#description' => t("By default, each field is displayed in the main content area of the node edit form. This option allows you to move fields into the sidebar to improve user experience."), '#default_value' => theme_get_setting('rubik_sidebar_field_ui', 'rubik'), '#states' => array('invisible' => array(':input[name="rubik_disable_sidebar_in_form"]' => array('checked' => TRUE)))); // If the sidebar is disabled, we need to disable the sidebar field ui as well. $rubik_disable_sidebar_in_form = theme_get_setting('rubik_disable_sidebar_in_form', 'rubik'); if ($rubik_disable_sidebar_in_form == 1) { $form['rubik']['rubik_sidebar_field_ui']['#default_value'] = 0; } // Rebuild theme registry on form save. if (!empty($form_state)) { // Rebuild .info data. system_rebuild_theme_data(); // Rebuild theme registry. drupal_theme_rebuild(); } }
require_once $theme_path . '/includes/theme.inc'; require_once $theme_path . '/includes/pager.inc'; require_once $theme_path . '/includes/form.inc'; require_once $theme_path . '/includes/admin.inc'; require_once $theme_path . '/includes/menu.inc'; // Load module specific files in the modules directory. $includes = file_scan_directory($theme_path . '/includes/modules', '/\\.inc$/'); foreach ($includes as $include) { if (module_exists($include->name)) { require_once $include->uri; } } // Auto-rebuild the theme registry during theme development. if (theme_get_setting('bootstrap_rebuild_registry') && !defined('MAINTENANCE_MODE')) { // Rebuild .info data. system_rebuild_theme_data(); // Rebuild theme registry. drupal_theme_rebuild(); } /** * hook_theme() */ function bootstrap_theme(&$existing, $type, $theme, $path) { // If we are auto-rebuilding the theme registry, warn about the feature. if (function_exists('user_access') && user_access('administer site configuration') && theme_get_setting('bootstrap_rebuild_registry') && (arg(0) == 'admin' || flood_is_allowed($GLOBALS['theme'] . '_rebuild_registry_warning', 3))) { flood_register_event($GLOBALS['theme'] . '_rebuild_registry_warning'); drupal_set_message(t('For easier theme development, the theme registry is being rebuilt on every page request. It is <em>extremely</em> important to <a href="!link">turn off this feature</a> on production websites.', array('!link' => url('admin/appearance/settings/' . $GLOBALS['theme']))), 'warning', FALSE); } return array('bootstrap_links' => array('variables' => array('links' => array(), 'attributes' => array(), 'heading' => NULL)), 'bootstrap_btn_dropdown' => array('variables' => array('links' => array(), 'attributes' => array(), 'type' => NULL))); }
/** * Tests updates with a hidden base theme. */ function testUpdateHiddenBaseTheme() { module_load_include('compare.inc', 'update'); // Enable the subtheme. theme_enable(array('update_test_subtheme')); // Add a project and initial state for base theme and subtheme. $system_info = array('update_test_basetheme' => array('project' => 'update_test_basetheme', 'hidden' => TRUE), 'update_test_subtheme' => array('project' => 'update_test_subtheme', 'hidden' => FALSE)); \Drupal::config('update_test.settings')->set('system_info', $system_info)->save(); $projects = update_get_projects(); $theme_data = system_rebuild_theme_data(); $project_info = new ProjectInfo(); $project_info->processInfoList($projects, $theme_data, 'theme', TRUE); $this->assertTrue(!empty($projects['update_test_basetheme']), 'Valid base theme (update_test_basetheme) was found.'); }
/** * Installation task; perform final steps and display a 'finished' page. * * @param $install_state * An array of information about the current installation state. * @return * A message informing the user that the installation is complete. */ function install_finished(&$install_state) { drupal_set_title(st('@drupal installation complete', array('@drupal' => drupal_install_profile_name())), PASS_THROUGH); $messages = drupal_set_message(); $output = '<p>' . st('Congratulations, @drupal has been successfully installed.', array('@drupal' => drupal_install_profile_name())) . '</p>'; $output .= '<p>' . (isset($messages['error']) ? st('Review the messages above before continuing on to <a href="@url">your new site</a>.', array('@url' => url(''))) : st('You may now visit <a href="@url">your new site</a>.', array('@url' => url('')))) . '</p>'; if (module_exists('help')) { $output .= '<p>' . st('For more information on configuring Drupal, refer to the <a href="@help">help section</a>.', array('@help' => url('admin/help'))) . '</p>'; } // Rebuild the module and theme data, in case any newly-installed modules // need to modify it via hook_system_info_alter(). We need to clear the // theme static cache first, to make sure that the theme data is actually // rebuilt. drupal_static_reset('_system_rebuild_theme_data'); system_rebuild_module_data(); system_rebuild_theme_data(); // Rebuild menu and registry to get content type links registered by the // profile, and possibly any other menu items created through the tasks. menu_rebuild(); // Rebuild the database cache of node types, so that any node types added // by newly installed modules are registered correctly and initialized with // the necessary fields. node_types_rebuild(); // Register actions declared by any modules. actions_synchronize(); // Randomize query-strings on css/js files, to hide the fact that this is a // new install, not upgraded yet. _drupal_flush_css_js(); // Remember the profile which was used. variable_set('install_profile', drupal_get_profile()); // Install profiles are always loaded last db_update('system')->fields(array('weight' => 1000))->condition('type', 'module')->condition('name', drupal_get_profile())->execute(); // Cache a fully-built schema. drupal_get_schema(NULL, TRUE); // Run cron to populate update status tables (if available) so that users // will be warned if they've installed an out of date Drupal version. // Will also trigger indexing of profile-supplied content or feeds. drupal_cron_run(); return $output; }
/** * Installation task; perform final steps and display a 'finished' page. * * @param $install_state * An array of information about the current installation state. * @return * A message informing the user that the installation is complete. */ function install_finished(&$install_state) { drupal_set_title(st('@drupal installation complete', array('@drupal' => drupal_install_profile_distribution_name())), PASS_THROUGH); $messages = drupal_set_message(); $output = '<p>' . st('Congratulations, you installed @drupal!', array('@drupal' => drupal_install_profile_distribution_name())) . '</p>'; $output .= '<p>' . (isset($messages['error']) ? st('Review the messages above before visiting <a href="@url">your new site</a>.', array('@url' => url(''))) : st('<a href="@url">Visit your new site</a>.', array('@url' => url('')))) . '</p>'; // Rebuild the module and theme data, in case any newly-installed modules // need to modify it via hook_system_info_alter(). We need to clear the // theme static cache first, to make sure that the theme data is actually // rebuilt. drupal_static_reset('_system_rebuild_theme_data'); system_rebuild_module_data(); system_rebuild_theme_data(); // Flush all caches to ensure that any full bootstraps during the installer // do not leave stale cached data, and that any content types or other items // registered by the install profile are registered correctly. drupal_flush_all_caches(); // Register actions declared by any modules. actions_synchronize(); // Remember the profile which was used. variable_set('install_profile', drupal_get_profile()); // Install profiles are always loaded last db_update('system')->fields(array('weight' => 1000))->condition('type', 'module')->condition('name', drupal_get_profile())->execute(); // Cache a fully-built schema. drupal_get_schema(NULL, TRUE); // Run cron to populate update status tables (if available) so that users // will be warned if they've installed an out of date Drupal version. // Will also trigger indexing of profile-supplied content or feeds. drupal_cron_run(); return $output; }
/** * Tests whether the correct theme metadata is returned. */ function testThemeMetaData() { // Generate the list of available themes. $themes = system_rebuild_theme_data(); // Check that the mtime field exists for the bartik theme. $this->assertTrue(!empty($themes['bartik']->info['mtime']), 'The bartik.info.yml file modification time field is present.'); // Use 0 if mtime isn't present, to avoid an array index notice. $test_mtime = !empty($themes['bartik']->info['mtime']) ? $themes['bartik']->info['mtime'] : 0; // Ensure the mtime field contains a number that is greater than zero. $this->assertTrue(is_numeric($test_mtime) && $test_mtime > 0, 'The bartik.info.yml file modification time field contains a timestamp.'); }
/** * {@inheritdoc} */ public function getProjects() { if (empty($this->projects)) { // Retrieve the projects from storage, if present. $this->projects = $this->projectStorage('update_project_projects'); if (empty($this->projects)) { // Still empty, so we have to rebuild. $module_data = system_rebuild_module_data(); $theme_data = system_rebuild_theme_data(); $project_info = new ProjectInfo(); $project_info->processInfoList($this->projects, $module_data, 'module', TRUE); $project_info->processInfoList($this->projects, $theme_data, 'theme', TRUE); if ($this->updateSettings->get('check.disabled_extensions')) { $project_info->processInfoList($this->projects, $module_data, 'module', FALSE); $project_info->processInfoList($this->projects, $theme_data, 'theme', FALSE); } // Allow other modules to alter projects before fetching and comparing. $this->moduleHandler->alter('update_projects', $this->projects); // Store the site's project data for at most 1 hour. $this->keyValueStore->setWithExpire('update_project_projects', $this->projects, 3600); } } return $this->projects; }
/** * Overrides Drupal\Core\Updater\Updater::postInstall(). */ public function postInstall() { // Update the theme info. clearstatcache(); system_rebuild_theme_data(); }