function fape_panels_pane_content_alter in Field API Pane Editor (FAPE) 7
Implement hook_panels_pane_content_alter().
This adds the contextual link to the entity field pane.
File
- ./
fape.module, line 489 - Adds direct field editing via contextual links.
Code
function fape_panels_pane_content_alter($content, $pane, $args, $context) {
// Don't bother with empty panes.
if (empty($content->content)) {
return;
}
// Verify access to the field.
if ($pane->type == 'entity_field') {
list($entity_type, $field_name) = explode(':', $pane->subtype);
$plugin = ctools_get_content_type($pane->type);
$entity = ctools_content_select_context($plugin, $pane->subtype, $pane->configuration, $context)->data;
if (entity_access('update', $entity_type, $entity)) {
$field = field_info_field($field_name);
if (field_access('edit', $field, $entity_type, $entity)) {
list($entity_id, , ) = entity_extract_ids($entity_type, $entity);
$content->admin_links[] = array(
'title' => t('Edit field'),
'alt' => t('Edit the data in this field.'),
'href' => "admin/field/edit/{$entity_type}/{$entity_id}/{$field_name}",
'query' => drupal_get_destination(),
);
}
}
}
elseif (in_array($pane->type, array(
'node_title',
'node_author',
'node_created',
))) {
$plugin = ctools_get_content_type($pane->type);
$entity = ctools_content_select_context($plugin, $pane->subtype, $pane->configuration, $context)->data;
if (node_access('update', $entity)) {
list($ignore, $field_name) = explode('_', $pane->type);
$content->admin_links[] = array(
'title' => t('Edit field'),
'alt' => t('Edit the data in this field.'),
'href' => "admin/field/edit/node/{$entity->nid}/{$field_name}",
'query' => drupal_get_destination(),
);
}
}
}