本文整理汇总了PHP中Drupal\block\Entity\Block::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Block::delete方法的具体用法?PHP Block::delete怎么用?PHP Block::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\block\Entity\Block
的用法示例。
在下文中一共展示了Block::delete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testLocalTaskBlock
/**
* Tests that local task blocks are configurable to show a specific level.
*/
public function testLocalTaskBlock()
{
// Remove the default block and create a new one.
$this->sut->delete();
$this->sut = $this->drupalPlaceBlock('local_tasks_block', ['id' => 'tabs_block', 'primary' => TRUE, 'secondary' => FALSE]);
$this->drupalGet(Url::fromRoute('menu_test.local_task_test_tasks_settings'));
// Verify that local tasks in the first level appear.
$this->assertLocalTasks([['menu_test.local_task_test_tasks_view', []], ['menu_test.local_task_test_tasks_edit', []], ['menu_test.local_task_test_tasks_settings', []]]);
// Verify that local tasks in the second level doesn't appear.
$this->assertNoLocalTasks(1);
$this->sut->delete();
$this->sut = $this->drupalPlaceBlock('local_tasks_block', ['id' => 'tabs_block', 'primary' => FALSE, 'secondary' => TRUE]);
$this->drupalGet(Url::fromRoute('menu_test.local_task_test_tasks_settings'));
// Verify that local tasks in the first level doesn't appear.
$this->assertNoLocalTasks(0);
// Verify that local tasks in the second level appear.
$sub_tasks = [['menu_test.local_task_test_tasks_settings_sub1', []], ['menu_test.local_task_test_tasks_settings_sub2', []], ['menu_test.local_task_test_tasks_settings_sub3', []], ['menu_test.local_task_test_tasks_settings_derived', ['placeholder' => 'derive1']], ['menu_test.local_task_test_tasks_settings_derived', ['placeholder' => 'derive2']]];
$this->assertLocalTasks($sub_tasks, 1);
}