You are here

public function SimplesamlphpCustomAttributesDeleteForm::buildForm in SimpleSAMLphp Custom Attribute Mapping 8

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides ConfirmFormBase::buildForm

File

src/Form/SimplesamlphpCustomAttributesDeleteForm.php, line 75

Class

SimplesamlphpCustomAttributesDeleteForm

Namespace

Drupal\simplesamlphp_custom_attributes\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, $mapping = FALSE) {
  if (is_numeric($mapping)) {
    $mappings = $this->mappingConfig
      ->get('mappings');

    // Set these values for the confirm message to pick up on them.
    $this->attributeName = $mappings[$mapping]['attribute_name'];
    $this->fieldName = $mappings[$mapping]['field_name'];

    // Set the mapping id so the submit handler can delete it.
    $form_state
      ->set('simplesamlphp_custom_attributes_mapping', $mapping);
    return parent::buildForm($form, $form_state);
  }
  return FALSE;
}