I’m trying to change the label and field instructions for the name field on the User Account Creation form. I’m new to coding, and thought this would be an easy task.
My custom module is enabled and I’ve cleared caches, but none of my changes show up. Here is my code. I’ve tried a bunch of variations and a bunch of searching, but I never see a single sign of this working.
<?php /** * @file * Contains mymodule.module. */ use DrupalCoreFormFormStateInterface; /** * Implements hook_form_FORM_ID_alter() on behalf of mymodule.module. * @see Array method Array at Array */ function mymodule_form_account_alter(&$form, FormStateInterface $form_state, $form_id) { // print_r($form); die; // ksm($form_id); if ($form_id == 'user_register_form') { // print_r($form); die; // kint($form_id); $form['name'] = array( '#type' => 'textfield', '#title' => $this->t('First and last name'), '#maxlength' => USERNAME_MAX_LENGTH, '#description' => $this->t("Rewrite this about spaces, periods (.), hyphens (-) and apostrophes (')."), ); } drupal_set_message('mymodule_form_account_alter() executed.'); }