Changing routes back after they got changed when regenerating entities

This commit is contained in:
naomi 2018-04-11 12:39:39 +02:00
parent a48e37ad39
commit cf0d928423
4 changed files with 6 additions and 17 deletions

View File

@ -44,10 +44,10 @@ use Drupal\user\UserInterface;
* "status" = "status", * "status" = "status",
* }, * },
* links = { * links = {
* "canonical" = "/admin/structure/person/{person}", * "canonical" = "/zencrm/person/{person}",
* "add-form" = "/admin/structure/person/add", * "add-form" = "/zencrm/person/add",
* "edit-form" = "/admin/structure/person/{person}/edit", * "edit-form" = "/zencrm/person/{person}/edit",
* "delete-form" = "/admin/structure/person/{person}/delete", * "delete-form" = "/zencrm/person/{person}/delete",
* "collection" = "/admin/structure/person", * "collection" = "/admin/structure/person",
* }, * },
* field_ui_base_route = "person.settings" * field_ui_base_route = "person.settings"

View File

@ -14,11 +14,6 @@ entity.person.edit_form:
base_route: entity.person.canonical base_route: entity.person.canonical
title: 'Edit' title: 'Edit'
entity.person.version_history:
route_name: entity.person.version_history
base_route: entity.person.canonical
title: 'Revisions'
entity.person.delete_form: entity.person.delete_form:
route_name: entity.person.delete_form route_name: entity.person.delete_form
base_route: entity.person.canonical base_route: entity.person.canonical
@ -41,11 +36,6 @@ entity.contact_details.edit_form:
base_route: entity.contact_details.canonical base_route: entity.contact_details.canonical
title: 'Edit' title: 'Edit'
entity.contact_details.version_history:
route_name: entity.contact_details.version_history
base_route: entity.contact_details.canonical
title: 'Revisions'
entity.contact_details.delete_form: entity.contact_details.delete_form:
route_name: entity.contact_details.delete_form route_name: entity.contact_details.delete_form
base_route: entity.contact_details.canonical base_route: entity.contact_details.canonical

View File

@ -10,7 +10,6 @@ use Drupal\Core\Routing\RouteMatchInterface;
/** /**
* Implements hook_ENTITY_TYPE_presave(). * Implements hook_ENTITY_TYPE_presave().
* Computes the full_name field from first_name middle_names and last_name. * Computes the full_name field from first_name middle_names and last_name.
* Computes the first_and_last_name field from first_name and last_name.
*/ */
function zencrm_entities_person_presave($entity) { function zencrm_entities_person_presave($entity) {
$first_name = $entity->first_name->getString(); $first_name = $entity->first_name->getString();
@ -19,10 +18,8 @@ function zencrm_entities_person_presave($entity) {
if ($middle_names) { if ($middle_names) {
$middle_names .= ' '; $middle_names .= ' ';
} }
$first_and_last_name = $first_name . ' ' . $last_name;
$full_name = $first_name . ' ' . $middle_names . $last_name; $full_name = $first_name . ' ' . $middle_names . $last_name;
$entity->set('full_name', $full_name); $entity->set('full_name', $full_name);
$entity->set('first_and_last_name', $first_and_last_name);
} }

View File

@ -6,6 +6,8 @@ use Drupal\Core\Block\BlockBase;
/** /**
* Provides a 'HatCreator' block. * Provides a 'HatCreator' block.
* Block contains links for creating hats of types that the person does not already have.
* The links open an entity create form in a popup.
* *
* @Block( * @Block(
* id = "hat_creator", * id = "hat_creator",