5 * Field UI test module.
8 use Drupal\Core\Access\AccessResult;
9 use Drupal\Core\Form\FormStateInterface;
10 use Drupal\Core\Render\Element;
11 use Drupal\Core\Field\FieldConfigInterface;
14 * Implements hook_ENTITY_TYPE_access().
16 function field_ui_test_field_config_access(FieldConfigInterface $field) {
17 return AccessResult::forbiddenIf($field->getName() == 'highlander');
21 * Implements hook_form_FORM_BASE_ID_alter().
23 function field_ui_test_form_entity_view_display_edit_form_alter(&$form, FormStateInterface $form_state) {
24 $table = &$form['fields'];
26 foreach (Element::children($table) as $name) {
27 $table[$name]['parent_wrapper']['parent']['#options'] = ['indent' => 'Indent'];
28 $table[$name]['parent_wrapper']['parent']['#default_value'] = 'indent';
32 '#attributes' => ['class' => ['draggable', 'field-group'], 'id' => 'indent-id'],
33 '#row_type' => 'group',
34 '#region_callback' => 'field_ui_test_region_callback',
35 '#js_settings' => ['rowHandler' => 'group'],
37 '#markup' => 'Indent',
38 '#prefix' => '<span class="group-label">',
39 '#suffix' => '</span>',
42 '#type' => 'textfield',
43 '#default_value' => 0,
45 '#attributes' => ['class' => ['field-weight']],
50 '#options' => ['indent' => 'Indent'],
52 '#default_value' => '',
53 '#attributes' => ['class' => ['field-parent']],
54 '#parents' => ['fields', 'indent', 'parent'],
58 '#default_value' => 'indent',
59 '#attributes' => ['class' => ['field-name']],
66 function field_ui_test_region_callback($row) {