<?php
namespace Lee\Widget;
use XF\Widget\AbstractWidget;
class NodeViewers extends AbstractWidget
{
protected $defaultOptions = [
'limit' => 50
];
public function render()
{
// grab those viewing node X and send to your widgets template via viewparams
// your code here
$viewParams = [
'viewers' => array_slice($viewers, 0, $options['limit']),
'title' => $this->getTitle(),
'hasMore' => $hasMore
];
return $this->renderer('lee_widget_node_viewers', $viewParams);
}
public function verifyOptions(\XF\Http\Request $request, array &$options, &$error = null)
{
$options = $request->filter([
'limit' => 'uint'
]);
if ($options['limit'] < 1)
{
$options['limit'] = 1;
}
return true;
}
}