Back to ListModel class

Method __construct

public
__construct
(mixed $config = array(), \Joomla\CMS\MVC\Factory\MVCFactoryInterface $factory = null)
Constructor
Parameters
  • array $config An array of configuration options (name, state, dbo, table_path, ignore_request).
  • \Joomla\CMS\MVC\Factory\MVCFactoryInterface $factory The factory.
Since
  • 1.6
-
  • \Exception
Class: ListModel
Project: Joomla

Method __construct - Source code

/**
 * Constructor
 *
 * @param   array                $config   An array of configuration options (name, state, dbo, table_path, ignore_request).
 * @param   MVCFactoryInterface  $factory  The factory.
 *
 * @since   1.6
 * @throws  Exception
 */
public function __construct($config = array(), MVCFactoryInterface $factory = null)
{
    parent::__construct($config, $factory);
    // Add the ordering filtering fields allowed list.
    if (isset($config['filter_fields'])) {
        $this->filter_fields = $config['filter_fields'];
    }
    // Guess the context as Option.ModelName.
    if (empty($this->context)) {
        $this->context = strtolower($this->option . '.' . $this->getName());
    }
    // @deprecated in 4.0 remove in Joomla 5.0
    if (!empty($this->filterBlacklist)) {
        $this->filterForbiddenList = array_merge($this->filterBlacklist, $this->filterForbiddenList);
    }
    // @deprecated in 4.0 remove in Joomla 5.0
    if (!empty($this->listBlacklist)) {
        $this->listForbiddenList = array_merge($this->listBlacklist, $this->listForbiddenList);
    }
}