class VLMAppendCommand in Views Load More 2.x
Same name and namespace in other branches
- 8 src/Ajax/VLMAppendCommand.php \Drupal\views_load_more\Ajax\VLMAppendCommand
Provides an AJAX command for appending new rows in a paged AJAX response to the rows on the page.
This command is implemented in Drupal.AjaxCommands.prototype.viewsLoadMoreAppend.
Hierarchy
- class \Drupal\views_load_more\Ajax\VLMAppendCommand implements CommandInterface, CommandWithAttachedAssetsInterface uses CommandWithAttachedAssetsTrait
Expanded class hierarchy of VLMAppendCommand
1 file declares its use of VLMAppendCommand
- VLMEventSubscriber.php in src/
EventSubscriber/ VLMEventSubscriber.php
File
- src/
Ajax/ VLMAppendCommand.php, line 17
Namespace
Drupal\views_load_more\AjaxView source
class VLMAppendCommand implements CommandInterface, CommandWithAttachedAssetsInterface {
use CommandWithAttachedAssetsTrait;
/**
* The options for the command.
*
* @var array
*/
protected $options;
/**
* The content to append.
*
* Either a render array or an HTML string.
*
* @var string|array
*/
protected $content;
/**
* Constructs a \Drupal\views\Ajax\ScrollTopCommand object.
* @todo document
*
* @param $content
* @param array $options
* Array with the following keys:
* - method
* - wrapper_selector
* - content_selector
* - pager_selector
* - effect
* - speed
* - target_list
*/
public function __construct($content, $options) {
$this->content = $content;
$defaults = array(
'method' => 'append',
'wrapper_selector' => NULL,
'content_selector' => LoadMore::DEFAULT_CONTENT_SELECTOR,
'pager_selector' => LoadMore::DEFAULT_PAGER_SELECTOR,
'effect' => '',
'speed' => '',
'target_list' => '',
);
$this->options = array_merge($defaults, $options);
}
/**
* Implements \Drupal\Core\Ajax\CommandInterface::render().
*/
public function render() {
return array(
'command' => 'viewsLoadMoreAppend',
'data' => $this
->getRenderedContent(),
'options' => $this->options,
);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CommandWithAttachedAssetsTrait:: |
protected | property | The attached assets for this Ajax command. | |
CommandWithAttachedAssetsTrait:: |
public | function | Gets the attached assets. | |
CommandWithAttachedAssetsTrait:: |
protected | function | Processes the content for output. | |
VLMAppendCommand:: |
protected | property | The content to append. | |
VLMAppendCommand:: |
protected | property | The options for the command. | |
VLMAppendCommand:: |
public | function |
Implements \Drupal\Core\Ajax\CommandInterface::render(). Overrides CommandInterface:: |
|
VLMAppendCommand:: |
public | function | Constructs a \Drupal\views\Ajax\ScrollTopCommand object. @todo document |