Joomla CMS  4.2.2
Documentation des API du CMS Joomla en version 4.2.2
Référence de la classe BaseController
+ Graphe d'héritage de BaseController:

Fonctions membres publiques

 __construct ($config=array(), MVCFactoryInterface $factory=null, ?CMSApplication $app=null, ?Input $input=null)
 
 addViewPath ($path)
 
 execute ($task)
 
 getModel ($name='', $prefix='', $config=array())
 
 getName ()
 
 getTask ()
 
 getTasks ()
 
 getView ($name='', $type='', $prefix='', $config=array())
 
 redirect ()
 
 registerDefaultTask ($method)
 
 registerTask ($task, $method)
 
 unregisterTask ($task)
 
 setMessage ($text, $type='message')
 
 checkToken ($method='post', $redirect=true)
 
 setRedirect ($url, $msg=null, $type=null)
 
- Fonctions membres publiques hérités de DispatcherAwareInterface
 setDispatcher (DispatcherInterface $dispatcher)
 

Fonctions membres publiques statiques

static addModelPath ($path, $prefix='')
 
static createFileName ($type, $parts=array())
 
static getInstance ($prefix, $config=array())
 

Fonctions membres protégées

 addPath ($type, $path)
 
 checkEditId ($context, $id)
 
 createModel ($name, $prefix='', $config=array())
 
 createView ($name, $prefix='', $type='', $config=array())
 
 holdEditId ($context, $id)
 
 releaseEditId ($context, $id)
 
 setPath ($type, $path)
 

Attributs protégés

 $basePath
 
 $default_view
 
 $doTask
 
 $message
 
 $messageType
 
 $methods
 
 $name
 
 $model_prefix
 
 $paths
 
 $redirect
 
 $task
 
 $taskMap
 
 $input
 
 $factory
 
 $app
 

Attributs protégés statiques

static $instance
 
static $views
 

Description détaillée

Base class for a Joomla Controller

Controller (Controllers are where you put all the actual code.) Provides basic functionality, such as rendering views (aka displaying templates).

Depuis
2.5.5

Documentation des constructeurs et destructeur

◆ __construct()

__construct (   $config = array(),
MVCFactoryInterface  $factory = null,
?CMSApplication  $app = null,
?Input  $input = null 
)

Constructor.

Paramètres
array$configAn optional associative array of configuration settings. Recognized key values include 'name', 'default_task', 'model_path', and 'view_path' (this list is not meant to be comprehensive).
MVCFactoryInterface$factoryThe factory.
CMSApplication$appThe Application for the dispatcher
Input$inputInput
Depuis
3.0

Références $app, $config, $input, $r, $this, Log\addLogger(), Log\ALL, elseif, Factory\getApplication(), JDEBUG, name, et null.

Documentation des fonctions membres

◆ addModelPath()

static addModelPath (   $path,
  $prefix = '' 
)
static

Adds to the stack of model paths in LIFO order.

Paramètres
mixed$pathThe directory (string), or list of directories (array) to add.
string$prefixA prefix for models
Renvoie
void
Depuis
3.0
Obsolète:
5.0 See ::getInstance

Références $path, $prefix, et BaseModel\addIncludePath().

◆ addPath()

addPath (   $type,
  $path 
)
protected

Adds to the search path for templates and resources.

Paramètres
string$typeThe path type (e.g. 'model', 'view').
mixed$pathThe directory string or stream array to search.
Renvoie
static A object to support chaining.
Depuis
3.0

Références $dir, $path, $this, $type, et Path\check().

◆ addViewPath()

addViewPath (   $path)

Add one or more view paths to the controller's stack, in LIFO order.

Paramètres
mixed$pathThe directory (string) or list of directories (array) to add.
Renvoie
static This object to support chaining.
Depuis
3.0

Références $path.

◆ checkEditId()

checkEditId (   $context,
  $id 
)
protected

Method to check whether an ID is in the edit list.

