Skip to content
This repository has been archived by the owner on Feb 23, 2020. It is now read-only.

Namespace event types #176

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/schema/rng.schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions rng.links.action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
- rng.rng_event_type.overview
2 changes: 1 addition & 1 deletion rng.links.menu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
24 changes: 12 additions & 12 deletions rng.links.task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions rng.module
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
Expand Down
38 changes: 19 additions & 19 deletions rng.routing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions rng_views/rng_views.module
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Entity/EventTypeRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down
16 changes: 8 additions & 8 deletions src/Entity/EventType.php → src/Entity/RngEventType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/EventManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Form/EventTypeAccessDefaultsForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down