New answers tagged

0

From Programmatically modifying a webform with hook_form_alter(): function mymodule_form_alter( &$form, &$form_state,$form_id ){ global $user; if (!$user->uid && $form_id == 'MY_WEBFORM_ID') { $form['submitted']['MY_FORM_COMPONENT']['#disabled'] = TRUE; } }


0

Vielen dank dafür, dass war genau das was ich brauchte. Und ich habe das auch soweit hin bekommen in der node edit version: <?php use Drupal\node\NodeInterface; use Drupal\Core\Form\FormStateInterface; /** * Implements hook_ENTITY_TYPE_prepare_form() for node entities. */ function copy_fields_from_model_contract_node_edit_node_prepare_form(...


1

Use hook_ENTITY_TYPE_prepare_form if you want to change a field value before the form is built for an existing node: <?php use Drupal\node\NodeInterface; use Drupal\Core\Form\FormStateInterface; /** * Implements hook_ENTITY_TYPE_prepare_form() for node entities. */ function mymodule_node_prepare_form(NodeInterface $node, $operation, FormStateInterface ...


Top 50 recent answers are included