Back to BaseController class

Method checkEditId

protected bool
checkEditId
(mixed $context, mixed $id)
Method to check whether an ID is in the edit list.
Parameters
  • string $context The context for the session storage.
  • int $id The ID of the record to add to the edit list.
Returns
  • bool True if the ID is in the edit list.
Since
  • 3.0

Method checkEditId - Source code

/**
 * Method to check whether an ID is in the edit list.
 *
 * @param   string   $context  The context for the session storage.
 * @param   integer  $id       The ID of the record to add to the edit list.
 *
 * @return  boolean  True if the ID is in the edit list.
 *
 * @since   3.0
 */
protected function checkEditId($context, $id)
{
    if ($id) {
        $values = (array) $this->app->getUserState($context . '.id');
        $result = \in_array((int) $id, $values);
        if (\defined('JDEBUG') && JDEBUG) {
            $this->app->getLogger()->info(sprintf('Checking edit ID %s.%s: %d %s', $context, $id, (int) $result, str_replace("\n", ' ', print_r($values, 1))), array('category' => 'controller'));
        }
        return $result;
    }
    // No id for a new item.
    return true;
}