コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function getDerivativeDefinitions($base_plugin_definition)
 {
     $list_entity = \Drupal\myeck\MyeckConfig::getConfig();
     foreach ($list_entity as $id_entity => $entity_info) {
         //-------------------------
         $this->derivatives[$id_entity . '.settings_tab'] = $base_plugin_definition;
         $this->derivatives[$id_entity . '.settings_tab']['title'] = "Settings";
         $this->derivatives[$id_entity . '.settings_tab']['route_name'] = 'myeck.' . $id_entity . '.settings';
         $this->derivatives[$id_entity . '.settings_tab']['base_route'] = 'myeck.' . $id_entity . '.settings';
         //-------------------------
         $this->derivatives[$id_entity . '.view'] = $base_plugin_definition;
         $this->derivatives[$id_entity . '.view']['title'] = "View";
         $this->derivatives[$id_entity . '.view']['route_name'] = 'entity.' . $id_entity . '.canonical';
         $this->derivatives[$id_entity . '.view']['base_route'] = 'entity.' . $id_entity . '.canonical';
         //-------------------------
         $this->derivatives[$id_entity . '.page_edit'] = $base_plugin_definition;
         $this->derivatives[$id_entity . '.page_edit']['title'] = "Edit";
         $this->derivatives[$id_entity . '.page_edit']['route_name'] = 'entity.' . $id_entity . '.edit_form';
         $this->derivatives[$id_entity . '.page_edit']['base_route'] = 'entity.' . $id_entity . '.canonical';
         //-------------------------
         $this->derivatives[$id_entity . '.delete_confirm'] = $base_plugin_definition;
         $this->derivatives[$id_entity . '.delete_confirm']['title'] = "Delete";
         $this->derivatives[$id_entity . '.delete_confirm']['route_name'] = 'entity.' . $id_entity . '.delete_form';
         $this->derivatives[$id_entity . '.delete_confirm']['base_route'] = 'entity.' . $id_entity . '.canonical';
         $this->derivatives[$id_entity . '.delete_confirm']['weight'] = 10;
     }
     return $this->derivatives;
 }
コード例 #2
0
 /**
  * Returns an array of entity type permissions.
  *
  * @return array
  *   The permissions.
  */
 public function entityTypePermissions()
 {
     $perms = array();
     $list_entity = \Drupal\myeck\MyeckConfig::getConfig();
     foreach ($list_entity as $id_entity => $entity_info) {
         $name_entity = $entity_info['entity_title'];
         $perms = array_merge($perms, $this->buildPermissions($id_entity, $name_entity));
     }
     return $perms;
 }
コード例 #3
0
 /**
  * {@inheritdoc}
  */
 public function getDerivativeDefinitions($base_plugin_definition)
 {
     $list_entity = \Drupal\myeck\MyeckConfig::getConfig();
     foreach ($list_entity as $id_entity => $entity_info) {
         $name_entity = $entity_info['entity_title'];
         //-------------------------
         //      $this->derivatives['myeck.content_'.$id_entity.'.add'] = $base_plugin_definition;
         $this->derivatives['myeck.entity.' . $id_entity . '_add'] = $base_plugin_definition;
         # Which route will be called by the link
         $this->derivatives['myeck.entity.' . $id_entity . '_add']['title'] = "Add {$name_entity}";
         $this->derivatives['myeck.entity.' . $id_entity . '_add']['route_name'] = 'myeck.' . $id_entity . '.add';
         # Where will the link appear, defined by route name.
         $this->derivatives['myeck.entity.' . $id_entity . '_add']['appears_on'] = array('entity.' . $id_entity . '.collection', 'entity.' . $id_entity . '.canonical', 'myeck.' . $id_entity . '.settings');
         $this->derivatives['myeck.entity.' . $id_entity . '_list'] = $base_plugin_definition;
         # Which route will be called by the link
         $this->derivatives['myeck.entity.' . $id_entity . '_list']['title'] = "List of {$name_entity}";
         $this->derivatives['myeck.entity.' . $id_entity . '_list']['route_name'] = 'entity.' . $id_entity . '.collection';
         # Where will the link appear, defined by route name.
         $this->derivatives['myeck.entity.' . $id_entity . '_list']['appears_on'] = array('myeck.' . $id_entity . '.settings');
     }
     return $this->derivatives;
 }