Back to Joomla project (class list)

Class ApiController - list of methods

Base class for a Joomla API Controller
Controller (controllers are where you put all the actual code) Provides basic functionality, such as rendering views (aka displaying templates).

Extends

Package: Joomla\CMS\MVC\Controller
Copyright: (C) 2019 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
Located at: Joomla/MVC/Controller/ApiController.php
Project: Joomla

Method Summary

public
(mixed $config = array(), \Joomla\CMS\MVC\Factory\MVCFactoryInterface $factory = null, ?\Joomla\CMS\Application\CMSApplication $app = null, ?\Joomla\Input\Input $input = null)

Constructor.
Parameters
  • array $config An 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).
  • \Joomla\CMS\MVC\Factory\MVCFactoryInterface $factory The factory.
  • \Joomla\CMS\Application\CMSApplication $app The Application for the dispatcher
  • \Joomla\Input\Input $input Input
Since
  • 4.0.0
-
  • \Exception
Show source code of this method: __construct Source Code

public static
(mixed $id = null)

Basic display of an item view
Parameters
  • int $id The primary key to display. Leave empty if you want to retrieve data from the request
Returns
  • static A \JControllerLegacy object to support chaining.
Since
  • 4.0.0
Show source code of this method: displayItem Source Code

public static
()

Basic display of a list view
Returns
  • static A \JControllerLegacy object to support chaining.
Since
  • 4.0.0
Show source code of this method: displayList Source Code

public void
(mixed $id = null)

Removes an item.
Parameters
  • int $id The primary key to delete item.
Returns
  • void
Since
  • 4.0.0
Show source code of this method: delete Source Code

public void
()

Method to add a new record.
Returns
  • void
Since
  • 4.0.0
-
  • \Joomla\CMS\Access\Exception\NotAllowed
  • \RuntimeException
Show source code of this method: add Source Code

public static
()

Method to edit an existing record.
Returns
  • static A \JControllerLegacy object to support chaining.
Since
  • 4.0.0
Show source code of this method: edit Source Code

protected int
(mixed $recordKey = null)

Method to save a record.
Parameters
  • int $recordKey The primary key of the item (if exists)
Returns
  • int The record ID on success, false on failure
Since
  • 4.0.0
Show source code of this method: save Source Code

protected bool
(mixed $data = array(), mixed $key = 'id')

Method to check if you can edit an existing record.
Parameters
  • array $data An array of input data.
  • string $key The name of the key for the primary key; default is id.
Returns
  • bool
Since
  • 4.0.0
Show source code of this method: allowEdit Source Code

protected bool
(mixed $data = array())

Method to check if you can add a new record.
Parameters
  • array $data An array of input data.
Returns
  • bool
Since
  • 4.0.0
Show source code of this method: allowAdd Source Code

protected array
(array $data)

Method to allow extended classes to manipulate the data to be saved for an extension.
Parameters
  • array $data An array of input data.
Returns
  • array
Since
  • 4.0.0
Show source code of this method: preprocessSaveData Source Code

Properties Summary

protected string
$contentType
The content type of the item.
Since
  • 4.0.0
protected string
$option
The URL option for the component.
Since
  • 4.0.0
protected string
$text_prefix
The prefix to use with controller messages.
Since
  • 4.0.0
protected string
$context
The context for storing internal data, e.g. record.
Since
  • 4.0.0
protected int
$itemsPerPage
Items on a page
protected \Joomla\CMS\Object\CMSObject
$modelState
The model state to inject

Tags Summary

Since
4.0.0