You are here

class ActionLinkFlashCommand in Flag 8.4

Flash a message as an action link is updated.

The client side code can be found in js/flag-action_link_flash.js.

Hierarchy

Expanded class hierarchy of ActionLinkFlashCommand

2 files declare their use of ActionLinkFlashCommand
ActionLinkController.php in src/Controller/ActionLinkController.php
ActionLinkFlashCommandTest.php in tests/src/Unit/Ajax/ActionLinkFlashCommandTest.php

File

src/Ajax/ActionLinkFlashCommand.php, line 14

Namespace

Drupal\flag\Ajax
View source
class ActionLinkFlashCommand implements CommandInterface {

  /**
   * Identifies the action link to be flashed.
   *
   * @var string
   */
  protected $selector;

  /**
   * The message to be flashed under the link.
   *
   * @var string
   */
  protected $message;

  /**
   * Construct a message Flasher.
   *
   * @param string $selector
   *   Identifies the action link to be flashed.
   * @param string $message
   *   The message to be displayed.
   */
  public function __construct($selector, $message) {
    $this->selector = $selector;
    $this->message = $message;
  }

  /**
   * {@inheritdoc}
   */
  public function render() {
    return [
      'command' => 'actionLinkFlash',
      'selector' => $this->selector,
      'message' => $this->message,
    ];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ActionLinkFlashCommand::$message protected property The message to be flashed under the link.
ActionLinkFlashCommand::$selector protected property Identifies the action link to be flashed.
ActionLinkFlashCommand::render public function Return an array to be run through json_encode and sent to the client. Overrides CommandInterface::render
ActionLinkFlashCommand::__construct public function Construct a message Flasher.