[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_finder/src/Table/ -> MapTable.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_finder
   6   *
   7   * @copyright   (C) 2011 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  namespace Joomla\Component\Finder\Administrator\Table;
  12  
  13  use Joomla\CMS\Application\ApplicationHelper;
  14  use Joomla\CMS\Factory;
  15  use Joomla\CMS\Language\Text;
  16  use Joomla\CMS\Table\Nested;
  17  use Joomla\Database\DatabaseDriver;
  18  
  19  // phpcs:disable PSR1.Files.SideEffects
  20  \defined('_JEXEC') or die;
  21  // phpcs:enable PSR1.Files.SideEffects
  22  
  23  /**
  24   * Map table class for the Finder package.
  25   *
  26   * @since  2.5
  27   */
  28  class MapTable extends Nested
  29  {
  30      /**
  31       * Constructor
  32       *
  33       * @param   DatabaseDriver  $db  Database Driver connector object.
  34       *
  35       * @since   2.5
  36       */
  37      public function __construct(DatabaseDriver $db)
  38      {
  39          parent::__construct('#__finder_taxonomy', 'id', $db);
  40  
  41          $this->setColumnAlias('published', 'state');
  42          $this->access = (int) Factory::getApplication()->get('access');
  43      }
  44  
  45      /**
  46       * Override check function
  47       *
  48       * @return  boolean
  49       *
  50       * @see     Table::check()
  51       * @since   4.0.0
  52       */
  53      public function check()
  54      {
  55          try {
  56              parent::check();
  57          } catch (\Exception $e) {
  58              $this->setError($e->getMessage());
  59  
  60              return false;
  61          }
  62  
  63          // Check for a title.
  64          if (trim($this->title) == '') {
  65              $this->setError(Text::_('JLIB_DATABASE_ERROR_MUSTCONTAIN_A_TITLE_CATEGORY'));
  66  
  67              return false;
  68          }
  69  
  70          $this->alias = ApplicationHelper::stringURLSafe($this->title, $this->language);
  71  
  72          if (trim($this->alias) == '') {
  73              $this->alias = md5(serialize($this->getProperties()));
  74          }
  75  
  76          return true;
  77      }
  78  }


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