简体   繁体   English

网络表单更改 drupal 8

[英]webform alter drupal 8

i'm new on drupal 8 and i want to try to custom the basic template of the webform module with my own template in TWIG , SASS.我是 drupal 8 的新手,我想尝试在 TWIG ,SASS 中使用我自己的模板自定义 webform 模块的基本模板。 I know i have to create a custom module but after read the drupal documentation , i don't know how i can do it correctly.我知道我必须创建一个自定义模块,但在阅读了 drupal 文档后,我不知道如何正确地做到这一点。 Any one can help me ?任何人都可以帮助我吗? i try to create a module with this code我尝试使用此代码创建一个模块

function webform_example_form_alter(&$form, &$form_state, $id) {
  if ($id == 'webform_submission_contact_form') {
    $form['elements']['name']['#title'] = t('Name');
  }
}

Your code example makes perfect sense to me.您的代码示例对我来说非常有意义。

You can also use hook_form_BASE_ID_alter() , which for the Contact form would be webform_example_form_webform_submission_contact_form_alter().您还可以使用hook_form_BASE_ID_alter() ,对于联系表单,它是 webform_example_form_webform_submission_contact_form_alter()。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM