Skip to content
Snippets Groups Projects

Move helper and delete .module

Closed nicxvan requested to merge issue/drupal-3494128:3494128-move-helpers-in into 11.x
3 files
+ 11
27
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -4,6 +4,7 @@
namespace Drupal\contact_storage_test\Hook;
use Drupal\contact\ContactFormInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Entity\EntityTypeInterface;
@@ -54,7 +55,16 @@ public function formContactFormFormAlter(&$form, FormStateInterface $form_state)
'#description' => t('Enable to send an additional email with a free pony voucher to anyone who submits the form.'),
'#default_value' => $contact_form->getThirdPartySetting('contact_storage_test', 'send_a_pony', FALSE),
];
$form['#entity_builders'][] = 'contact_storage_test_contact_form_form_builder';
$form['#entity_builders'][] = [$this, 'contactFormBuilder'];
}
/**
* Entity builder for the contact form edit form with third party options.
*
* @see contact_storage_test_form_contact_form_edit_form_alter()
*/
public function contactFormBuilder($entity_type, ContactFormInterface $contact_form, &$form, FormStateInterface $form_state): void {
$contact_form->setThirdPartySetting('contact_storage_test', 'send_a_pony', $form_state->getValue('send_a_pony'));
}
}
Loading