Paramètres
string$contextThe context for the session storage.
integer$idThe ID of the record to add to the edit list.
Renvoie
boolean True if the ID is in the edit list.
Depuis
3.0

Références $context, $id, $result, et JDEBUG.

◆ checkToken()

checkToken (   $method = 'post',
  $redirect = true 
)

Checks for a form token in the request.

Use in conjunction with HTMLHelper::_('form.token') or Session::getFormToken.

Paramètres
string$methodThe request method in which to look for the token key.
boolean$redirectWhether to implicitly redirect user to the referrer page on failure or simply return false.
Renvoie
boolean True if found and valid, otherwise return false or redirect to referrer page.
Depuis
3.7.0
Voir également
Session::checkToken()

Références $method, Text\_(), Session\checkToken(), et Uri\isInternal().

◆ createFileName()

static createFileName (   $type,
  $parts = array() 
)
static

Create the filename for a resource.

Paramètres
string$typeThe resource type to create the filename for.
array$partsAn associative array of filename information. Optional.
Renvoie
string The filename.
Depuis
3.0

Références $parts, et $type.

Référencé par LegacyFactory\createView().

◆ createModel()

createModel (   $name,
  $prefix = '',
  $config = array() 
)
protected

Method to load and return a model object.

Paramètres
string$nameThe name of the model.
string$prefixOptional model prefix.
array$configConfiguration array for the model. Optional.
Renvoie
BaseDatabaseModel|boolean Model object on success; otherwise false on failure.
Depuis
3.0

Références $config, $model, $name, $prefix, et null.

◆ createView()

createView (   $name,
  $prefix = '',
  $type = '',
  $config = array() 
)
protected

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ètres
string$nameThe name of the view.
string$prefixOptional prefix for the view class name.
string$typeThe type of view.
array$configConfiguration array for the view. Optional.
Renvoie
ViewInterface|null View object on success; null or error result on failure.
Depuis
3.0
Exceptions

Références $config, $name, $prefix, $type, et $view.

◆ execute()

execute (   $task)

Execute a task by triggering a method in the derived class.

Paramètres
string$taskThe task to perform. If no matching task is found, the '__default' task is executed, if defined.
Renvoie
mixed The value returned by the called method.
Depuis
3.0
Exceptions

Implémente ControllerInterface.

Références $task, elseif, et Text\sprintf().

◆ getInstance()

static getInstance (   $prefix,
  $config = array() 
)
static

Method to get a singleton controller instance.

Paramètres
string$prefixThe prefix for the controller.
array$configAn array of optional constructor options.
Renvoie
static
Depuis
3.0
Obsolète:
5.0 Get the controller through the MVCFactory instead
Exceptions

Références $app, $basePath, $class, $config, $format, $input, $path, $prefix, $task, $type, class, elseif, Factory\getApplication(), Factory\getContainer(), InputFilter\getInstance(), Symfony\Contracts\Service\has(), null, et Text\sprintf().

◆ getModel()

getModel (   $name = '',
  $prefix = '',
  $config = array() 
)

Method to get a model object, loading it if required.

Paramètres
string$nameThe model name. Optional.
string$prefixThe class prefix. Optional.
array$configConfiguration array for model. Optional.
Renvoie
BaseDatabaseModel|boolean Model object on success; otherwise false on failure.
Depuis
3.0

Références $config, $item, $menu, $model, $name, $params, $prefix, Path\clean(), elseif, et JPATH_ADMINISTRATOR.

◆ getName()

getName ( )

Method to get the controller name

The dispatcher name is set by default parsed using the classname, or it can be set by passing a $config['name'] in the class constructor

Renvoie
string The name of the dispatcher
Depuis
3.0
Exceptions

Références $name, $r, $this, name, null, et Text\sprintf().

◆ getTask()

getTask ( )

Get the last task that is being performed or was most recently performed.

Renvoie
string The task that is being performed or was most recently performed.
Depuis
3.0

Références $task.

◆ getTasks()

getTasks ( )

Gets the available tasks in the controller.

Renvoie
array Array[i] of task names.
Depuis
3.0

