Back to BaseController class

Method createView

protected \Joomla\CMS\MVC\View\ViewInterface|null
createView
(mixed $name, mixed $prefix = '', mixed $type = '', mixed $config = array())
Method to load and return a view object. This method first looks in the current template directory for a match and, failing that, uses a default set path to load the view class file.
Parameters
  • string $name The name of the view.
  • string $prefix Optional prefix for the view class name.
  • string $type The type of view.
  • array $config Configuration array for the view. Optional.
Returns
  • \Joomla\CMS\MVC\View\ViewInterface|null View object on success; null or error result on failure.
Since
  • 3.0
-
  • \Exception

Method createView - Source code

/**
 * Method to load and return a view object. This method first looks in the
 * current template directory for a match and, failing that, uses a default
 * set path to load the view class file.
 *
 * Note the "name, prefix, type" order of parameters, which differs from the
 * "name, type, prefix" order used in related public methods.
 *
 * @param   string  $name    The name of the view.
 * @param   string  $prefix  Optional prefix for the view class name.
 * @param   string  $type    The type of view.
 * @param   array   $config  Configuration array for the view. Optional.
 *
 * @return  ViewInterface|null  View object on success; null or error result on failure.
 *
 * @since   3.0
 * @throws  \Exception
 */
protected function createView($name, $prefix = '', $type = '', $config = array())
{
    $config['paths'] = $this->paths['view'];
    return $this->factory->createView($name, $prefix, $type, $config);
}