33 lines
811 B
PHP
33 lines
811 B
PHP
<?php namespace JasonWilliams\Feed\Components;
|
|
|
|
use Db;
|
|
use Cms\Classes\ComponentBase;
|
|
use JasonWilliams\Feed\Models\Tags;
|
|
|
|
class TagList extends ComponentBase
|
|
{
|
|
public function componentDetails()
|
|
{
|
|
return [
|
|
'name' => 'Tag List',
|
|
'description' => 'Displays a list of feed tags.'
|
|
];
|
|
}
|
|
|
|
public function defineProperties()
|
|
{
|
|
return [];
|
|
}
|
|
|
|
public function onRun()
|
|
{
|
|
$this->page['renderPartial'] = $this->property('tagPartial');
|
|
$this->addJs('/plugins/jasonwilliams/feed/assets/javascript/loadtaglist.js');
|
|
}
|
|
|
|
public function onAjaxDataRequested()
|
|
{
|
|
return Tags::groupBy('tag')->select(Db::raw('tag, count(*) as count'))->orderBy('count', 'desc')->get();
|
|
}
|
|
}
|