You are here

function button_field_dummy_form in Button Field 8

Same name and namespace in other branches
  1. 7 button_field.module \button_field_dummy_form()

Form builder callback for the dummy form used to render button field's on a display that is not editable.

1 string reference to 'button_field_dummy_form'
DummyForm::getFormId in src/Form/DummyForm.php
Returns a unique string identifying the form.

File

./button_field.module, line 25
Defines a field, widget and formatter for the button field type.

Code

function button_field_dummy_form($form, &$form_state) {

  // Set the form's language.
  $langcode = field_language($form_state['#entity_type'], $form_state['#' . $form_state['#entity_type']], $form_state['#field']['field_name']);
  $form['language']['#value'] = $langcode;

  // Add the field and the instance to the form state.
  $field_name = $form_state['#field']['field_name'];
  $form_state['field'][$field_name][$langcode]['field'] =& $form_state['#field'];
  $form_state['field'][$field_name][$langcode]['instance'] =& $form_state['#instance'];

  // Add the field element to the form.
  $form[$field_name][$langcode][0] = $form_state['#element'];
  return $form;
}