You are here

function page_title_get_settings in Page Title 7.2

Same name and namespace in other branches
  1. 8.2 page_title.module \page_title_get_settings()
  2. 6.2 page_title.module \page_title_get_settings()

Get the Page Title Setttings

8 calls to page_title_get_settings()
page_title_admin_settings in ./page_title.admin.inc
Displays the form for the standard settings tab.
page_title_node_load in ./page_title.module
Implement hook_node_load().
page_title_node_type_form_submit in ./page_title.module
Submit handler for the node_type_form element added in the hook_form_FORM_ID_alter() above.
page_title_page_get_title in ./page_title.module
Determines what title should be sent to the page template.
page_title_page_title_pattern_alter in modules/page_title.page_title.inc
Implements hook_page_title_pattern_alter().

... See full list

File

./page_title.module, line 813
Enhanced control over the page title (in the head tag).

Code

function page_title_get_settings($flush = FALSE) {
  static $settings = NULL;

  // Flush the settings, if set.
  if ($flush) {
    $settings = NULL;
    cache_clear_all('page_title:settings', 'cache');
  }

  // If we have it statically cached, return it.
  if (!empty($settings)) {
    return $settings;
  }

  // Get from the cache, if present
  if ($cache = cache_get('page_title:settings')) {
    $settings = $cache->data;
    return $cache->data;
  }

  // We run this here as there are edge cases where it seems hook_init() and
  // cache clearing intefere with each other, casuing INC files to not be included
  // See: http://drupal.org/node/1567790
  page_title_include_api_files();

  // Get the settings from hook_page_title_settings().
  $settings = module_invoke_all('page_title_settings');

  // For each setting, apply a "default" mask (this makes it easier to use
  // later as we can assume presence).
  foreach ($settings as $k => $v) {
    $settings[$k] = (array) $v + array(
      'label' => '',
      'label arguments' => array(),
      'required' => FALSE,
      'show field' => FALSE,
      'description' => '',
      'description arguments' => array(),
      'weight' => 0,
      'default' => '',
    );
  }

  // Now sort
  uasort($settings, '_page_title_settings_sort');

  // Cache this so we dont have to do this EVERY time
  cache_set('page_title:settings', $settings);
  return $settings;
}