Drupal 8.0.0 beta 12. More info: https://www.drupal.org/node/2514176
This commit is contained in:
commit
9921556621
13277 changed files with 1459781 additions and 0 deletions
46
core/modules/views/src/Ajax/ScrollTopCommand.php
Normal file
46
core/modules/views/src/Ajax/ScrollTopCommand.php
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\views\Ajax\ScrollTopCommand.
|
||||
*/
|
||||
|
||||
namespace Drupal\views\Ajax;
|
||||
|
||||
use Drupal\Core\Ajax\CommandInterface;
|
||||
|
||||
/**
|
||||
* Provides an AJAX command for scrolling to the top of an element.
|
||||
*
|
||||
* This command is implemented in Drupal.AjaxCommands.prototype.viewsScrollTop.
|
||||
*/
|
||||
class ScrollTopCommand implements CommandInterface {
|
||||
|
||||
/**
|
||||
* A CSS selector string.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $selector;
|
||||
|
||||
/**
|
||||
* Constructs a \Drupal\views\Ajax\ScrollTopCommand object.
|
||||
*
|
||||
* @param string $selector
|
||||
* A CSS selector.
|
||||
*/
|
||||
public function __construct($selector) {
|
||||
$this->selector = $selector;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements \Drupal\Core\Ajax\CommandInterface::render().
|
||||
*/
|
||||
public function render() {
|
||||
return array(
|
||||
'command' => 'viewsScrollTop',
|
||||
'selector' => $this->selector,
|
||||
);
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue