Commit bc65e535 authored by catch's avatar catch
Browse files

Issue #2187335 by mondrake: Cannot delete image styles from UI any longer.

parent 54f8683d
......@@ -41,7 +41,8 @@
* },
* links = {
* "flush-form" = "image.style_flush",
* "edit-form" = "image.style_edit"
* "edit-form" = "image.style_edit",
* "delete-form" = "image.style_delete"
* }
* )
*/
......
......@@ -86,6 +86,7 @@ public function buildForm(array $form, array &$form_state, ImageStyleInterface $
'#value' => $request->query->has('weight') ? (int) $request->query->get('weight') : $this->imageEffect->getWeight(),
);
$image_style_uri = $this->imageStyle->urlInfo('edit-form');
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
'#type' => 'submit',
......@@ -94,7 +95,8 @@ public function buildForm(array $form, array &$form_state, ImageStyleInterface $
$form['actions']['cancel'] = array(
'#type' => 'link',
'#title' => $this->t('Cancel'),
'#href' => 'admin/config/media/image-styles/manage/' . $this->imageStyle->id(),
'#route_name' => $image_style_uri['route_name'],
'#route_parameters' => $image_style_uri['route_parameters'],
);
return $form;
}
......
......@@ -67,10 +67,12 @@ function testNumericStyleName() {
* General test to add a style, add/remove/edit effects to it, then delete it.
*/
function testStyle() {
$admin_path = 'admin/config/media/image-styles';
// Setup a style to be created and effects to add to it.
$style_name = strtolower($this->randomName(10));
$style_label = $this->randomString();
$style_path = 'admin/config/media/image-styles/manage/' . $style_name;
$style_path = $admin_path . '/manage/' . $style_name;
$effect_edits = array(
'image_resize' => array(
'data[width]' => 100,
......@@ -106,9 +108,15 @@ function testStyle() {
'name' => $style_name,
'label' => $style_label,
);
$this->drupalPostForm('admin/config/media/image-styles/add', $edit, t('Create new style'));
$this->drupalPostForm($admin_path . '/add', $edit, t('Create new style'));
$this->assertRaw(t('Style %name was created.', array('%name' => $style_label)));
// Ensure that the expected entity operations are there.
$this->drupalGet($admin_path);
$this->assertLinkByHref($style_path);
$this->assertLinkByHref($style_path . '/flush');
$this->assertLinkByHref($style_path . '/delete');
// Add effect form.
// Add each sample effect to the style.
......
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