You are here

function hook_metatag_config_default in Metatag 7

Provides a default configuration for Metatag intances.

This hook allows modules to provide their own Metatag instances which can either be used as-is or as a "starter" for users to build from.

This hook should be placed in MODULENAME.metatag.inc and it will be auto- loaded. MODULENAME.metatag.inc *must* be in the same directory as the .module file which *must* also contain an implementation of hook_ctools_plugin_api, preferably with the same code as found in metatag_ctools_plugin_api().

The $config->disabled boolean attribute indicates whether the Metatag instance should be enabled (FALSE) or disabled (TRUE) by default.

Return value

array An associative array containing the structures of Metatag instances, as generated from the Export tab, keyed by the Metatag config name.

See also

metatag_metatag_config_default()

metatag_ctools_plugin_api()

3 functions implement hook_metatag_config_default()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

metatag_metatag_config_default in ./metatag.metatag.inc
Implements hook_metatag_config_default().
metatag_test_metatag_config_default in tests/metatag_test.metatag.inc
Implements hook_metatag_config_default().
metatag_views_metatag_config_default in metatag_views/metatag_views.metatag.inc
Implements hook_metatag_config_default().

File

./metatag.api.php, line 30
API documentation for the Metatag module.

Code

function hook_metatag_config_default() {
  $configs = array();
  $config = new stdClass();
  $config->instance = 'config1';
  $config->api_version = 1;
  $config->disabled = FALSE;
  $config->config = array(
    'title' => array(
      'value' => '[current-page:title] | [site:name]',
    ),
    'generator' => array(
      'value' => 'Drupal 7 (https://www.drupal.org)',
    ),
    'canonical' => array(
      'value' => '[current-page:url:absolute]',
    ),
    'shortlink' => array(
      'value' => '[current-page:url:unaliased]',
    ),
  );
  $configs[$config->instance] = $config;
  $config = new stdClass();
  $config->instance = 'config2';
  $config->api_version = 1;
  $config->disabled = FALSE;
  $config->config = array(
    'title' => array(
      'value' => '[user:name] | [site:name]',
    ),
  );
  $configs[$config->instance] = $config;
  return $configs;
}