◆ getView()

getView (   $name = '',
  $type = '',
  $prefix = '',
  $config = array() 
)

Method to get a reference to the current view and load it if necessary.

Paramètres
string$nameThe view name. Optional, defaults to the controller name.
string$typeThe view type. Optional.
string$prefixThe class prefix. Optional.
array$configConfiguration array for view. Optional.
Renvoie
ViewInterface Reference to the view or an error.
Depuis
3.0
Exceptions

Références $config, $name, $prefix, $type, $view, Path\clean(), elseif, JPATH_ADMINISTRATOR, et Text\sprintf().

◆ holdEditId()

holdEditId (   $context,
  $id 
)
protected

Method to add a record ID to the edit list.

Paramètres
string$contextThe context for the session storage.
integer$idThe ID of the record to add to the edit list.
Renvoie
void
Depuis
3.0

Références $context, $id, et JDEBUG.

◆ redirect()

redirect ( )

Redirects the browser or returns false if no redirect is set.

Renvoie
boolean False if no redirect exists.
Depuis
3.0

◆ registerDefaultTask()

registerDefaultTask (   $method)

Register the default task to perform if a mapping is not found.

Paramètres
string$methodThe name of the method in the derived class to perform if a named task is not found.
Renvoie
static A object to support chaining.
Depuis
3.0

Références $method, et $this.

◆ registerTask()

registerTask (   $task,
  $method 
)

Register (map) a task to a method in the class.

Paramètres
string$taskThe task.
string$methodThe name of the method in the derived class to perform for this task.
Renvoie
static A object to support chaining.
Depuis
3.0

Références $method, $task, et $this.

◆ releaseEditId()

releaseEditId (   $context,
  $id 
)
protected

Method to check whether an ID is in the edit list.

Paramètres
string$contextThe context for the session storage.
integer$idThe ID of the record to add to the edit list.
Renvoie
void
Depuis
3.0

Références $context, $id, et JDEBUG.

◆ setMessage()

setMessage (   $text,
  $type = 'message' 
)

Sets the internal message that is passed with a redirect

Paramètres
string$textMessage to display on redirect.
string$typeMessage type. Optional, defaults to 'message'.
Renvoie
string Previous message
Depuis
3.0

Références $message, $text, et $type.

◆ setPath()

setPath (   $type,
  $path 
)
protected

Sets an entire array of search paths for resources.

Paramètres
string$typeThe type of path to set, typically 'view' or 'model'.
string$pathThe new set of search paths. If null or false, resets to the current directory only.
Renvoie
void
Depuis
3.0

Références $path, et $type.

◆ setRedirect()

setRedirect (   $url,
  $msg = null,
  $type = null 
)

Set a URL for browser redirection.

Paramètres
string$urlURL to redirect to.
string$msgMessage to display on redirect. Optional, defaults to value set internally by controller, if any.
string$typeMessage type. Optional, defaults to 'message' or the type set by a previous call to setMessage.
Renvoie
static This object to support chaining.
Depuis
3.0

Références $this, $type, $url, et null.

◆ unregisterTask()

unregisterTask (   $task)

Unregister (unmap) a task in the class.

Paramètres
string$taskThe task.
Renvoie
static This object to support chaining.
Depuis
3.0

Références $task, et $this.

Documentation des champs

◆ $app

$app
protected

◆ $basePath

$basePath
protected

◆ $default_view

$default_view
protected

◆ $doTask

$doTask
protected

◆ $factory

$factory
protected

◆ $input

$input
protected

◆ $instance

$instance
staticprotected

◆ $message

$message
protected

◆ $messageType

$messageType
protected

◆ $methods

$methods
protected

◆ $model_prefix

$model_prefix
protected

◆ $name

$name
protected

◆ $paths

$paths
protected

◆ $redirect

$redirect
protected

◆ $task

$task
protected

◆ $taskMap

$taskMap
protected

◆ $views

$views
staticprotected

La documentation de cette classe a été générée à partir du fichier suivant :