You are here

function votingapi_reaction_form_field_storage_config_edit_form_alter in Voting API Reaction 8

Implements hook_form_FORM_ID_alter().

File

./votingapi_reaction.module, line 55
Allows users to react to any entity using Voting and Field APIs.

Code

function votingapi_reaction_form_field_storage_config_edit_form_alter(&$form, FormStateInterface $form_state) {
  if ($form_state
    ->getFormObject()
    ->getEntity()
    ->bundle() == 'votingapi_reaction') {

    // We only support posting one reaction at the time so it doesn't make sense
    // to let the site builder choose anything else.
    $form['cardinality_container']['cardinality']['#default_value'] = 1;
    $form['cardinality_container']['#access'] = FALSE;
  }
}