From a72affdfa5c1687d41e71385015ae8a226b575b1 Mon Sep 17 00:00:00 2001 From: akalata Date: Mon, 17 Sep 2018 11:27:23 -0500 Subject: [PATCH] Namespace event_type entity to avoid conflicts --- config/schema/rng.schema.yml | 2 +- rng.links.action.yml | 4 +- rng.links.menu.yml | 2 +- rng.links.task.yml | 24 ++++++------ rng.module | 4 +- rng.routing.yml | 38 +++++++++---------- rng_views/rng_views.module | 4 +- src/Entity/EventTypeRule.php | 2 +- .../{EventType.php => RngEventType.php} | 16 ++++---- src/EventManager.php | 2 +- src/Form/EventTypeAccessDefaultsForm.php | 4 +- 11 files changed, 51 insertions(+), 51 deletions(-) rename src/Entity/{EventType.php => RngEventType.php} (97%) diff --git a/config/schema/rng.schema.yml b/config/schema/rng.schema.yml index 82d8310..e08c922 100644 --- a/config/schema/rng.schema.yml +++ b/config/schema/rng.schema.yml @@ -36,7 +36,7 @@ rng.registrant_type.*: type: text label: 'Description' -rng.event_type.*.*: +rng.rng_event_type.*.*: type: config_entity label: 'Event bundle settings' mapping: diff --git a/rng.links.action.yml b/rng.links.action.yml index b91c82f..786475f 100644 --- a/rng.links.action.yml +++ b/rng.links.action.yml @@ -15,7 +15,7 @@ entity.registrant_type.add: - entity.registrant_type.collection rng.event_type.add: - route_name: entity.event_type.add + route_name: entity.rng_event_type.add title: 'Add event type' appears_on: - - rng.event_type.overview \ No newline at end of file + - rng.rng_event_type.overview \ No newline at end of file diff --git a/rng.links.menu.yml b/rng.links.menu.yml index cc9348b..b1eb1ae 100644 --- a/rng.links.menu.yml +++ b/rng.links.menu.yml @@ -20,7 +20,7 @@ rng.event.overview: title: 'Event types' parent: system.admin_structure description: 'Manage which entity bundles are designated as events.' - route_name: rng.event_type.overview + route_name: rng.rng_event_type.overview rng.config.settings: title: 'Registrant settings' diff --git a/rng.links.task.yml b/rng.links.task.yml index d1fdb59..ee832ee 100644 --- a/rng.links.task.yml +++ b/rng.links.task.yml @@ -3,25 +3,25 @@ rng.local_tasks: deriver: \Drupal\rng\Plugin\Derivative\LocalTasks # Event types -entity.event_type.edit_form: - route_name: entity.event_type.edit_form - base_route: entity.event_type.edit_form +entity.rng_event_type.edit_form: + route_name: entity.rng_event_type.edit_form + base_route: entity.rng_event_type.edit_form title: 'Edit' weight: -100 -entity.event_type.edit_form_sub: - route_name: entity.event_type.edit_form +entity.rng_event_type.edit_form_sub: + route_name: entity.rng_event_type.edit_form title: 'Edit' - parent_id: entity.event_type.edit_form + parent_id: entity.rng_event_type.edit_form -entity.event_type.field_mapping: - route_name: entity.event_type.field_mapping +entity.rng_event_type.field_mapping: + route_name: entity.rng_event_type.field_mapping title: 'Field Mapping' - parent_id: entity.event_type.edit_form + parent_id: entity.rng_event_type.edit_form -entity.event_type.access_defaults: - route_name: entity.event_type.access_defaults - base_route: entity.event_type.edit_form +entity.rng_event_type.access_defaults: + route_name: entity.rng_event_type.access_defaults + base_route: entity.rng_event_type.edit_form title: 'Access Defaults' # Registration type diff --git a/rng.module b/rng.module index 0a592d0..0a0aded 100644 --- a/rng.module +++ b/rng.module @@ -57,8 +57,8 @@ function rng_entity_operation(EntityInterface $entity) { if ($entity instanceof EventTypeInterface) { $operations['access_defaults'] = array( 'title' => t('Event access defaults'), - 'url' => Url::fromRoute('entity.event_type.access_defaults', [ - 'event_type' => $entity->id(), + 'url' => Url::fromRoute('entity.rng_event_type.access_defaults', [ + 'rng_event_type' => $entity->id(), ]), 'weight' => 20, ); diff --git a/rng.routing.yml b/rng.routing.yml index 51085d4..c698318 100644 --- a/rng.routing.yml +++ b/rng.routing.yml @@ -127,48 +127,48 @@ entity.rng_rule_component.edit_form: _entity_access: 'rng_rule_component.update' # event_type entities -entity.event_type.add: +entity.rng_event_type.add: path: '/admin/structure/rng/event_types/add' defaults: - _entity_form: 'event_type.add' - _title: 'Add event type' + _entity_form: 'rng_event_type.add' + _title: 'Add RNG event type' requirements: _permission: 'administer event types' -entity.event_type.edit_form: - path: '/admin/structure/rng/event_types/manage/{event_type}/edit' +entity.rng_event_type.edit_form: + path: '/admin/structure/rng/event_types/manage/{rng_event_type}/edit' defaults: - _entity_form: 'event_type.edit' + _entity_form: 'rng_event_type.edit' _title: 'Edit event type' requirements: _permission: 'administer event types' -entity.event_type.delete_form: - path: '/admin/structure/rng/event_types/manage/{event_type}/delete' +entity.rng_event_type.delete_form: + path: '/admin/structure/rng/event_types/manage/{rng_event_type}/delete' defaults: - _entity_form: 'event_type.delete' + _entity_form: 'rng_event_type.delete' _title: 'Delete event type' requirements: _permission: 'administer event types' -entity.event_type.access_defaults: - path: '/admin/structure/rng/event_types/manage/{event_type}/access_defaults' +entity.rng_event_type.access_defaults: + path: '/admin/structure/rng/event_types/manage/{rng_event_type}/access_defaults' defaults: - _entity_form: 'event_type.event_access_defaults' + _entity_form: 'rng_event_type.event_access_defaults' _title: 'Event type access defaults' requirements: _permission: 'administer event types' -entity.event_type.field_mapping: - path: '/admin/structure/rng/event_types/manage/{event_type}/field_mapping' +entity.rng_event_type.field_mapping: + path: '/admin/structure/rng/event_types/manage/{rng_event_type}/field_mapping' defaults: - _entity_form: 'event_type.field_mapping' + _entity_form: 'rng_event_type.field_mapping' _title: 'Field mapping' requirements: _permission: 'administer event types' -entity.event_type.access_defaults.delete_all: - path: '/admin/structure/rng/event_types/manage/{event_type}/access_defaults/delete' +entity.rng_event_type.access_defaults.delete_all: + path: '/admin/structure/rng/event_types/manage/{rng_event_type}/access_defaults/delete' defaults: _form: '\Drupal\rng\Form\EventTypeRuleDeleteAll' _title: 'Delete all event custom rules' @@ -179,11 +179,11 @@ entity.event_type.access_defaults.delete_all: rng_event_type_rule: type: 'entity:rng_event_type_rule' -rng.event_type.overview: +rng.rng_event_type.overview: path: '/admin/structure/rng/event_types' defaults: _controller: '\Drupal\Core\Entity\Controller\EntityListController::listing' - entity_type: 'event_type' + entity_type: 'rng_event_type' _title: 'Event types' requirements: _permission: 'administer event types' diff --git a/rng_views/rng_views.module b/rng_views/rng_views.module index eff9e5b..73cde7a 100644 --- a/rng_views/rng_views.module +++ b/rng_views/rng_views.module @@ -8,9 +8,9 @@ use Drupal\Core\Form\FormStateInterface; /** * Implements hook_form_BASE_FORM_ID_alter(). * - * event_type_edit_form + * rng_event_type_edit_form */ -function rng_views_form_event_type_form_alter(&$form, FormStateInterface &$form_state) { +function rng_views_form_rng_event_type_form_alter(&$form, FormStateInterface &$form_state) { /** @var \Drupal\Core\Entity\EntityFormInterface $form_object */ $form_object = $form_state->getFormObject(); // This hook users BASE_ID, so this hook will be called for diff --git a/src/Entity/EventTypeRule.php b/src/Entity/EventTypeRule.php index 0d9e27d..c4f5f7c 100644 --- a/src/Entity/EventTypeRule.php +++ b/src/Entity/EventTypeRule.php @@ -160,7 +160,7 @@ public function removeAction($name) { public function calculateDependencies() { parent::calculateDependencies(); - if ($event_type = EventType::load($this->getEventEntityTypeId() . '.' . $this->getEventBundle())) { + if ($event_type = RngEventType::load($this->getEventEntityTypeId() . '.' . $this->getEventBundle())) { $this->addDependency('config', $event_type->getConfigDependencyName()); } diff --git a/src/Entity/EventType.php b/src/Entity/RngEventType.php similarity index 97% rename from src/Entity/EventType.php rename to src/Entity/RngEventType.php index 7b0abaa..a32f278 100644 --- a/src/Entity/EventType.php +++ b/src/Entity/RngEventType.php @@ -15,7 +15,7 @@ * Defines the event type entity. * * @ConfigEntityType( - * id = "event_type", + * id = "rng_event_type", * label = @Translation("Event type"), * handlers = { * "list_builder" = "\Drupal\rng\Lists\EventTypeListBuilder", @@ -28,20 +28,20 @@ * } * }, * admin_permission = "administer event types", - * config_prefix = "event_type", + * config_prefix = "rng_event_type", * entity_keys = { * "id" = "id", * "label" = "id" * }, * links = { - * "edit-form" = "/admin/structure/rng/event_types/manage/{event_type}/edit", - * "delete-form" = "/admin/structure/rng/event_types/manage/{event_type}/delete", - * "event-access-defaults" = "/admin/structure/rng/event_types/manage/{event_type}/access_defaults", - * "field-mapping" = "/admin/structure/rng/event_types/manage/{event_type}/field_mapping", + * "edit-form" = "/admin/structure/rng/event_types/manage/{rng_event_type}/edit", + * "delete-form" = "/admin/structure/rng/event_types/manage/{rng_event_type}/delete", + * "event-access-defaults" = "/admin/structure/rng/event_types/manage/{rng_event_type}/access_defaults", + * "field-mapping" = "/admin/structure/rng/event_types/manage/{rng_event_type}/field_mapping", * } * ) */ -class EventType extends ConfigEntityBase implements EventTypeInterface { +class RngEventType extends ConfigEntityBase implements EventTypeInterface { /** * The machine name of this event config. @@ -437,7 +437,7 @@ public static function postDelete(EntityStorageInterface $storage, array $entiti parent::postDelete($storage, $entities); if ($event_type = reset($entities)) { - EventType::courierContextCC($event_type->entity_type, 'delete'); + RngEventType::courierContextCC($event_type->entity_type, 'delete'); } // Rebuild routes and local tasks. diff --git a/src/EventManager.php b/src/EventManager.php index 5a33b02..0d3a69c 100644 --- a/src/EventManager.php +++ b/src/EventManager.php @@ -36,7 +36,7 @@ class EventManager implements EventManagerInterface { * The entity manager. */ function __construct(EntityManagerInterface $entity_manager) { - $this->eventTypeStorage = $entity_manager->getStorage('event_type'); + $this->eventTypeStorage = $entity_manager->getStorage('rng_event_type'); } /** diff --git a/src/Form/EventTypeAccessDefaultsForm.php b/src/Form/EventTypeAccessDefaultsForm.php index 44c5044..89a679c 100644 --- a/src/Form/EventTypeAccessDefaultsForm.php +++ b/src/Form/EventTypeAccessDefaultsForm.php @@ -331,8 +331,8 @@ protected function actions(array $form, FormStateInterface $form_state) { ), ); - $actions['delete-custom-rules']['#url'] = Url::fromRoute('entity.event_type.access_defaults.delete_all', [ - 'event_type' => $event_type->id(), + $actions['delete-custom-rules']['#url'] = Url::fromRoute('entity.rng_event_type.access_defaults.delete_all', [ + 'rng_event_type' => $event_type->id(), ]); return $actions;