Skip to content
Snippets Groups Projects
Commit c389ae5c authored by Gabriel Carleton-Barnes's avatar Gabriel Carleton-Barnes Committed by Aaron Bauman
Browse files

Issue #3181213 by gcb, AaronBauman: Mapping configuration screens are non-standard

parent 4b4eb7d4
No related branches found
No related tags found
No related merge requests found
......@@ -5,43 +5,6 @@ salesforce_mapping.add_action:
title: 'Add Mapping'
appears_on:
- entity.salesforce_mapping.list
- entity.salesforce_mapping.edit_form
- entity.salesforce_mapping.fields
salesforce_mapping.fields_action:
route_name: entity.salesforce_mapping.fields
title: 'Edit Fields'
appears_on:
- entity.salesforce_mapping.edit_form
salesforce_mapping.delete_action:
route_name: entity.salesforce_mapping.delete_form
title: 'Delete Mapping'
appears_on:
- entity.salesforce_mapping.edit_form
- entity.salesforce_mapping.fields
salesforce_mapping.list_action:
route_name: entity.salesforce_mapping.list
title: 'List Mappings'
appears_on:
- entity.salesforce_mapping.add_form
- entity.salesforce_mapping.edit_form
- entity.salesforce_mapped_object.list
- entity.salesforce_mapping.fields
- entity.salesforce_mapped_object.add_form
salesforce_mapping.edit_action:
route_name: entity.salesforce_mapping.edit_form
title: 'Edit Properties'
appears_on:
- entity.salesforce_mapping.fields
salesforce_mapped_object.list_action:
route_name: entity.salesforce_mapped_object.list
title: 'List Mapped Objects'
appears_on:
- entity.salesforce_mapped_object.add_form
salesforce_mapped_object.add_action:
route_name: entity.salesforce_mapped_object.add_form
......
salesforce_mapping.entities:
class: \Drupal\Core\Menu\LocalTaskDefault
deriver: \Drupal\salesforce_mapping_ui\Plugin\Derivative\SalesforceMappingLocalTask
salesforce_mapped_object.admin:
title: Salesforce
base_route: system.admin_content
......@@ -22,3 +18,13 @@ entity.salesforce_mapped_object.delete_form:
base_route: entity.salesforce_mapped_object.canonical
title: 'Delete'
weight: 10
entity.salesforce_mapping.edit_form:
route_name: entity.salesforce_mapping.edit_form
base_route: entity.salesforce_mapping.canonical
title: 'Settings'
entity.salesforce_mapping.fields:
route_name: entity.salesforce_mapping.fields
base_route: entity.salesforce_mapping.canonical
title: 'Fields'
......@@ -27,6 +27,7 @@ entity.salesforce_mapping.edit_form:
path: '/admin/structure/salesforce/mappings/manage/{salesforce_mapping}'
defaults:
_entity_form: 'salesforce_mapping.edit'
_title_callback: '\Drupal\salesforce_mapping_ui\Controller\SalesforceMappingController::editTitle'
requirements:
_entity_access: 'salesforce_mapping.update'
......@@ -34,7 +35,7 @@ entity.salesforce_mapping.fields:
path: '/admin/structure/salesforce/mappings/manage/{salesforce_mapping}/fields'
defaults:
_entity_form: 'salesforce_mapping.fields'
_title: 'Fields'
_title_callback: '\Drupal\salesforce_mapping_ui\Controller\SalesforceMappingController::fieldsTitle'
requirements:
_entity_access: 'salesforce_mapping.update'
......@@ -66,7 +67,7 @@ entity.salesforce_mapped_object.list:
_title: 'Salesforce Mapped Objects'
requirements:
_permission: 'administer salesforce mapped objects'
entity.salesforce_mapped_object.canonical:
path: '/admin/content/salesforce/{salesforce_mapped_object}'
defaults:
......
<?php
namespace Drupal\salesforce_mapping_ui\Controller;
use Drupal\Core\Entity\Controller\EntityController;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Routing\RouteMatchInterface;
/**
* For now, just some dynamic route names.
*/
class SalesforceMappingController extends EntityController {
/**
* Provides a callback for a mapping edit page Title.
*
* @param \Drupal\Core\Routing\RouteMatchInterface $route_match
* The route match.
* @param \Drupal\Core\Entity\EntityInterface $_entity
* (optional) An entity, passed in directly from the request attributes.
*
* @return string|null
* The title for the mapping edit page, if an entity was found.
*/
public function editTitle(RouteMatchInterface $route_match, EntityInterface $_entity = NULL) {
if ($entity = $this->doGetEntity($route_match, $_entity)) {
return $this->t("%label Mapping Settings", [
'%label' => $entity->label(),
]);
}
return $this->t('New Mapping');
}
/**
* Provides a callback for a mapping field config page Title.
*
* @param \Drupal\Core\Routing\RouteMatchInterface $route_match
* The route match.
* @param \Drupal\Core\Entity\EntityInterface $_entity
* (optional) An entity, passed in directly from the request attributes.
*
* @return string|null
* The title for the mapping edit page, if an entity was found.
*/
public function fieldsTitle(RouteMatchInterface $route_match, EntityInterface $_entity = NULL) {
if ($entity = $this->doGetEntity($route_match, $_entity)) {
return $this->t("%label Mapping Fields", [
'%label' => $entity->label(),
]);
}
}
}
......@@ -76,7 +76,7 @@ class SalesforceMappingList extends DraggableListBuilder {
// Only makes sense to expose fields operation if edit exists.
if (isset($operations['edit'])) {
$operations['edit']['title'] = $this->t('Properties');
$operations['edit']['title'] = $this->t('Settings');
$operations['fields'] = [
'title' => $this->t('Fields'),
'url' => $url,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment