當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Block::delete方法代碼示例

本文整理匯總了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);
 }
開發者ID:sarahwillem,項目名稱:OD8,代碼行數:22,代碼來源:LocalTasksTest.php


注:本文中的Drupal\block\Entity\Block::delete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。