You are here

function farm_group_form_log_form_alter in farmOS 2.x

Same name and namespace in other branches
  1. 7 modules/farm/farm_group/farm_group.module \farm_group_form_log_form_alter()

Implements hook_form_BASE_FORM_ID_alter().

File

modules/asset/group/farm_group.module, line 34
Contains farm_group.module.

Code

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

  // Check if the form has the required group fields.
  if (isset($form['group']) && isset($form['is_group_assignment'])) {

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