class StandardHooks

Hook implementations for standard.

Hierarchy

Expanded class hierarchy of StandardHooks

File

core/profiles/standard/src/Hook/StandardHooks.php, line 12

Namespace

Drupal\standard\Hook
View source
class StandardHooks {
    
    /**
     * Implements hook_form_FORM_ID_alter() for install_configure_form().
     *
     * Allows the profile to alter the site configuration form.
     */
    public function formInstallConfigureFormAlter(&$form, FormStateInterface $form_state) : void {
        $form['#submit'][] = [
            $this,
            'installConfigureSubmit',
        ];
    }
    
    /**
     * Submission handler to sync the contact.form.feedback recipient.
     *
     * @param array $form
     *   Form array.
     * @param \Drupal\Core\Form\FormStateInterface $form_state
     *   The current form state.
     */
    public function installConfigureSubmit(array $form, FormStateInterface $form_state) : void {
        $site_mail = $form_state->getValue('site_mail');
        ContactForm::load('feedback')->setRecipients([
            $site_mail,
        ])
            ->trustData()
            ->save();
    }

}

Members

Title Sort descending Modifiers Object type Summary
StandardHooks::formInstallConfigureFormAlter public function Implements hook_form_FORM_ID_alter() for install_configure_form().
StandardHooks::installConfigureSubmit public function Submission handler to sync the contact.form.feedback recipient.

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