Skip to content
Snippets Groups Projects

Resolve #3382470 "Rename tokens provided"

Merged Jürgen Haas requested to merge issue/eca-3382470:3382470-rename-tokens-provided into 2.0.x
11 files
+ 112
50
Compare changes
  • Side-by-side
  • Inline
Files
11
@@ -329,14 +329,14 @@ class AccessEvent extends EventBase {
new Token(name: 'context', description: 'Contains a list of properties depending on the context of the event.', classes: [
CreateAccess::class,
]),
new Token(name: 'entity-bundle', description: 'The bundle of the entity.', classes: [
new Token(name: 'entity_bundle', description: 'The bundle of the entity.', classes: [
CreateAccess::class,
EntityAccess::class,
]),
new Token(name: 'entity-id', description: 'The entity ID, only available if the entity is not new.', classes: [
new Token(name: 'entity_id', description: 'The entity ID, only available if the entity is not new.', classes: [
EntityAccess::class,
]),
new Token(name: 'entity-type', description: 'The entity type.', classes: [
new Token(name: 'entity_type', description: 'The entity type.', classes: [
EntityAccess::class,
]),
new Token(name: 'field', description: 'The name of the field.', classes: [
@@ -363,11 +363,11 @@ class AccessEvent extends EventBase {
$entity = $event->getEntity();
$data += [
'operation' => $event->getOperation(),
'entity-type' => $entity->getEntityTypeId(),
'entity-bundle' => $entity->bundle(),
'entity_type' => $entity->getEntityTypeId(),
'entity_bundle' => $entity->bundle(),
];
if (!$entity->isNew()) {
$data['entity-id'] = $entity->id();
$data['entity_id'] = $entity->id();
}
}
if ($event instanceof FieldAccess) {
@@ -378,7 +378,7 @@ class AccessEvent extends EventBase {
if ($event instanceof CreateAccess) {
$data += [
'context' => [],
'entity-bundle' => $event->getEntityBundle(),
'entity_bundle' => $event->getEntityBundle(),
];
$context = $event->getContext();
foreach ($context as $k => $v) {
@@ -387,7 +387,7 @@ class AccessEvent extends EventBase {
}
}
if (isset($context['entity_type_id'])) {
$data['entity-type'] = $context['entity_type_id'];
$data['entity_type'] = $context['entity_type_id'];
}
}
Loading