Skip to content

Instantly share code, notes, and snippets.

@edutrul
Last active August 10, 2018 22:37
Show Gist options
  • Select an option

  • Save edutrul/5e4be84bdfd39fd27493059b3cbf3879 to your computer and use it in GitHub Desktop.

Select an option

Save edutrul/5e4be84bdfd39fd27493059b3cbf3879 to your computer and use it in GitHub Desktop.
How to access node form fields in a hook_form_alter
<?php
$fieldPlus = 'field_layout_region2_icon';
$form[$fieldPlus]['widget']['#title'] = 'widget title';
$form[$fieldPlus]['widget'][0]['#title'] = 'widget 0 title';
$form[$fieldPlus]['widget'][0]['value']['#title'] = 'widget 0 value title';
// If something is printed first! then that should be the way to go.
dpm($form[$fieldPlus]['widget']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment