Problem/Motivation

We have plans for contact module in contrib, in contact_storage module (see https://groups.drupal.org/node/433803).
Some of these will require storage of settings per contact form.

Proposed resolution

Implement third party settings interface in contact module's contact form contact entity.

Remaining tasks

Do it

User interface changes

None

API changes

Additions

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

larowlan’s picture

Assigned: Unassigned » larowlan
larowlan’s picture

Status: Active » Needs review
FileSize
7.08 KB
jibran’s picture

Over all I am RTBC on this issue but I don't know a lot about ThirdPartySettings.

Berdir’s picture

Status: Needs review » Needs work
+++ b/core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.module
@@ -38,3 +40,45 @@ function contact_storage_test_entity_type_alter(array &$entity_types) {
+/**
+ * Implements hook_form_FORM_ID_alter() for contact_form_edit_form().
+ */
+function contact_storage_test_form_contact_form_edit_form_alter(&$form, FormStateInterface $form_state) {
+  contact_storage_test_contact_form_alter($form, $form_state);
+}

there should be a "contact_form_form" base form ID too, should save you two methods?

The schema for the pony is missing in the test module. You can test that pretty easily, there's a trait and a few lines of code that you copy & paste and it will automatically validate all the config of your test. See Drupal\config\Tests\DefaultConfigTest.

andypost’s picture

Maybe adding this we could find an actual usage?
For example refactor "send a copy" or add "set a text" or path alias?

+++ b/core/modules/contact/config/schema/contact.schema.yml
@@ -22,6 +22,11 @@ contact.form.*:
+    third_party_settings:
...
+        - type: node_type.third_party.[%key]

any reason to add dependency on node module?

Berdir’s picture

Actual use cases only make sense in third party modules, if we add something to core, it will just live in contact.module.

Yeah, that should be contact_form.third_party.[%key] :)

larowlan’s picture

Status: Needs work » Needs review
FileSize
2.71 KB
7 KB
Berdir’s picture

Status: Needs review » Needs work

Would be great to add the schema validation trait stuff to make sure this is actually working :)

larowlan’s picture

Status: Needs work » Needs review
FileSize
1.8 KB
7.61 KB

done

andypost’s picture

Status: Needs review » Reviewed & tested by the community

Looks great!
PS: would be great to update summary to point and example what this for could be needed

andypost’s picture

Possible examples:
1) settings for advanced notifications and redirect #306662: Add redirect option to site-wide contact forms
2) rules integrations could mark contact for some special processing

larowlan’s picture

Opt in or out of storage in contact storage module.
Opt out of email.

NikLP’s picture

I'd love to help on this one but the code is way out of my league. D8 is hard.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Looks good. Committed f48a467 and pushed to 8.0.x. Thanks!

  • alexpott committed f48a467 on 8.0.x
    Issue #2342551 by larowlan: Implement ThirdPartySettingsInterface in...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.