function contextual_pre_render_placeholder

Pre-render callback: Renders a contextual links placeholder into #markup.

Renders an empty (hence invisible) placeholder div with a data-attribute that contains an identifier ("contextual id"), which allows the JavaScript of the drupal.contextual-links library to dynamically render contextual links.

Parameters

$element: A structured array with #id containing a "contextual id".

Return value

The passed-in element with a contextual link placeholder in '#markup'.

See also

_contextual_links_to_id()

contextual_element_info()

1 string reference to 'contextual_pre_render_placeholder'
contextual_element_info in drupal/core/modules/contextual/contextual.module
Implements hook_element_info().

File

drupal/core/modules/contextual/contextual.module, line 226
Adds contextual links to perform actions related to elements on a page.

Code

function contextual_pre_render_placeholder($element) {
  $element['#markup'] = '<div data-contextual-id="' . $element['#id'] . '"></div>';
  return $element;
}