List widget now supports injecting cssClasses

This commit is contained in:
Sam Georges 2014-06-30 19:57:53 +10:00
parent 2f63a6ca0b
commit 5ce21e2fae
2 changed files with 7 additions and 1 deletions

View File

@ -130,6 +130,11 @@ class Lists extends WidgetBase
*/
public $treeExpanded = true;
/**
* @var array List of CSS classes to apply to the list container element
*/
public $cssClasses = [];
/**
* Initialize the widget, called by the constructor and free from its parameters.
*/
@ -176,6 +181,7 @@ class Lists extends WidgetBase
*/
public function prepareVars()
{
$this->vars['cssClasses'] = implode(' ', $this->cssClasses);
$this->vars['columns'] = $this->getVisibleListColumns();
$this->vars['columnTotal'] = $this->getTotalColumns();
$this->vars['records'] = $this->getRecords();

View File

@ -1,3 +1,3 @@
<div class="list-widget" id="<?= $this->getId() ?>">
<div class="list-widget <?= $cssClasses ?>" id="<?= $this->getId() ?>">
<?= $this->makePartial('list') ?>
</div>