### Standard Source File License Notice Source: https://github.com/drupalprojects/metatag/blob/7.x-1.x/LICENSE.txt Attach this notice to the start of each source file to convey warranty exclusion and license terms. ```text one line to give the program's name and an idea of what it does. Copyright (C) yyyy name of author This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ``` -------------------------------- ### Interactive Program License Notice Source: https://github.com/drupalprojects/metatag/blob/7.x-1.x/LICENSE.txt Display this notice when an interactive program starts to inform users about warranty and license details. ```text Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. ``` -------------------------------- ### Get Processed Meta Tag Values Source: https://context7.com/drupalprojects/metatag/llms.txt Returns processed string values of meta tags, useful for debugging or external use. Tokens are replaced with their actual values. ```php array( 'title' => array('value' => '[node:title] | [site:name]'), 'description' => array('value' => '[node:summary]'), ), ); $options = array( 'language' => 'en', 'token data' => array('node' => node_load(123)), ); $values = metatag_metatags_values($instance, $metatags, $options); // Returns: array('title' => 'Processed Title | Site Name', 'description' => 'Processed description') ``` -------------------------------- ### Get Processed Meta Tag Values Source: https://context7.com/drupalprojects/metatag/llms.txt Retrieves the processed string values of meta tags, useful for debugging or external use. ```APIDOC ## metatag_metatags_values ### Description Returns processed string values of meta tags (useful for debugging or external use). ### Usage ```php $instance = 'node:article'; $metatags = array( 'en' => array( 'title' => array('value' => '[node:title] | [site:name]'), 'description' => array('value' => '[node:summary]'), ), ); $options = array( 'language' => 'en', 'token data' => array('node' => node_load(123)), ); $values = metatag_metatags_values($instance, $metatags, $options); // Returns: array('title' => 'Processed Title | Site Name', 'description' => 'Processed description') ``` ``` -------------------------------- ### View Meta Tags from Configuration Source: https://context7.com/drupalprojects/metatag/llms.txt Builds a renderable array of meta tag output from a configuration instance and provided data. Useful for rendering meta tags in custom contexts. ```php array( 'title' => array('value' => 'Custom Title'), 'description' => array('value' => 'Custom description with [node:title] token.'), ), ); $options = array( 'language' => 'en', 'token data' => array( 'node' => node_load(123), ), ); $output = metatag_metatags_view($instance, $metatags, $options); // Output ready for drupal_render() or adding to page['content'] ``` -------------------------------- ### Load Metatag Configurations Source: https://context7.com/drupalprojects/metatag/llms.txt Retrieves single or multiple configuration records from the database. ```php instance; // 'node:article' $api_version = $config->api_version; // 1 $settings = $config->config; // array of meta tag settings } // Load multiple configurations at once $instances = array('global', 'node', 'node:article'); $configs = metatag_config_load_multiple($instances); foreach ($configs as $instance => $config) { // Process each configuration drupal_set_message("Loaded config for: $instance"); } ``` -------------------------------- ### Load Metatag Configuration with Defaults Source: https://context7.com/drupalprojects/metatag/llms.txt Retrieves a configuration record with parent defaults merged. Optionally disable global defaults by passing FALSE as the second argument. ```php array('value' => '[node:title] | [site:name]'), // 'description' => array('value' => '[node:summary]'), // 'canonical' => array('value' => '[current-page:url:absolute]'), // ) ``` -------------------------------- ### Extend Meta Tag Classes Source: https://context7.com/drupalprojects/metatag/llms.txt Demonstrates creating custom meta tag classes by extending base classes to override rendering logic or form generation. ```php info['element']) ? $this->info['element'] : array(); $value = $this->getValue($options); if (strlen($value) === 0) { return array(); } $element += array( '#theme' => 'metatag_property', '#tag' => 'meta', '#id' => 'metatag_' . $this->info['name'], '#name' => $this->info['name'], '#value' => $value, '#weight' => $this->getWeight(), ); return array( '#attached' => array( 'drupal_add_html_head' => array(array($element, $element['#id'])), ), ); } } /** * Custom meta tag with select dropdown and custom validation. */ class MyModuleSelectMetaTag extends DrupalTextMetaTag { /** * {@inheritdoc} */ public function getForm(array $options = array()) { $form = parent::getForm($options); $form['value']['#type'] = 'select'; $form['value']['#options'] = array( '' => t('- None -'), 'value1' => t('Value 1'), 'value2' => t('Value 2'), 'value3' => t('Value 3'), ); return $form; } /** * {@inheritdoc} */ public function getValue(array $options = array()) { $value = parent::getValue($options); // Custom processing if ($value === 'value1') { $value = 'processed_value_1'; } return $value; } } ``` -------------------------------- ### Define Windows Meta Tags Source: https://github.com/drupalprojects/metatag/blob/7.x-1.x/metatag_mobile/README.txt Meta tags for Windows application and browser configuration. ```html ``` -------------------------------- ### Set Default Configurations with hook_metatag_config_default Source: https://context7.com/drupalprojects/metatag/llms.txt Implements hook_metatag_config_default to provide default meta tag values for specific instances like nodes or content types. ```php instance = 'node'; $config->api_version = 1; $config->disabled = FALSE; $config->config = array( 'mymodule_custom' => array('value' => '[node:title] - Custom'), 'mymodule_image' => array('value' => '[node:field_image]'), ); $configs[$config->instance] = $config; // Default for a specific content type $config = new stdClass(); $config->instance = 'node:product'; $config->api_version = 1; $config->disabled = FALSE; $config->config = array( 'mymodule_custom' => array('value' => 'Product: [node:title]'), 'mymodule_options' => array('value' => array('option1' => 'option1')), ); $configs[$config->instance] = $config; return $configs; } ``` -------------------------------- ### Configure Search API for Meta Tags Source: https://github.com/drupalprojects/metatag/blob/7.x-1.x/README.txt Paths for enabling meta tag indexing within the Search API module configuration. ```text admin/config/search/search_api/index/INDEX NAME/workflow ``` ```text admin/config/search/search_api/index/INDEX NAME/fields ``` -------------------------------- ### Generate and Render Meta Tags Source: https://context7.com/drupalprojects/metatag/llms.txt Functions for generating renderable arrays of meta tags for entities and for building meta tag output from configuration. ```APIDOC ## metatag_generate_entity_metatags / metatags_get_entity_metatags ### Description Generates the renderable array of meta tags for an entity. ### Usage ```php // Generate meta tags for a node entity $node = node_load(123); $langcode = 'en'; $view_mode = 'full'; $output = metatag_generate_entity_metatags($node, 'node', $langcode, $view_mode); // Returns renderable array ready for drupal_render() // Alternative: Load and generate by entity ID $entity_id = 123; $entity_type = 'node'; $metatags = metatags_get_entity_metatags($entity_id, $entity_type, $langcode); // Disable caching for dynamic content $output = metatag_generate_entity_metatags($node, 'node', $langcode, $view_mode, FALSE); ``` ## metatag_metatags_view ### Description Builds a renderable array of meta tag output from configuration instance and data. ### Usage ```php // Build meta tags for a specific instance $instance = 'node:article'; $metatags = array( 'en' => array( 'title' => array('value' => 'Custom Title'), 'description' => array('value' => 'Custom description with [node:title] token.'), ), ); $options = array( 'language' => 'en', 'token data' => array( 'node' => node_load(123), ), ); $output = metatag_metatags_view($instance, $metatags, $options); // Output ready for drupal_render() or adding to page['content'] ``` ``` -------------------------------- ### Entity Support Configuration Source: https://context7.com/drupalprojects/metatag/llms.txt Functions to check, enable, or disable meta tag support for entity types and bundles. ```APIDOC ## metatag_entity_supports_metatags ### Description Checks whether an entity type and/or bundle supports meta tags. ### Usage ```php // Check if node entity type supports metatags if (metatag_entity_supports_metatags('node')) { drupal_set_message('Nodes support meta tags'); } // Check if a specific bundle supports metatags if (metatag_entity_supports_metatags('node', 'article')) { drupal_set_message('Article content type supports meta tags'); } // Get all supported entity types and bundles $supported = metatag_entity_supports_metatags(); // Returns: array('node' => array('article' => TRUE, 'page' => TRUE), 'user' => array(...)) ``` ## metatag_entity_type_enable / metatag_entity_type_disable ### Description Enables or disables meta tag support for entity types and bundles. ### Usage ```php // Enable meta tags for a custom entity type metatag_entity_type_enable('my_entity'); // Enable for a specific bundle metatag_entity_type_enable('node', 'my_content_type'); // Force enable even if previously disabled metatag_entity_type_enable('node', 'my_content_type', TRUE); // Disable meta tags for an entity type metatag_entity_type_disable('my_entity'); // Disable for a specific bundle only metatag_entity_type_disable('node', 'my_content_type'); ``` ``` -------------------------------- ### Configuration Management API Source: https://context7.com/drupalprojects/metatag/llms.txt Functions for loading, saving, and deleting metatag configuration records. ```APIDOC ## metatag_config_load_with_defaults ### Description Loads a metatag configuration record with all parent defaults merged in. For example, 'node:article' will merge configurations from 'node:article', 'node', and 'global' instances. ### Method `metatag_config_load_with_defaults(string $instance, bool $merge_global = TRUE) ### Parameters #### Path Parameters - **instance** (string) - Required - The configuration instance identifier (e.g., 'node:article'). - **merge_global** (bool) - Optional - Whether to merge global defaults. Defaults to TRUE. ### Request Example ```php // Load configuration for article content type with all defaults merged $instance = 'node:article'; $config = metatag_config_load_with_defaults($instance); // Load without global defaults $config_no_global = metatag_config_load_with_defaults($instance, FALSE); ``` ### Response #### Success Response (200) - **config** (array) - An array of meta tag settings, with parent defaults merged. #### Response Example ```json { "title": {"value": "[node:title] | [site:name]"}, "description": {"value": "[node:summary]"}, "canonical": {"value": "[current-page:url:absolute]"} } ``` ## metatag_config_load / metatag_config_load_multiple ### Description Loads a single metatag configuration record or multiple records from the database. ### Method `metatag_config_load(string $instance) `metatag_config_load_multiple(array $instances) ### Parameters #### Path Parameters - **instance** (string) - Required - The configuration instance identifier for `metatag_config_load`. - **instances** (array) - Required - An array of configuration instance identifiers for `metatag_config_load_multiple`. ### Request Example ```php // Load a single configuration $config = metatag_config_load('node:article'); if ($config) { $instance = $config->instance; // 'node:article' $api_version = $config->api_version; // 1 $settings = $config->config; // array of meta tag settings } // Load multiple configurations at once $instances = array('global', 'node', 'node:article'); $configs = metatag_config_load_multiple($instances); foreach ($configs as $instance => $config) { // Process each configuration drupal_set_message("Loaded config for: $instance"); } ``` ### Response #### Success Response (200) - **config** (object) - A configuration object for `metatag_config_load`. - **configs** (array) - An array of configuration objects keyed by instance for `metatag_config_load_multiple`. ## metatag_config_save / metatag_config_delete ### Description Saves or deletes a metatag configuration record. ### Method `metatag_config_save(object $config) `metatag_config_delete(object $config) ### Parameters #### Request Body - **config** (object) - Required - The configuration object to save or delete. Must include `instance`, `api_version`, and `config` properties. ### Request Example ```php // Create a new configuration $config = new stdClass(); $config->instance = 'node:blog'; $config->api_version = 1; $config->disabled = FALSE; $config->config = array( 'title' => array('value' => '[node:title] | Blog | [site:name]'), 'description' => array('value' => '[node:summary]'), 'robots' => array('value' => array('index' => 'index', 'follow' => 'follow')), ); metatag_config_save($config); // Delete a configuration $config = metatag_config_load('node:blog'); if ($config) { metatag_config_delete($config); } ``` ``` -------------------------------- ### Employer Copyright Disclaimer Source: https://github.com/drupalprojects/metatag/blob/7.x-1.x/LICENSE.txt Use this template to obtain a formal copyright disclaimer from an employer or school if necessary. ```text Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. signature of Ty Coon, 1 April 1989 Ty Coon, President of Vice ``` -------------------------------- ### Render Meta Tags in Template Files Source: https://github.com/drupalprojects/metatag/blob/7.x-1.x/README.txt Required code snippets for custom page templates to ensure meta tags are rendered. ```php ``` ```php ``` -------------------------------- ### Define Android Meta Tags Source: https://github.com/drupalprojects/metatag/blob/7.x-1.x/metatag_mobile/README.txt Link tags for Android application manifests and deep linking. ```html ``` -------------------------------- ### Define iOS Meta Tags Source: https://github.com/drupalprojects/metatag/blob/7.x-1.x/metatag_mobile/README.txt Meta tags and link tags specific to iOS device configuration. ```html ``` -------------------------------- ### Save and Delete Metatag Configurations Source: https://context7.com/drupalprojects/metatag/llms.txt Manages the persistence of configuration records by saving or removing them from the database. ```php instance = 'node:blog'; $config->api_version = 1; $config->disabled = FALSE; $config->config = array( 'title' => array('value' => '[node:title] | Blog | [site:name]'), 'description' => array('value' => '[node:summary]'), 'robots' => array('value' => array('index' => 'index', 'follow' => 'follow')), ); metatag_config_save($config); // Delete a configuration $config = metatag_config_load('node:blog'); if ($config) { metatag_config_delete($config); } ``` -------------------------------- ### hook_metatag_info Source: https://context7.com/drupalprojects/metatag/llms.txt Implement this hook to define new meta tags and groups for the Metatag module. You can specify labels, descriptions, form elements, and other properties for each meta tag. ```APIDOC ## hook_metatag_info ### Description Defines new meta tags and groups via hook implementation. ### Method HOOK ### Endpoint N/A ### Parameters None ### Request Example ```php t('My Module Tags'), 'description' => t('Custom meta tags provided by My Module.'), 'form' => array( '#weight' => 50, ), ); // Define a simple text meta tag $info['tags']['mymodule_custom'] = array( 'label' => t('Custom Tag'), 'description' => t('A custom meta tag for special purposes.'), 'class' => 'DrupalTextMetaTag', 'group' => 'mymodule', 'weight' => 1, 'maxlength' => 255, ); // Define an image meta tag $info['tags']['mymodule_image'] = array( 'label' => t('Custom Image'), 'description' => t('An image for custom purposes.'), 'class' => 'DrupalTextMetaTag', 'group' => 'mymodule', 'weight' => 2, 'image' => TRUE, // Enable image URL extraction 'url' => TRUE, // Convert to absolute URL ); // Define a list/checkbox meta tag $info['tags']['mymodule_options'] = array( 'label' => t('Custom Options'), 'description' => t('Select applicable options.'), 'class' => 'DrupalListMetaTag', 'group' => 'mymodule', 'weight' => 3, 'form' => array( '#options' => array( 'option1' => t('Option 1'), 'option2' => t('Option 2'), 'option3' => t('Option 3'), ), ), ); // Define a link rel meta tag $info['tags']['mymodule_link'] = array( 'label' => t('Custom Link'), 'description' => t('A custom link relation.'), 'class' => 'DrupalLinkMetaTag', 'group' => 'mymodule', 'weight' => 4, ); return $info; } ``` ### Response #### Success Response (200) Returns an array defining meta tag groups and individual meta tags. #### Response Example ```json { "groups": { "mymodule": { "label": "My Module Tags", "description": "Custom meta tags provided by My Module.", "form": { "#weight": 50 } } }, "tags": { "mymodule_custom": { "label": "Custom Tag", "description": "A custom meta tag for special purposes.", "class": "DrupalTextMetaTag", "group": "mymodule", "weight": 1, "maxlength": 255 }, "mymodule_image": { "label": "Custom Image", "description": "An image for custom purposes.", "class": "DrupalTextMetaTag", "group": "mymodule", "weight": 2, "image": true, "url": true }, "mymodule_options": { "label": "Custom Options", "description": "Select applicable options.", "class": "DrupalListMetaTag", "group": "mymodule", "weight": 3, "form": { "#options": { "option1": "Option 1", "option2": "Option 2", "option3": "Option 3" } } }, "mymodule_link": { "label": "Custom Link", "description": "A custom link relation.", "class": "DrupalLinkMetaTag", "group": "mymodule", "weight": 4 } } } ``` ``` -------------------------------- ### Load Entity Meta Tags Source: https://context7.com/drupalprojects/metatag/llms.txt Retrieves meta tags associated with specific entities, supporting revision lookups and batch loading. ```php array('title' => array('value' => '...'))) // Load with specific revision $revision_id = 456; $metatags = metatag_metatags_load($entity_type, $entity_id, $revision_id); // Load meta tags for multiple entities $entity_ids = array(123, 124, 125); $revision_ids = array(456, 457, 458); $all_metatags = metatag_metatags_load_multiple($entity_type, $entity_ids, $revision_ids); // Returns nested array: array(entity_id => array(revision_id => array(langcode => metatags))) ``` -------------------------------- ### hook_metatag_config_default Source: https://context7.com/drupalprojects/metatag/llms.txt Implement this hook to provide default configuration values for meta tags on different instances (e.g., nodes, specific content types). ```APIDOC ## hook_metatag_config_default ### Description Provides default configuration for meta tag instances. ### Method HOOK ### Endpoint N/A ### Parameters None ### Request Example ```php instance = 'node'; $config->api_version = 1; $config->disabled = FALSE; $config->config = array( 'mymodule_custom' => array('value' => '[node:title] - Custom'), 'mymodule_image' => array('value' => '[node:field_image]'), ); $configs[$config->instance] = $config; // Default for a specific content type $config = new stdClass(); $config->instance = 'node:product'; $config->api_version = 1; $config->disabled = FALSE; $config->config = array( 'mymodule_custom' => array('value' => 'Product: [node:title]'), 'mymodule_options' => array('value' => array('option1' => 'option1')), ); $configs[$config->instance] = $config; return $configs; } ``` ### Response #### Success Response (200) Returns an array of default meta tag configurations keyed by instance. #### Response Example ```json { "node": { "instance": "node", "api_version": 1, "disabled": false, "config": { "mymodule_custom": { "value": "[node:title] - Custom" }, "mymodule_image": { "value": "[node:field_image]" } } }, "node:product": { "instance": "node:product", "api_version": 1, "disabled": false, "config": { "mymodule_custom": { "value": "Product: [node:title]" }, "mymodule_options": { "value": { "option1": "option1" } } } } } ``` ``` -------------------------------- ### Check Entity Support for Metatags Source: https://context7.com/drupalprojects/metatag/llms.txt Checks if an entity type or a specific bundle supports meta tags. Can also retrieve all supported entity types and bundles. ```php array('article' => TRUE, 'page' => TRUE), 'user' => array(...)) ``` -------------------------------- ### Configure HTML Itemtype Source: https://github.com/drupalprojects/metatag/blob/7.x-1.x/metatag_google_plus/README.txt Add the itemscope and itemtype attributes to the HTML tag to support Google+ schema markup. ```html ``` -------------------------------- ### Define Meta Tags with hook_metatag_info Source: https://context7.com/drupalprojects/metatag/llms.txt Implements hook_metatag_info to register custom meta tag groups and various tag types including text, image, list, and link relations. ```php t('My Module Tags'), 'description' => t('Custom meta tags provided by My Module.'), 'form' => array( '#weight' => 50, ), ); // Define a simple text meta tag $info['tags']['mymodule_custom'] = array( 'label' => t('Custom Tag'), 'description' => t('A custom meta tag for special purposes.'), 'class' => 'DrupalTextMetaTag', 'group' => 'mymodule', 'weight' => 1, 'maxlength' => 255, ); // Define an image meta tag $info['tags']['mymodule_image'] = array( 'label' => t('Custom Image'), 'description' => t('An image for custom purposes.'), 'class' => 'DrupalTextMetaTag', 'group' => 'mymodule', 'weight' => 2, 'image' => TRUE, // Enable image URL extraction 'url' => TRUE, // Convert to absolute URL ); // Define a list/checkbox meta tag $info['tags']['mymodule_options'] = array( 'label' => t('Custom Options'), 'description' => t('Select applicable options.'), 'class' => 'DrupalListMetaTag', 'group' => 'mymodule', 'weight' => 3, 'form' => array( '#options' => array( 'option1' => t('Option 1'), 'option2' => t('Option 2'), 'option3' => t('Option 3'), ), ), ); // Define a link rel meta tag $info['tags']['mymodule_link'] = array( 'label' => t('Custom Link'), 'description' => t('A custom link relation.'), 'class' => 'DrupalLinkMetaTag', 'group' => 'mymodule', 'weight' => 4, ); return $info; } ``` -------------------------------- ### Define Mobile Meta Tags Source: https://github.com/drupalprojects/metatag/blob/7.x-1.x/metatag_mobile/README.txt Standard meta tags used for mobile device experience tailoring. ```html ``` -------------------------------- ### Image Token Usage for Meta Tags Source: https://github.com/drupalprojects/metatag/blob/7.x-1.x/README.txt Tokens for referencing image fields with specific image styles to optimize meta tag image sizes. ```text [node:field_meta_tag_image:seo_thumbnail:uri] ``` ```text [node:field_meta_tag_image:seo_thumbnail] ``` ```text [node:field_meta_tag_image:seo_thumbnail:width] ``` ```text [node:field_meta_tag_image:seo_thumbnail:height] ``` -------------------------------- ### Retrieve Entity Meta Tags Programmatically Source: https://github.com/drupalprojects/metatag/blob/7.x-1.x/README.txt Function call to fetch meta tags for a specific entity. ```php $metatags = metatags_get_entity_metatags($entity_id, $entity_type, $langcode); ``` -------------------------------- ### Save Entity Meta Tags Source: https://context7.com/drupalprojects/metatag/llms.txt Persists meta tag data for an entity, supporting language-specific configurations. ```php array( 'title' => array('value' => 'My Custom Page Title | [site:name]'), 'description' => array('value' => 'A detailed description of this content.'), 'keywords' => array('value' => 'drupal, metatag, seo'), 'robots' => array('value' => array('index' => 'index', 'follow' => 'follow')), ), ); metatag_metatags_save($entity_type, $entity_id, $revision_id, $metatags, $bundle); // Save with specific language $metatags = array( 'en' => array( 'title' => array('value' => 'English Title'), 'description' => array('value' => 'English description.'), ), 'es' => array( 'title' => array('value' => 'Título en Español'), 'description' => array('value' => 'Descripción en español.'), ), ); metatag_metatags_save($entity_type, $entity_id, $revision_id, $metatags, $bundle); ``` -------------------------------- ### Enable/Disable Entity Meta Tag Support Source: https://context7.com/drupalprojects/metatag/llms.txt Enables or disables meta tag support for entity types and bundles. Can force enable even if previously disabled. ```php info['element']) ? $this->info['element'] : array(); $value = $this->getValue($options); if (strlen($value) === 0) { return array(); } $element += array( '#theme' => 'metatag_property', '#tag' => 'meta', '#id' => 'metatag_' . $this->info['name'], '#name' => $this->info['name'], '#value' => $value, '#weight' => $this->getWeight(), ); return array( '#attached' => array( 'drupal_add_html_head' => array(array($element, $element['#id'])), ), ); } } /** * Custom meta tag with select dropdown and custom validation. */ class MyModuleSelectMetaTag extends DrupalTextMetaTag { /** * {@inheritdoc} */ public function getForm(array $options = array()) { $form = parent::getForm($options); $form['value']['#type'] = 'select'; $form['value']['#options'] = array( '' => t('- None -'), 'value1' => t('Value 1'), 'value2' => t('Value 2'), 'value3' => t('Value 3'), ); return $form; } /** * {@inheritdoc} */ public function getValue(array $options = array()) { $value = parent::getValue($options); // Custom processing if ($value === 'value1') { $value = 'processed_value_1'; } return $value; } } ``` ### Response #### Success Response (200) N/A (This describes class structure, not an API endpoint) #### Response Example N/A ``` -------------------------------- ### Generate Entity Meta Tags Source: https://context7.com/drupalprojects/metatag/llms.txt Generate a renderable array of meta tags for an entity. Caching can be disabled for dynamic content by passing FALSE as the last argument. ```php tag in your theme's html.tpl.php file after the $rdf_namespaces variable. ```php > ``` -------------------------------- ### Retrieve and Process Meta Tag Data Source: https://context7.com/drupalprojects/metatag/llms.txt Utility functions for accessing meta tag definitions, creating instances, and processing values with token support. ```php 'My page description'); $instance = metatag_get_instance($metatag, $data); // Get the processed value $options = array( 'token data' => array('node' => node_load(123)), ); $value = metatag_get_value('description', $data, $options); // Returns processed string with tokens replaced // Get raw value without token replacement $options['raw'] = TRUE; $raw_value = metatag_get_value('description', $data, $options); ``` -------------------------------- ### Clear Metatag caches Source: https://context7.com/drupalprojects/metatag/llms.txt Use these functions to programmatically clear Metatag configuration or entity-specific caches. ```php array('value' => 'Welcome'), 'description' => array('value' => 'Our description'), ); $context = 'metatag_config:node:article'; metatag_translate_metatags($metatags, $context, $langcode); // Update translation definitions $metatags = array( 'title' => array('value' => 'Updated Title'), 'description' => array('value' => 'Updated description'), ); $context = 'metatag_config:global'; metatag_translations_update($metatags, $context); ```