You are here

function farm_location_form_asset_form_alter in farmOS 2.x

Implements hook_form_BASE_FORM_ID_alter().

File

modules/core/location/farm_location.module, line 16
Contains farm_location.module.

Code

function farm_location_form_asset_form_alter(&$form, FormStateInterface $form_state, $form_id) {

  // Check if the form has the required location fields.
  if (isset($form['intrinsic_geometry']) && isset($form['is_fixed'])) {

    // Set the visible state of the asset.intrinsic_geometry field.
    // Only display if is_fixed is checked.
    $form['intrinsic_geometry']['#states']['visible'] = [
      ':input[name="is_fixed[value]"]' => [
        'checked' => TRUE,
      ],
    ];
  }
}