/** * Handle the command. * * @param ConfigurationRepositoryInterface $configuration */ public function handle(ConfigurationRepositoryInterface $configuration) { /* @var ConfigurationInterface $html */ $html = $configuration->get('anomaly.extension.html_widget::html', $this->widget->getId()); /* @var EditorFieldTypePresenter $presenter */ if ($presenter = $html->getFieldTypePresenter('value')) { $this->widget->addData('html', $presenter->parsed()); } }
/** * Handle the widget data. */ public function handle(\SimplePie $rss, Repository $cache, ConfigurationRepositoryInterface $configuration) { $items = $cache->remember(__METHOD__, 30, function () use($rss, $configuration) { // Let Laravel cache everything. $rss->enable_cache(false); // Hard-code this for now. $rss->set_feed_url($configuration->value('anomaly.extension.xml_feed_widget::url', $this->widget->getId(), 'http://www.pyrocms.com/posts/rss.xml')); // Make the request. $rss->init(); return $rss->get_items(0, 5); }); // Load the items to the widget's view data. $this->widget->addData('items', $items); }