public
__construct
(mixed $config = array(), \Joomla\CMS\MVC\Factory\MVCFactoryInterface $factory = null, \Joomla\CMS\Form\FormFactoryInterface $formFactory = null)
/**
* Constructor.
*
* @param array $config An array of configuration options (name, state, dbo, table_path, ignore_request).
* @param MVCFactoryInterface $factory The factory.
* @param FormFactoryInterface $formFactory The form factory.
*
* @since 1.6
* @throws \Exception
*/
public function __construct($config = array(), MVCFactoryInterface $factory = null, FormFactoryInterface $formFactory = null)
{
parent::__construct($config, $factory, $formFactory);
if (isset($config['event_after_delete'])) {
$this->event_after_delete = $config['event_after_delete'];
} elseif (empty($this->event_after_delete)) {
$this->event_after_delete = 'onContentAfterDelete';
}
if (isset($config['event_after_save'])) {
$this->event_after_save = $config['event_after_save'];
} elseif (empty($this->event_after_save)) {
$this->event_after_save = 'onContentAfterSave';
}
if (isset($config['event_before_delete'])) {
$this->event_before_delete = $config['event_before_delete'];
} elseif (empty($this->event_before_delete)) {
$this->event_before_delete = 'onContentBeforeDelete';
}
if (isset($config['event_before_save'])) {
$this->event_before_save = $config['event_before_save'];
} elseif (empty($this->event_before_save)) {
$this->event_before_save = 'onContentBeforeSave';
}
if (isset($config['event_before_change_state'])) {
$this->event_before_change_state = $config['event_before_change_state'];
} elseif (empty($this->event_before_change_state)) {
$this->event_before_change_state = 'onContentBeforeChangeState';
}
if (isset($config['event_change_state'])) {
$this->event_change_state = $config['event_change_state'];
} elseif (empty($this->event_change_state)) {
$this->event_change_state = 'onContentChangeState';
}
if (isset($config['event_before_batch'])) {
$this->event_before_batch = $config['event_before_batch'];
} elseif (empty($this->event_before_batch)) {
$this->event_before_batch = 'onBeforeBatch';
}
$config['events_map'] = $config['events_map'] ?? array();
$this->events_map = array_merge(array('delete' => 'content', 'save' => 'content', 'change_state' => 'content', 'validate' => 'content'), $config['events_map']);
// Guess the \Text message prefix. Defaults to the option.
if (isset($config['text_prefix'])) {
$this->text_prefix = strtoupper($config['text_prefix']);
} elseif (empty($this->text_prefix)) {
$this->text_prefix = strtoupper($this->option);
}
}