You are here

class ajaxCommentsScrollToElementCommand in AJAX Comments 8

AJAX command for calling the ajaxCommentsScrollToElement() method.

Hierarchy

Expanded class hierarchy of ajaxCommentsScrollToElementCommand

File

src/Ajax/ajaxCommentsScrollToElementCommand.php, line 17
Contains \Drupal\ajax_comments\Ajax\ajaxCommentsScrollToElementCommand.

Namespace

Drupal\ajax_comments\Ajax
View source
class ajaxCommentsScrollToElementCommand implements CommandInterface {

  /**
   * The CSS selector for the element.
   *
   * @var string
   */
  protected $selector;

  /**
   * Constructs a ajaxCommentsScrollToElementCommand object.
   *
   * @param string $selector
   *
   */
  public function __construct($selector) {
    $this->selector = $selector;
  }

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

}

Members

Namesort descending Modifiers Type Description Overrides
ajaxCommentsScrollToElementCommand::$selector protected property The CSS selector for the element.
ajaxCommentsScrollToElementCommand::render public function Return an array to be run through json_encode and sent to the client. Overrides CommandInterface::render
ajaxCommentsScrollToElementCommand::__construct public function Constructs a ajaxCommentsScrollToElementCommand object.