entity_agree-2.0.x-dev/src/Plugin/entity_agree/AgreementHandler/EntityAgreementForm.php
src/Plugin/entity_agree/AgreementHandler/EntityAgreementForm.php
<?php namespace Drupal\entity_agree\Plugin\entity_agree\AgreementHandler; use Drupal\Core\Form\FormStateInterface; use Drupal\entity_agree\AgreementHandlerPluginBase; /** * Plugin to display an agreement field as a form on the entity. * * @AgreementHandler( * id = "entity_agree_entity_form", * label = @Translation("Agreement form"), * category = @Translation("Form"), * ) */ class EntityAgreementForm extends AgreementHandlerPluginBase { /** * {@inheritdoc} */ public function defaultConfiguration() { return ['button_text' => 'Agree']; } /** * {@inheritdoc} */ public function buildConfigurationForm(array $form, FormStateInterface $form_state) { $form['button_text'] = [ '#type' => 'textfield', '#title' => $this->t('Button text'), '#description' => $this->t("This text will appear on the button displayed on the agreement. Don't forget to set the agreement field into the entity view display."), '#maxlength' => 32, '#default_value' => $this->configuration['button_text'], '#required' => TRUE, ]; return parent::buildConfigurationForm($form, $form_state); } }