Commit ddb46ebe authored by webchick's avatar webchick

Issue #2147685 by jibran: Fields settings page breadcrumb is not correct.

parent d2478e96
......@@ -9,6 +9,7 @@
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Form\FormBase;
use Drupal\Component\Utility\String;
use Drupal\field\FieldInstanceInterface;
use Drupal\field_ui\FieldUI;
use Symfony\Component\DependencyInjection\ContainerInterface;
......@@ -220,4 +221,17 @@ public function delete(array &$form, array &$form_state) {
);
}
/**
* The _title_callback for the field instance settings form.
*
* @param \Drupal\field\FieldInstanceInterface $field_instance
* The field instance.
*
* @return string
* The label of the field instance.
*/
public function getTitle(FieldInstanceInterface $field_instance) {
return String::checkPlain($field_instance->label());
}
}
......@@ -70,7 +70,10 @@ protected function routes(RouteCollection $collection) {
$route = new Route(
"$path/fields/{field_instance}",
array('_form' => '\Drupal\field_ui\Form\FieldInstanceEditForm'),
array(
'_form' => '\Drupal\field_ui\Form\FieldInstanceEditForm',
'_title_callback' => '\Drupal\field_ui\Form\FieldInstanceEditForm::getTitle',
),
array('_permission' => 'administer ' . $entity_type . ' fields')
);
$collection->add("field_ui.instance_edit_$entity_type", $route);
......
......@@ -73,6 +73,8 @@ function fieldUIAddNewField($bundle_path, $initial_edit, $field_edit = array(),
// First step : 'Add new field' on the 'Manage fields' page.
$this->drupalPostForm("$bundle_path/fields", $initial_edit, t('Save'));
$this->assertRaw(t('These settings apply to the %label field everywhere it is used.', array('%label' => $label)), 'Field settings page was displayed.');
// Test Breadcrumbs.
$this->assertLink($label, 0, 'Field label is correct in the breadcrumb of the field settings page.');
// Second step : 'Field settings' form.
$this->drupalPostForm(NULL, $field_edit, t('Save field settings'));
......@@ -129,6 +131,9 @@ function fieldUIDeleteField($bundle_path, $field_name, $label, $bundle_label) {
$this->drupalGet("$bundle_path/fields/$field_name/delete");
$this->assertRaw(t('Are you sure you want to delete the field %label', array('%label' => $label)), 'Delete confirmation was found.');
// Test Breadcrumbs.
$this->assertLink($label, 0, 'Field label is correct in the breadcrumb of the field delete page.');
// Submit confirmation form.
$this->drupalPostForm(NULL, array(), t('Delete'));
$this->assertRaw(t('The field %label has been deleted from the %type content type.', array('%label' => $label, '%type' => $bundle_label)), 'Delete message was found.');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment