You are here

function recipe_form_field_config_edit_form_alter in Recipe 8.2

Implements hook_form_BASE_FORM_ID_alter() for 'field_config_edit_form'.

File

./recipe.module, line 40
Contains functions for Recipe node CRUD and display.

Code

function recipe_form_field_config_edit_form_alter(&$form, FormStateInterface $form_state) {
  $field = $form_state
    ->getFormObject()
    ->getEntity();
  if ($field
    ->getTargetBundle() == 'recipe' && $field
    ->getType() == 'integer') {
    $form['third_party_settings']['recipe']['total_time'] = [
      '#type' => 'checkbox',
      '#title' => t("Add this field's value to the Recipe's total time."),
      '#default_value' => $field
        ->getThirdPartySetting('recipe', 'total_time', 0),
    ];
  }
}