VLMAppendCommand.php in Views Load More 8
File
src/Ajax/VLMAppendCommand.php
View source
<?php
namespace Drupal\views_load_more\Ajax;
use Drupal\Core\Ajax\CommandInterface;
use Drupal\Core\Ajax\CommandWithAttachedAssetsInterface;
use Drupal\Core\Ajax\CommandWithAttachedAssetsTrait;
use Drupal\views_load_more\Plugin\views\pager\LoadMore;
class VLMAppendCommand implements CommandInterface, CommandWithAttachedAssetsInterface {
use CommandWithAttachedAssetsTrait;
protected $options;
protected $content;
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);
}
public function render() {
return array(
'command' => 'viewsLoadMoreAppend',
'data' => $this
->getRenderedContent(),
'options' => $this->options,
);
}
}
Classes
Name |
Description |
VLMAppendCommand |
Provides an AJAX command for appending new rows in a paged AJAX response
to the rows on the page. |