function AreaTest::testTitleArea
Tests overriding the view title using the area title handler.
File
- 
              core/
modules/ views/ tests/ src/ Functional/ Handler/ AreaTest.php, line 139  
Class
- AreaTest
 - Tests the plugin base of the area handler.
 
Namespace
Drupal\Tests\views\Functional\HandlerCode
public function testTitleArea() : void {
  $view = Views::getView('frontpage');
  $view->initDisplay('page_1');
  // Add the title area handler to the empty area.
  $view->displayHandlers
    ->get('page_1')
    ->overrideOption('empty', [
    'title' => [
      'id' => 'title',
      'table' => 'views',
      'field' => 'title',
      'admin_label' => '',
      'empty' => '0',
      'title' => 'Overridden title',
      'plugin_id' => 'title',
    ],
  ]);
  $view->storage
    ->enable()
    ->save();
  $this->drupalGet('node');
  $this->assertSession()
    ->pageTextContains('Overridden title');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.