Serializes #contextual_links property value array to a string.
Examples:
So, expressed in a pattern: <module name>:<parent path>:<path args>:<options>
The (dynamic) path args are joined with slashes. The options are encoded as a query string.
array $contextual_links: The $element['#contextual_links'] value for some render element.
string A serialized representation of a #contextual_links property value array for use in a data- attribute.
function _contextual_links_to_id($contextual_links) {
$id = '';
foreach ($contextual_links as $module => $args) {
$parent_path = $args[0];
$path_args = implode('/', $args[1]);
$metadata = drupal_http_build_query(isset($args[2]) ? $args[2] : array());
if (drupal_strlen($id) > 0) {
$id .= '|';
}
$id .= $module . ':' . $parent_path . ':' . $path_args . ':' . $metadata;
}
return $id;
}