class FormAlter

Hook attribute for FormAlter.

Hierarchy

Expanded class hierarchy of FormAlter

See also

hook_form_alter().

1 file declares its use of FormAlter
ContactFormHooks.php in core/modules/contact/src/Hook/ContactFormHooks.php

File

core/lib/Drupal/Core/Hook/Attribute/FormAlter.php, line 14

Namespace

Drupal\Core\Hook\Attribute
View source
class FormAlter extends Hook {
    
    /**
     * {@inheritdoc}
     */
    public const PREFIX = 'form';
    
    /**
     * {@inheritdoc}
     */
    public const SUFFIX = 'alter';
    
    /**
     * Constructs a FormAlter attribute object.
     *
     * @param string $form_id
     *   (optional) The ID of the form that this implementation alters.
     *   If this is left blank then `form_alter` is the hook that is registered.
     * @param string $method
     *   (optional) The method name. If this attribute is on a method, this
     *   parameter is not required. If this attribute is on a class and this
     *   parameter is omitted, the class must have an __invoke() method, which is
     *   taken as the hook implementation.
     * @param string|null $module
     *   (optional) The module this implementation is for. This allows one module
     *   to implement a hook on behalf of another module. Defaults to the module
     *   the implementation is in.
     * @param \Drupal\Core\Hook\Order\OrderInterface|null $order
     *   (optional) Set the order of the implementation.
     */
    public function __construct(string $form_id = '', string $method = '', ?string $module = NULL, ?OrderInterface $order = NULL) {
        parent::__construct($form_id, $method, $module, $order);
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
FormAlter::PREFIX public constant The hook prefix such as `form`. Overrides Hook::PREFIX
FormAlter::SUFFIX public constant The hook suffix such as `alter`. Overrides Hook::SUFFIX
FormAlter::__construct public function Constructs a FormAlter attribute object. Overrides Hook::__construct

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.