function quickedit_preprocess_panelizer_view_mode in Quick Edit 7
Implements hook_preprocess_panelizer_view_mode().
Sets data-quickedit-entity-id attribute in case of a panelized, non-full-page entity view.
See also
quickedit_ctools_render_alter()
File
- includes/
panelizer.inc, line 63 - Implements Quick Edit module hooks on behalf of panelizer.module.
Code
function quickedit_preprocess_panelizer_view_mode(&$variables) {
$entity_type = $variables['element']['#entity_type'];
$entity = $variables['element']['#' . $entity_type];
$entity_id = entity_id($entity_type, $entity);
// Set data-quickedit-entity-id attribute.
$variables['attributes_array']['data-quickedit-entity-id'] = $entity_type . '/' . $entity_id;
// If the entity has a title, set data-quickedit-field-id attribute.
if (!empty($entity->title)) {
$language = !empty($entity->language) ? $entity->language : LANGUAGE_NONE;
$view_mode = _panelizer_generate_quickedit_viewmode($entity);
$variables['title_attributes_array']['data-quickedit-field-id'] = "{$entity_type}/{$entity_id}/title/{$language}/{$view_mode}";
}
}