Skip to content
Snippets Groups Projects
Commit 2846b529 authored by catch's avatar catch
Browse files

Issue #2633644 by rlhawk, mondrake, r_sharma08: Correct empty text does not...

Issue #2633644 by rlhawk, mondrake, r_sharma08: Correct empty text does not display when there are no image styles
parent 40bf8be8
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -91,9 +91,9 @@ public function getDefaultOperations(EntityInterface $entity) { ...@@ -91,9 +91,9 @@ public function getDefaultOperations(EntityInterface $entity) {
*/ */
public function render() { public function render() {
$build = parent::render(); $build = parent::render();
$build['#empty'] = $this->t('There are currently no styles. <a href=":url">Add a new one</a>.', array( $build['table']['#empty'] = $this->t('There are currently no styles. <a href=":url">Add a new one</a>.', [
':url' => $this->urlGenerator->generateFromRoute('image.style_add'), ':url' => $this->urlGenerator->generateFromRoute('image.style_add'),
)); ]);
return $build; return $build;
} }
......
...@@ -274,6 +274,19 @@ function testStyle() { ...@@ -274,6 +274,19 @@ function testStyle() {
$this->assertFalse(ImageStyle::load($style_name), format_string('Image style %style successfully deleted.', array('%style' => $style->label()))); $this->assertFalse(ImageStyle::load($style_name), format_string('Image style %style successfully deleted.', array('%style' => $style->label())));
// Test empty text when there are no image styles.
// Delete all image styles.
foreach (ImageStyle::loadMultiple() as $image_style) {
$image_style->delete();
}
// Confirm that the empty text is correct on the image styles page.
$this->drupalGet($admin_path);
$this->assertRaw(t('There are currently no styles. <a href=":url">Add a new one</a>.', [
':url' => \Drupal::url('image.style_add'),
]));
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment