Issue #2010290 by tim.plunkett, larowlan, alexpott, ParisLiakos: Editing a config entity from a listing page results in a 'page not found'.
parent
033451a4d2
commit
096b8c5a58
|
@ -31,6 +31,10 @@ class ConfigEntityListController extends EntityListController {
|
|||
$operations = parent::getOperations($entity);
|
||||
$uri = $entity->uri();
|
||||
|
||||
// For configuration entities edit path is the MENU_DEFAULT_LOCAL_TASK and
|
||||
// therefore should be accessed by the short route.
|
||||
$operations['edit']['href'] = $uri['path'];
|
||||
|
||||
if (isset($this->entityInfo['entity_keys']['status'])) {
|
||||
if (!$entity->status()) {
|
||||
$operations['enable'] = array(
|
||||
|
|
|
@ -111,19 +111,8 @@ class ActionListController extends ConfigEntityListController implements EntityC
|
|||
public function getOperations(EntityInterface $entity) {
|
||||
$operations = array();
|
||||
if ($entity->isConfigurable()) {
|
||||
$uri = $entity->uri();
|
||||
$operations['edit'] = array(
|
||||
'title' => t('Configure'),
|
||||
'href' => $uri['path'],
|
||||
'options' => $uri['options'],
|
||||
'weight' => 10,
|
||||
);
|
||||
$operations['delete'] = array(
|
||||
'title' => t('Delete'),
|
||||
'href' => $uri['path'] . '/delete',
|
||||
'options' => $uri['options'],
|
||||
'weight' => 100,
|
||||
);
|
||||
$operations = parent::getOperations($entity);
|
||||
$operations['edit']['title'] = t('Configure');
|
||||
}
|
||||
return $operations;
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ class ConfigEntityListTest extends WebTestBase {
|
|||
$expected_operations = array(
|
||||
'edit' => array (
|
||||
'title' => t('Edit'),
|
||||
'href' => $uri['path'] . '/edit',
|
||||
'href' => $uri['path'],
|
||||
'options' => $uri['options'],
|
||||
'weight' => 10,
|
||||
),
|
||||
|
@ -134,7 +134,7 @@ class ConfigEntityListTest extends WebTestBase {
|
|||
$expected_operations = array(
|
||||
'edit' => array(
|
||||
'title' => t('Edit'),
|
||||
'href' => $uri['path'] . '/edit',
|
||||
'href' => $uri['path'],
|
||||
'options' => $uri['options'],
|
||||
'weight' => 10,
|
||||
),
|
||||
|
@ -211,7 +211,7 @@ class ConfigEntityListTest extends WebTestBase {
|
|||
$this->assertFieldByXpath('//td', 'antelope', "Machine name found for added 'Antelope' entity.");
|
||||
|
||||
// Edit the entity using the operations link.
|
||||
$this->assertLinkByHref('admin/structure/config_test/manage/antelope/edit');
|
||||
$this->assertLinkByHref('admin/structure/config_test/manage/antelope');
|
||||
$this->clickLink('Edit', 1);
|
||||
$this->assertResponse(200);
|
||||
$this->assertTitle('Edit Antelope | Drupal');
|
||||
|
|
|
@ -206,7 +206,7 @@ class ConfigEntityTest extends WebTestBase {
|
|||
$this->assertResponse(200);
|
||||
$this->assertRaw($message_insert);
|
||||
$this->assertNoRaw($message_update);
|
||||
$this->assertLinkByHref("admin/structure/config_test/manage/$id/edit");
|
||||
$this->assertLinkByHref("admin/structure/config_test/manage/$id");
|
||||
|
||||
// Update the configuration entity.
|
||||
$edit = array(
|
||||
|
@ -217,11 +217,11 @@ class ConfigEntityTest extends WebTestBase {
|
|||
$this->assertResponse(200);
|
||||
$this->assertNoRaw($message_insert);
|
||||
$this->assertRaw($message_update);
|
||||
$this->assertLinkByHref("admin/structure/config_test/manage/$id/edit");
|
||||
$this->assertLinkByHref("admin/structure/config_test/manage/$id");
|
||||
$this->assertLinkByHref("admin/structure/config_test/manage/$id/delete");
|
||||
|
||||
// Delete the configuration entity.
|
||||
$this->drupalGet("admin/structure/config_test/manage/$id/edit");
|
||||
$this->drupalGet("admin/structure/config_test/manage/$id");
|
||||
$this->drupalPost(NULL, array(), 'Delete');
|
||||
$this->assertUrl("admin/structure/config_test/manage/$id/delete");
|
||||
$this->drupalPost(NULL, array(), 'Delete');
|
||||
|
@ -231,7 +231,6 @@ class ConfigEntityTest extends WebTestBase {
|
|||
$this->assertRaw($message_delete);
|
||||
$this->assertNoText($label1);
|
||||
$this->assertNoLinkByHref("admin/structure/config_test/manage/$id");
|
||||
$this->assertNoLinkByHref("admin/structure/config_test/manage/$id/edit");
|
||||
|
||||
// Re-create a configuration entity.
|
||||
$edit = array(
|
||||
|
@ -242,7 +241,7 @@ class ConfigEntityTest extends WebTestBase {
|
|||
$this->assertUrl('admin/structure/config_test');
|
||||
$this->assertResponse(200);
|
||||
$this->assertText($label1);
|
||||
$this->assertLinkByHref("admin/structure/config_test/manage/$id/edit");
|
||||
$this->assertLinkByHref("admin/structure/config_test/manage/$id");
|
||||
|
||||
// Rename the configuration entity's ID/machine name.
|
||||
$edit = array(
|
||||
|
@ -256,9 +255,8 @@ class ConfigEntityTest extends WebTestBase {
|
|||
$this->assertNoText($label2);
|
||||
$this->assertText($label3);
|
||||
$this->assertNoLinkByHref("admin/structure/config_test/manage/$id");
|
||||
$this->assertNoLinkByHref("admin/structure/config_test/manage/$id/edit");
|
||||
$id = $edit['id'];
|
||||
$this->assertLinkByHref("admin/structure/config_test/manage/$id/edit");
|
||||
$this->assertLinkByHref("admin/structure/config_test/manage/$id");
|
||||
|
||||
// Create a configuration entity with '0' machine name.
|
||||
$edit = array(
|
||||
|
@ -269,7 +267,7 @@ class ConfigEntityTest extends WebTestBase {
|
|||
$this->assertResponse(200);
|
||||
$message_insert = format_string('%label configuration has been created.', array('%label' => $edit['label']));
|
||||
$this->assertRaw($message_insert);
|
||||
$this->assertLinkByHref('admin/structure/config_test/manage/0/edit');
|
||||
$this->assertLinkByHref('admin/structure/config_test/manage/0');
|
||||
$this->assertLinkByHref('admin/structure/config_test/manage/0/delete');
|
||||
$this->drupalPost('admin/structure/config_test/manage/0/delete', array(), 'Delete');
|
||||
$this->assertFalse(entity_load('config_test', '0'), 'Test entity deleted');
|
||||
|
|
|
@ -19,22 +19,6 @@ class CategoryListController extends ConfigEntityListController {
|
|||
*/
|
||||
public function getOperations(EntityInterface $entity) {
|
||||
$operations = parent::getOperations($entity);
|
||||
if (module_exists('field_ui')) {
|
||||
$uri = $entity->uri();
|
||||
$operations['manage-fields'] = array(
|
||||
'title' => t('Manage fields'),
|
||||
'href' => $uri['path'] . '/fields',
|
||||
'options' => $uri['options'],
|
||||
'weight' => 11,
|
||||
);
|
||||
$operations['manage-display'] = array(
|
||||
'title' => t('Manage display'),
|
||||
'href' => $uri['path'] . '/display',
|
||||
'options' => $uri['options'],
|
||||
'weight' => 12,
|
||||
);
|
||||
}
|
||||
|
||||
if (!$entity->access('delete')) {
|
||||
unset($operations['delete']);
|
||||
}
|
||||
|
|
|
@ -53,7 +53,10 @@ class ContactSitewideTest extends WebTestBase {
|
|||
// Default category exists.
|
||||
$this->assertLinkByHref('admin/structure/contact/manage/feedback/delete');
|
||||
// User category could not be changed or deleted.
|
||||
$this->assertNoLinkByHref('admin/structure/contact/manage/personal');
|
||||
// Cannot use assertNoLinkByHref() as it does partial URL matching.
|
||||
$edit_href = 'admin/structure/contact/manage/personal';
|
||||
$edit_link = $this->xpath('//a[@href=:href]', array(':href' => url($edit_href)));
|
||||
$this->assertTrue(empty($edit_link), format_string('No link containing href %href found.', array('%href' => $edit_href)));
|
||||
$this->assertNoLinkByHref('admin/structure/contact/manage/personal/delete');
|
||||
|
||||
$this->drupalGet('admin/structure/contact/manage/personal');
|
||||
|
@ -189,6 +192,19 @@ class ContactSitewideTest extends WebTestBase {
|
|||
$this->drupalGet('contact');
|
||||
$this->assertResponse(403);
|
||||
$this->assertRaw(t('You cannot send more than %number messages in @interval. Try again later.', array('%number' => config('contact.settings')->get('flood.limit'), '@interval' => format_interval(600))));
|
||||
|
||||
// Test listing controller.
|
||||
$this->drupalLogin($admin_user);
|
||||
|
||||
$this->deleteCategories();
|
||||
|
||||
$label = $this->randomName(16);
|
||||
$recipients = implode(',', array($recipients[0], $recipients[1], $recipients[2]));
|
||||
$this->addCategory(drupal_strtolower($this->randomName(16)), $label, $recipients, '', FALSE);
|
||||
$this->drupalGet('admin/structure/contact');
|
||||
$this->clickLink(t('Edit'));
|
||||
$this->assertResponse(200);
|
||||
$this->assertFieldByName('label', $label);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -48,7 +48,6 @@ class MenuListController extends ConfigEntityListController {
|
|||
$uri = $entity->uri();
|
||||
|
||||
$operations['edit']['title'] = t('Edit menu');
|
||||
$operatuins['edit']['href'] = $uri['path'];
|
||||
$operations['add'] = array(
|
||||
'title' => t('Add link'),
|
||||
'href' => $uri['path'] . '/add',
|
||||
|
|
|
@ -27,24 +27,18 @@ class ShortcutListController extends ConfigEntityListController {
|
|||
* Overrides \Drupal\Core\Entity\EntityListController::getOperations().
|
||||
*/
|
||||
public function getOperations(EntityInterface $entity) {
|
||||
$operations = parent::getOperations($entity);
|
||||
$uri = $entity->uri();
|
||||
|
||||
$operations['edit']['title'] = t('Edit menu');
|
||||
$operations['edit']['href'] = $uri['path'] . '/edit';
|
||||
|
||||
$operations['list'] = array(
|
||||
'title' => t('List links'),
|
||||
'href' => $uri['path'],
|
||||
);
|
||||
$operations['edit'] = array(
|
||||
'title' => t('Edit set'),
|
||||
'href' => $uri['path'] . '/edit',
|
||||
'options' => $uri['options'],
|
||||
'weight' => 10,
|
||||
);
|
||||
if ($entity->access('delete')) {
|
||||
$operations['delete'] = array(
|
||||
'title' => t('Delete set'),
|
||||
'href' => $uri['path'] . '/delete',
|
||||
'options' => $uri['options'],
|
||||
'weight' => 100,
|
||||
);
|
||||
if (!$entity->access('delete')) {
|
||||
unset($operations['delete']);
|
||||
}
|
||||
return $operations;
|
||||
}
|
||||
|
|
|
@ -108,7 +108,9 @@ class ShortcutSetsTest extends ShortcutTestBase {
|
|||
$set = $this->set;
|
||||
|
||||
$new_label = $this->randomName();
|
||||
$this->drupalPost('admin/config/user-interface/shortcut/manage/' . $set->id() . '/edit', array('label' => $new_label), t('Save'));
|
||||
$this->drupalGet('admin/config/user-interface/shortcut');
|
||||
$this->clickLink(t('Edit menu'));
|
||||
$this->drupalPost(NULL, array('label' => $new_label), t('Save'));
|
||||
$set = shortcut_set_load($set->id());
|
||||
$this->assertTrue($set->label() == $new_label, 'Shortcut set has been successfully renamed.');
|
||||
}
|
||||
|
|
|
@ -31,6 +31,8 @@ class VocabularyListController extends ConfigEntityListController implements For
|
|||
$uri = $entity->uri();
|
||||
|
||||
$operations['edit']['title'] = t('edit vocabulary');
|
||||
$operations['edit']['href'] = $uri['path'] . '/edit';
|
||||
|
||||
$operations['list'] = array(
|
||||
'title' => t('list terms'),
|
||||
'href' => $uri['path'],
|
||||
|
|
|
@ -39,10 +39,9 @@ class BasicTest extends WizardTestBase {
|
|||
$this->drupalGet('admin/structure/views');
|
||||
$this->assertText($view1['label']);
|
||||
$this->assertText($view1['description']);
|
||||
// @todo For now, clone is being left to config.module to solve.
|
||||
foreach (array('delete', 'edit') as $operation) {
|
||||
$this->assertLinkByHref(url('admin/structure/views/view/' . $view1['id'] . '/' . $operation));
|
||||
}
|
||||
$this->assertLinkByHref(url('admin/structure/views/view/' . $view1['id']));
|
||||
$this->assertLinkByHref(url('admin/structure/views/view/' . $view1['id'] . '/delete'));
|
||||
$this->assertLinkByHref(url('admin/structure/views/view/' . $view1['id'] . '/clone'));
|
||||
|
||||
// This view should not have a block.
|
||||
$this->drupalGet('admin/structure/block');
|
||||
|
|
|
@ -33,7 +33,7 @@ class DefaultViewsTest extends UITestBase {
|
|||
function testDefaultViews() {
|
||||
// Make sure the view starts off as disabled (does not appear on the listing
|
||||
// page).
|
||||
$edit_href = 'admin/structure/views/view/glossary/edit';
|
||||
$edit_href = 'admin/structure/views/view/glossary';
|
||||
$this->drupalGet('admin/structure/views');
|
||||
// @todo Disabled default views do now appear on the front page. Test this
|
||||
// behavior with templates instead.
|
||||
|
@ -88,14 +88,14 @@ class DefaultViewsTest extends UITestBase {
|
|||
);
|
||||
$this->assertTitle(t('Clone of @label | @site-name', array('@label' => 'Glossary', '@site-name' => config('system.site')->get('name'))));
|
||||
$this->drupalPost(NULL, $edit, t('Clone'));
|
||||
$this->assertUrl('admin/structure/views/view/clone_of_glossary/edit', array(), 'The normal cloning name schema is applied.');
|
||||
$this->assertUrl('admin/structure/views/view/clone_of_glossary', array(), 'The normal cloning name schema is applied.');
|
||||
|
||||
// Clone a view and set a custom name.
|
||||
$this->drupalGet('admin/structure/views');
|
||||
$this->clickViewsOperationLink(t('Clone'), '/glossary');
|
||||
$random_name = strtolower($this->randomName());
|
||||
$this->drupalPost(NULL, array('id' => $random_name), t('Clone'));
|
||||
$this->assertUrl("admin/structure/views/view/$random_name/edit", array(), 'The custom view name got saved.');
|
||||
$this->assertUrl("admin/structure/views/view/$random_name", array(), 'The custom view name got saved.');
|
||||
|
||||
// Now disable the view, and make sure it stops appearing on the main view
|
||||
// listing page but instead goes back to displaying on the disabled views
|
||||
|
|
|
@ -80,7 +80,7 @@ class ViewCloneFormController extends ViewFormControllerBase {
|
|||
|
||||
// Redirect the user to the view admin form.
|
||||
$uri = $this->entity->uri();
|
||||
$form_state['redirect'] = $uri['path'] . '/edit';
|
||||
$form_state['redirect'] = $uri['path'];
|
||||
return $this->entity;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue