function _contextual_links_to_id

Same name and namespace in other branches
  1. 11.x core/modules/contextual/contextual.module \_contextual_links_to_id()
  2. 10 core/modules/contextual/contextual.module \_contextual_links_to_id()
  3. 9 core/modules/contextual/contextual.module \_contextual_links_to_id()
  4. 8.9.x core/modules/contextual/contextual.module \_contextual_links_to_id()

Serializes #contextual_links property value array to a string.

Examples:

  • node:node=1:langcode=en
  • views_ui_edit:view=frontpage:location=page&view_name=frontpage&view_display_id=page_1&langcode=en
  • menu:menu=tools:langcode=en|block:block=olivero.tools:langcode=en

So, expressed in a pattern: <group>:<route parameters>:<metadata>

The route parameters and options are encoded as query strings.

Parameters

array $contextual_links: The $element['#contextual_links'] value for some render element.

Return value

string A serialized representation of a #contextual_links property value array for use in a data- attribute.

Deprecated

in drupal:11.4.0 and is removed from drupal:12.0.0. Use \Drupal\contextual\ContextualLinksSerializer::linksToId() instead.

See also

https://www.drupal.org/node/3568088

File

core/modules/contextual/contextual.module, line 34

Code

function _contextual_links_to_id($contextual_links) {
  @trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.4.0 and is removed from drupal:12.0.0. Use \\Drupal\\contextual\\ContextualLinksSerializer::linksToId() instead. See https://www.drupal.org/node/3568088', E_USER_DEPRECATED);
  return \Drupal::service(ContextualLinksSerializer::class)->linksToId($contextual_links);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.