Back to BaseController class

Method holdEditId

protected void
holdEditId
(mixed $context, mixed $id)
Method to add a record ID to 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
  • void
Since
  • 3.0

Method holdEditId - Source code

/**
 * Method to add a record ID to 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  void
 *
 * @since   3.0
 */
protected function holdEditId($context, $id)
{
    $values = (array) $this->app->getUserState($context . '.id');
    // Add the id to the list if non-zero.
    if (!empty($id)) {
        $values[] = (int) $id;
        $values = array_unique($values);
        $this->app->setUserState($context . '.id', $values);
        if (\defined('JDEBUG') && JDEBUG) {
            $this->app->getLogger()->info(sprintf('Holding edit ID %s.%s %s', $context, $id, str_replace("\n", ' ', print_r($values, 1))), array('category' => 'controller'));
        }
    }
}