field_ui.module

Same filename in other branches
  1. 7.x modules/field_ui/field_ui.module
  2. 9 core/modules/field_ui/field_ui.module
  3. 8.9.x core/modules/field_ui/field_ui.module
  4. 10 core/modules/field_ui/field_ui.module

File

core/modules/field_ui/field_ui.module

View source
<?php


/**
 * @file
 */
use Drupal\Core\Form\FormStateInterface;
use Drupal\field_ui\FieldUI;

/**
 * Prepares variables for field UI overview table templates.
 *
 * Default template: field-ui-table.html.twig.
 *
 * @param array $variables
 *   An associative array containing:
 *   - elements: An associative array containing a Form API structure to be
 *     rendered as a table.
 */
function template_preprocess_field_ui_table(&$variables) : void {
    template_preprocess_table($variables);
}

/**
 * Implements hook_preprocess_HOOK().
 */
function field_ui_preprocess_form_element__new_storage_type(&$variables) : void {
    // Add support for a variant string so radios in the add field form can be
    // programmatically distinguished.
    $variables['variant'] = $variables['element']['#variant'] ?? NULL;
}

/**
 * Form submission handler for the 'Save and manage fields' button.
 *
 * @see field_ui_form_alter()
 */
function field_ui_form_manage_field_form_submit($form, FormStateInterface $form_state) {
    $provider = $form_state->getFormObject()
        ->getEntity()
        ->getEntityType()
        ->getProvider();
    $id = $form_state->getFormObject()
        ->getEntity()
        ->id();
    if ($form_state->getTriggeringElement()['#parents'][0] === 'save_continue' && ($route_info = FieldUI::getOverviewRouteInfo($provider, $id))) {
        $form_state->setRedirectUrl($route_info);
    }
}

Functions

Title Deprecated Summary
field_ui_form_manage_field_form_submit Form submission handler for the 'Save and manage fields' button.
field_ui_preprocess_form_element__new_storage_type Implements hook_preprocess_HOOK().
template_preprocess_field_ui_table Prepares variables for field UI overview table templates.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.