Back to AbstractView class

Method __construct

public
__construct
(mixed $config = array())
Constructor
Parameters
  • array $config A named configuration array for object construction. name: the name (optional) of the view (defaults to the view class name suffix). charset: the character set to use for display escape: the name (optional) of the function to use for escaping strings base_path: the parent path (optional) of the views directory (defaults to the component folder) template_plath: the path (optional) of the layout directory (defaults to base_path + /views/ + view name helper_path: the path (optional) of the helper files (defaults to base_path + /helpers/) layout: the layout (optional) to use to display the view
Since
  • 3.0
Class: AbstractView
Project: Joomla

Method __construct - Source code

/**
 * Constructor
 *
 * @param   array  $config  A named configuration array for object construction.
 *                          name: the name (optional) of the view (defaults to the view class name suffix).
 *                          charset: the character set to use for display
 *                          escape: the name (optional) of the function to use for escaping strings
 *                          base_path: the parent path (optional) of the views directory (defaults to the component folder)
 *                          template_plath: the path (optional) of the layout directory (defaults to base_path + /views/ + view name
 *                          helper_path: the path (optional) of the helper files (defaults to base_path + /helpers/)
 *                          layout: the layout (optional) to use to display the view
 *
 * @since   3.0
 */
public function __construct($config = array())
{
    // Set the view name
    if (empty($this->_name)) {
        if (\array_key_exists('name', $config)) {
            $this->_name = $config['name'];
        } else {
            $this->_name = $this->getName();
        }
    }
    // Set the component name if passed
    if (!empty($config['option'])) {
        $this->option = $config['option'];
    }
}