[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/modules/mod_popular/ -> mod_popular.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  mod_popular
   6   *
   7   * @copyright   (C) 2005 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  defined('_JEXEC') or die;
  12  
  13  use Joomla\CMS\Component\ComponentHelper;
  14  use Joomla\CMS\Helper\ModuleHelper;
  15  use Joomla\CMS\Layout\LayoutHelper;
  16  use Joomla\Module\Popular\Administrator\Helper\PopularHelper;
  17  
  18  $model = $app->bootComponent('com_content')->getMVCFactory()->createModel('Articles', 'Administrator', ['ignore_request' => true]);
  19  $list = PopularHelper::getList($params, $model);
  20  
  21  // Get module data.
  22  if ($params->get('automatic_title', 0)) {
  23      $module->title = PopularHelper::getTitle($params);
  24  }
  25  
  26  // If recording of hits is disabled.
  27  if (!ComponentHelper::getParams('com_content')->get('record_hits', 1)) {
  28      echo LayoutHelper::render('joomla.content.emptystate_module', [
  29          'title'      => 'JGLOBAL_RECORD_HITS_DISABLED',
  30          'icon'       => 'icon-minus-circle',
  31          ]);
  32  
  33      return;
  34  }
  35  
  36  // If there are some articles to display.
  37  if (count($list)) {
  38      require ModuleHelper::getLayoutPath('mod_popular', $params->get('layout', 'default'));
  39  
  40      return;
  41  }
  42  
  43  // If there are no articles to display, show empty state.
  44  $app->getLanguage()->load('com_content');
  45  
  46  echo LayoutHelper::render('joomla.content.emptystate_module', [
  47          'textPrefix' => 'COM_CONTENT',
  48          'icon'       => 'icon-copy',
  49      ]);


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer