/** * Overrides hook_menu() defaults. * https://www.drupal.org/node/1021576 */ public function hook_menu() { $items = parent::hook_menu(); $items[$this->path]['description'] = 'Manage products, including fields.'; // Menu item for operations like revert and delete. return $items; }
public function hook_menu() { $items = parent::hook_menu(); // Add a tab to manage embedded entities // @todo Don't display this if there are no embedded entity types for this entity type $items[$this->path . '/embedded'] = array('title' => 'Manage embedded entity types', 'page callback' => 'mongo_entity_embedded_entity_types', 'page arguments' => array($this->entityType), 'access callback' => 'user_access', 'access arguments' => array('administer site configuration'), 'type' => MENU_LOCAL_TASK, 'weight' => 100); return $items; }
/** * {@inheritdoc} */ public function hook_menu() { $items = parent::hook_menu(); // Add back in the admin overview form. $wildcard = isset($this->entityInfo['admin ui']['menu wildcard']) ? $this->entityInfo['admin ui']['menu wildcard'] : '%entity_object'; $plural_label = isset($this->entityInfo['plural label']) ? $this->entityInfo['plural label'] : $this->entityInfo['label'] . 's'; $items[$this->path] = array('title' => $plural_label, 'page callback' => 'drupal_get_form', 'page arguments' => array($this->entityType . '_overview_form', $this->entityType), 'description' => 'Manage ' . $plural_label . '.', 'access callback' => 'entity_access', 'access arguments' => array('view', $this->entityType), 'file' => 'includes/entity.ui.inc'); // Override the "add" path. $items[$this->path . '/add'] = array('title callback' => 'entity_ui_get_page_title', 'title arguments' => array('add', $this->entityType), 'page callback' => 'entity_ui_get_form', 'page arguments' => array($this->entityType, NULL, 'add'), 'access callback' => 'entity_access', 'access arguments' => array('create', $this->entityType), 'type' => MENU_LOCAL_ACTION); // Advanced. $items[$this->path . '/advanced'] = array('title' => t('Advanced'), 'page callback' => 'drupal_get_form', 'page arguments' => array('git_clone_advanced_form'), 'access callback' => 'entity_access', 'access arguments' => array('update', $this->entityType), 'type' => MENU_LOCAL_TASK); if (!empty($this->entityInfo['admin ui']['file'])) { // Add in the include file for the entity form. foreach (array('/add', '/advanced') as $path_end) { $items[$this->path . $path_end]['file'] = $this->entityInfo['admin ui']['file']; $items[$this->path . $path_end]['file path'] = isset($this->entityInfo['admin ui']['file path']) ? $this->entityInfo['admin ui']['file path'] : drupal_get_path('module', $this->entityInfo['module']); } } return $items; }
/** * Overrides the 'revert' action, to not delete the workflows. * * @see https://www.drupal.org/node/2051079 * @see https://www.drupal.org/node/1043634 */ public function applyOperation($op, $entity) { $label = entity_label($this->entityType, $entity); $vars = array('%entity' => $this->entityInfo['label'], '%label' => $label); $id = entity_id($this->entityType, $entity); $edit_link = l(t('edit'), $this->path . '/manage/' . $id . '/edit'); switch ($op) { case 'revert': // Do not delete the workflow, but recreate features_get_default($entity_type, $module); // entity_delete($this->entityType, $id); $workflow = $entity; $entity_type = $this->entityType; $funcname = $workflow->module . '_default_' . $this->entityType; $defaults = $funcname(); // No defaults, no processing. if (empty($defaults)) { return; } foreach ($defaults as $name => $entity) { $existing[$name] = workflow_load($name); // If we got an existing entity with the same name, we reuse its entity id. if (isset($existing[$name])) { // Set the original as later reference. $entity->original = $existing[$name]; // As we got an ID, the entity is not new. $entity->wid = $entity->original->wid; unset($entity->is_new); // Update the status to be in code. // $entity->status |= ENTITY_IN_CODE; $entity->status = ENTITY_IN_CODE; // We mark it for being in revert mode. $entity->is_reverted = TRUE; entity_save($entity_type, $entity); unset($entity->is_reverted); } // The rest of the defaults is handled by default implementation. // @see entity_defaults_rebuild() } watchdog($this->entityType, 'Reverted %entity %label to the defaults.', $vars, WATCHDOG_NOTICE, $edit_link); return t('Reverted %entity %label to the defaults.', $vars); case 'delete': case 'import': default: return parent::applyOperation($op, $entity); } }
/** * Overrides hook_menu() defaults. */ public function hook_menu() { $items = parent::hook_menu(); $items[$this->path]['description'] = 'Manage Custom Entity, including fields.'; return $items; }
/** * Overrides hook_menu() defaults. */ public function hook_menu() { $items = parent::hook_menu(); $items[$this->path]['description'] = 'Manage Playlist types.'; return $items; }