本文整理匯總了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);
}