Commit d561e62e authored by webchick's avatar webchick

Issue #2806651 by stmh, muschpusch, ifrik, tim.plunkett, msti, SenneS: Replace...

Issue #2806651 by stmh, muschpusch, ifrik, tim.plunkett, msti, SenneS: Replace "Delete" block on the block-layout page with "Remove"
parent 8dc87c91
......@@ -292,6 +292,7 @@ protected function buildVisibilityInterface(array $form, FormStateInterface $for
protected function actions(array $form, FormStateInterface $form_state) {
$actions = parent::actions($form, $form_state);
$actions['submit']['#value'] = $this->t('Save block');
$actions['delete']['#title'] = $this->t('Remove block');
return $actions;
}
......
......@@ -342,6 +342,9 @@ public function getDefaultOperations(EntityInterface $entity) {
$operations['edit']['title'] = $this->t('Configure');
}
if (isset($operations['delete'])) {
$operations['delete']['title'] = $this->t('Remove');
}
return $operations;
}
......
......@@ -17,4 +17,32 @@ public function getCancelUrl() {
return new Url('block.admin_display');
}
/**
* {@inheritdoc}
*/
public function getConfirmText() {
return $this->t('Remove');
}
/**
* {@inheritdoc}
*/
public function getQuestion() {
return $this->t('Are you sure you want to remove the @entity-type %label?', array(
'@entity-type' => $this->getEntity()->getEntityType()->getLowercaseLabel(),
'%label' => $this->getEntity()->label(),
));
}
/**
* {@inheritdoc}
*/
protected function getDeletionMessage() {
$entity = $this->getEntity();
return $this->t('The @entity-type %label has been removed.', array(
'@entity-type' => $entity->getEntityType()->getLowercaseLabel(),
'%label' => $entity->label(),
));
}
}
......@@ -265,18 +265,18 @@ function testBlock() {
// Test deleting the block from the edit form.
$this->drupalGet('admin/structure/block/manage/' . $block['id']);
$this->clickLink(t('Delete'));
$this->assertRaw(t('Are you sure you want to delete the block @name?', array('@name' => $block['settings[label]'])));
$this->drupalPostForm(NULL, array(), t('Delete'));
$this->assertRaw(t('The block %name has been deleted.', array('%name' => $block['settings[label]'])));
$this->clickLink(t('Remove block'));
$this->assertRaw(t('Are you sure you want to remove the block @name?', array('@name' => $block['settings[label]'])));
$this->drupalPostForm(NULL, array(), t('Remove'));
$this->assertRaw(t('The block %name has been removed.', array('%name' => $block['settings[label]'])));
// Test deleting a block via "Configure block" link.
$block = $this->drupalPlaceBlock('system_powered_by_block');
$this->drupalGet('admin/structure/block/manage/' . $block->id(), array('query' => array('destination' => 'admin')));
$this->clickLink(t('Delete'));
$this->assertRaw(t('Are you sure you want to delete the block @name?', array('@name' => $block->label())));
$this->drupalPostForm(NULL, array(), t('Delete'));
$this->assertRaw(t('The block %name has been deleted.', array('%name' => $block->label())));
$this->clickLink(t('Remove block'));
$this->assertRaw(t('Are you sure you want to remove the block @name?', array('@name' => $block->label())));
$this->drupalPostForm(NULL, array(), t('Remove'));
$this->assertRaw(t('The block %name has been removed.', array('%name' => $block->label())));
$this->assertUrl('admin');
$this->assertNoRaw($block->id());
}
......
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