Back to Captcha class

Method display

public string
display
(mixed $name, mixed $id, mixed $class = '')
Get the HTML for the captcha.
Parameters
  • string $name The control name.
  • string $id The id for the control.
  • string $class Value for the HTML class attribute
Returns
  • string The return value of the function "onDisplay" of the selected Plugin.
Since
  • 2.5
-
  • \RuntimeException
Class: Captcha
Project: Joomla

Method display - Source code

/**
 * Get the HTML for the captcha.
 *
 * @param   string  $name   The control name.
 * @param   string  $id     The id for the control.
 * @param   string  $class  Value for the HTML class attribute
 *
 * @return  string  The return value of the function "onDisplay" of the selected Plugin.
 *
 * @since   2.5
 * @throws  \RuntimeException
 */
public function display($name, $id, $class = '')
{
    // Check if captcha is already loaded.
    if ($this->captcha === null) {
        return '';
    }
    // Initialise the Captcha.
    if (!$this->initialise($id)) {
        return '';
    }
    $arg = ['name' => $name, 'id' => $id ?: $name, 'class' => $class];
    $result = $this->update('onDisplay', $arg);
    return $result;
}