public function display($tpl = null)
 {
     $this->option = JFactory::getApplication()->input->getCmd('option');
     $container = Prism\Container::getContainer();
     $this->state = $this->get('State');
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     // Get params
     $this->params = $this->state->get('params');
     /** @var  $this->params Joomla\Registry\Registry */
     $this->numberInRow = (int) $this->params->get('featured_items_row', 3);
     $helperBus = new Prism\Helper\HelperBus($this->items);
     $helperBus->addCommand(new Crowdfunding\Helper\PrepareItemsHelper());
     $helperBus->handle();
     $this->displayCreator = (bool) $this->params->get('integration_display_creator', true);
     // Prepare integration. Load avatars and profiles.
     if ($this->displayCreator) {
         $userIds = Prism\Utilities\ArrayHelper::getIds($this->items, 'user_id');
         $this->socialProfiles = CrowdfundingHelper::prepareIntegration($this->params->get('integration_social_platform'), $userIds);
     }
     $this->layoutData = new stdClass();
     $this->layoutData->items = $this->items;
     $this->layoutData->params = $this->params;
     $this->layoutData->money = $this->getMoneyFormatter($container, $this->params);
     $this->layoutData->socialProfiles = $this->socialProfiles;
     $this->layoutData->imageFolder = $this->params->get('images_directory', 'images/crowdfunding');
     $this->prepareDocument();
     parent::display($tpl);
 }
 private function prepareItems($items)
 {
     $options = array();
     $helperBus = new Prism\Helper\HelperBus($items);
     $helperBus->addCommand(new Crowdfunding\Helper\PrepareItemsHelper());
     // Count the number of funders.
     if (strcmp('items_grid_two', $this->params->get('grid_layout')) === 0) {
         $helperBus->addCommand(new Crowdfunding\Helper\PrepareItemFundersHelper(JFactory::getDbo()));
     }
     $helperBus->handle($options);
 }
 private function prepareItems($items)
 {
     $helperBus = new Prism\Helper\HelperBus($items);
     $helperBus->addCommand(new Crowdfunding\Helper\PrepareCategoriesHelper());
     $helperBus->handle();
 }