-1

I'm working with Drupal8 and i must to create a webform. The thing is that my name and my adress mail are automatically put in the entries..and i don't want this. I'm searching in the settings but i don't find my name etc...

how can I delete them?

 My webform :
    
    Full Name:
       Cecile
    
    Mail:
       [email protected]

you know that i mean ? i want delete this and add placeholder.

thank you in advance

Cecile


i don't know what to do with this hook :

   <?php

/**
 * @file
 * Support module for webform that tests form and element alter hooks.
 */

use Drupal\Core\Form\FormStateInterface;

/******************************************************************************/
// Form hooks.
/******************************************************************************/

/**
 * Implements hook_form_alter().
 */
function webform_test_alter_hooks_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  if (strpos($form_id, 'webform_') === 0) {
    \Drupal::messenger()->addStatus(t("@hook: '@form_id' executed.", ['@hook' => 'hook_form_alter()', '@form_id' => $form_id]), TRUE);
  }
}

/**
 * Implements hook_form_webform_submission_form_alter().
 */
function webform_test_alter_hooks_form_webform_submission_form_alter(array $form, FormStateInterface $form_state, $form_id) {
  \Drupal::messenger()->addStatus(t("@hook: '@form_id' executed.", ['@hook' => 'hook_form_webform_submission_form_alter()', '@form_id' => $form_id]), TRUE);
}

/**
 * Implements hook_form_webform_submission_BASE_FORM_ID_form_alter().
 *
 * @see webform_form_alter()
 * @see \Drupal\webform\WebformSubmissionForm::getBaseFormId
 * @see \Drupal\Core\Form\FormBuilder::prepareForm
 */
function webform_test_alter_hooks_form_webform_submission_contact_form_alter(array $form, FormStateInterface $form_state, $form_id) {
  \Drupal::messenger()->addStatus(t("@hook: '@form_id' executed.", ['@hook' => 'hook_form_webform_submission_BASE_FORM_ID_form_alter()', '@form_id' => $form_id]), TRUE);
}

/**
 * Implements hook_form_webform_submission_FORM_ID_form_alter().
 *
 * @see webform_form_alter()
 * @see \Drupal\webform\WebformSubmissionForm::getFormId
 * @see \Drupal\Core\Form\FormBuilder::prepareForm
 */
function webform_test_alter_hooks_form_webform_submission_contact_add_form_alter(array $form, FormStateInterface $form_state, $form_id) {
  \Drupal::messenger()->addStatus(t("@hook: '@form_id' executed.", ['@hook' => 'hook_form_webform_submission_FORM_ID_form_alter()', '@form_id' => $form_id]), TRUE);
}

/**
 * Implements hook_form_webform_submission_FORM_ID_form_alter().
 *
 * @see webform_form_alter()
 * @see \Drupal\webform\WebformSubmissionForm::getFormId
 * @see \Drupal\Core\Form\FormBuilder::prepareForm
 */
function webform_test_alter_hooks_form_webform_submission_contact_node_1_add_form_alter(array $form, FormStateInterface $form_state, $form_id) {
  \Drupal::messenger()->addStatus(t("@hook: '@form_id' executed.", ['@hook' => 'hook_form_webform_submission_FORM_ID_form_alter()', '@form_id' => $form_id]), TRUE);
}

/**
 * Implements hook_webform_submission_form_alter().
 *
 * @see \Drupal\webform\WebformSubmissionForm::buildForm
 */
function webform_test_alter_hooks_webform_submission_form_alter(array &$form, FormStateInterface $form_state, $form_id) {
  \Drupal::messenger()->addStatus(t("@hook: '@form_id' executed.", ['@hook' => 'hook_webform_submission_form_alter()', '@form_id' => $form_id]), TRUE);
}

/******************************************************************************/
// Element hooks.
/******************************************************************************/

/**
 * Implements hook_webform_element_alter().
 *
 * @see webform.api.php
 * @see \Drupal\webform\WebformSubmissionForm::prepareElements
 */
function webform_test_alter_hooks_webform_element_alter(array &$element, FormStateInterface $form_state, array $context) {
  \Drupal::messenger()->addStatus(t("@hook: '@webform_key' executed.", ['@hook' => 'hook_webform_element_alter()', '@webform_key' => $element['#webform_key']]), TRUE);

}

/**
 * Implements hook_webform_element_ELEMENT_TYPE_alter().
 *
 * @see webform.api.php
 * @see \Drupal\webform\WebformSubmissionForm::prepareElements
 */
function webform_test_alter_hooks_webform_element_email_alter(array &$element, FormStateInterface $form_state, array $context) {
  \Drupal::messenger()->addStatus(t("@hook: '@webform_key' executed.", ['@hook' => 'hook_webform_element_ELEMENT_TYPE_alter()', '@webform_key' => $element['#webform_key']]), TRUE);
}

1 Answer 1

0

Please use the hook form_alter with your form id in your module.theme (module is your themename) file. Refer this enter link description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.