You are here

class Messages in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/area/Messages.php \Drupal\views\Plugin\views\area\Messages
  2. 9 core/modules/views/src/Plugin/views/area/Messages.php \Drupal\views\Plugin\views\area\Messages

Provides an area for messages.

Plugin annotation

@ViewsArea("messages");

Hierarchy

  • class \Drupal\views\Plugin\views\area\AreaPluginBase extends \Drupal\views\Plugin\views\HandlerBase
    • class \Drupal\views\Plugin\views\area\Messages

Expanded class hierarchy of Messages

Related topics

1 file declares its use of Messages
MessagesTest.php in core/modules/views/tests/src/Unit/Plugin/area/MessagesTest.php
2 string references to 'Messages'
hook_toolbar in core/modules/toolbar/toolbar.api.php
Add items to the toolbar menu.
views_views_data in core/modules/views/views.views.inc
Implements hook_views_data().

File

core/modules/views/src/Plugin/views/area/Messages.php, line 12

Namespace

Drupal\views\Plugin\views\area
View source
class Messages extends AreaPluginBase {

  /**
   * {@inheritdoc}
   */
  protected function defineOptions() {
    $options = parent::defineOptions();

    // Set the default to TRUE so it shows on empty pages by default.
    $options['empty']['default'] = TRUE;
    return $options;
  }

  /**
   * {@inheritdoc}
   */
  public function render($empty = FALSE) {
    if (!$empty || !empty($this->options['empty'])) {
      return [
        '#type' => 'status_messages',
      ];
    }
    return [];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AreaPluginBase::$areaType public property The type of this area handler, i.e. 'header', 'footer', or 'empty'.
AreaPluginBase::adminSummary public function
AreaPluginBase::buildOptionsForm public function 7
AreaPluginBase::init public function Overrides Drupal\views\Plugin\views\HandlerBase::init(). 1
AreaPluginBase::isEmpty public function Does that area have nothing to show. 1
AreaPluginBase::preRender public function Performs any operations needed before full rendering. 1
AreaPluginBase::usesGroupBy public function
Messages::defineOptions protected function Overrides AreaPluginBase::defineOptions
Messages::render public function Render the area. Overrides AreaPluginBase::render