reconfigured simplenews_mail_subscriptions with right lists IDs, patch : removed api keys

This commit is contained in:
Bachir Soussi Chiadmi 2022-06-09 12:15:49 +02:00
parent f3180c2b30
commit 6372be828b
6 changed files with 323 additions and 25 deletions

View File

@ -0,0 +1,13 @@
uuid: 89d71508-f9fd-47ad-b712-a2902f867792
langcode: fr
status: true
dependencies: { }
id: '19125'
title: ZeDaily
api_key: null
secret_key: null
mapping_table:
-
simplenews_news: ze_daily_materio_
contact_property: simplenews
newsletter_property_name: ZeDaily

View File

@ -0,0 +1,13 @@
uuid: 9a82ce3e-d5b1-4226-9e70-e4f2d28334ca
langcode: fr
status: true
dependencies: { }
id: '22839'
title: 'materio'' newsletter'
api_key: null
secret_key: null
mapping_table:
-
simplenews_news: materio_newsletter
contact_property: simplenews
newsletter_property_name: Newsletter

View File

@ -0,0 +1,13 @@
uuid: 494ab8bc-97f4-4e87-a9ac-876911d4d3a3
langcode: fr
status: true
dependencies: { }
id: '24787'
title: Compagnie
api_key: null
secret_key: null
mapping_table:
-
simplenews_news: companies
contact_property: simplenews
newsletter_property_name: Companies

View File

@ -0,0 +1,9 @@
uuid: 22d88999-43ab-4e59-8deb-02760e11f7ad
langcode: fr
status: true
dependencies: { }
id: '24788'
title: Test
api_key: null
secret_key: null
mapping_table: null

View File

@ -1,25 +0,0 @@
uuid: 523a56dc-5643-427b-abfb-36bd04dc0376
langcode: fr
status: true
dependencies: { }
id: drupal_simplenews
title: simplenews
api_key: cec52b4eb2d759f5372dfd194585c388
secret_key: cec52b4eb2d759f5372dfd194585c388
mapping_table:
-
simplenews_news: ze_daily_materio_
contact_property: simplenews
newsletter_property_name: Daily
-
simplenews_news: materio_newsletter
contact_property: simplenews
newsletter_property_name: Newsletter
-
simplenews_news: companies
contact_property: simplenews
newsletter_property_name: Compagnie
-
simplenews_news: test
contact_property: simplenews
newsletter_property_name: Test

View File

@ -1,3 +1,15 @@
diff --git a/README.txt b/README.txt
index cee6e1a..b488e91 100644
--- a/README.txt
+++ b/README.txt
@@ -15,6 +15,7 @@ REQUIREMENTS
This module requires the following modules:
* Simplenews (https://www.drupal.org/project/simplenews)
+ * Mailet (https://www.drupal.org/project/Mailjet)
INSTALLATION
------------
diff --git a/simplenews_mailjet_subscriptions.info.yml b/simplenews_mailjet_subscriptions.info.yml
index 2512a39..d4b0440 100644
--- a/simplenews_mailjet_subscriptions.info.yml
@ -75,6 +87,269 @@ index 0000000..cdd4137
+ simplenews_mailjet_subscriptions.utilities:
+ class: Drupal\simplenews_mailjet_subscriptions\SimplenewsMailjetSubscriptionsUtilities
+ arguments: [ '@mailjet.handler' ]
diff --git a/src/Entity/SimplenewsMailjetSubscriptionEntity.php b/src/Entity/SimplenewsMailjetSubscriptionEntity.php
index 27b7737..b74f89e 100644
--- a/src/Entity/SimplenewsMailjetSubscriptionEntity.php
+++ b/src/Entity/SimplenewsMailjetSubscriptionEntity.php
@@ -94,53 +94,53 @@ class SimplenewsMailjetSubscriptionEntity extends ConfigEntityBase implements Si
return $this->get('id');
}
- /**
- * Returns the entity api key.
- *
- * @return string
- * The entity api key.
- */
- public function getApiKey() {
- return $this->get('api_key');
- }
-
- /**
- * Sets the entity api key.
- *
- * @param string $api_key
- * Api key.
- *
- * @return $this
- * The Simplenews Mailjet Subscription entity.
- */
- public function setApiKey($api_key) {
- $this->set('api_key', $api_key);
- return $this;
- }
-
- /**
- * Returns the entity secret key.
- *
- * @return string
- * The entity secret key.
- */
- public function getSecretkey() {
- return $this->get('secret_key');
- }
-
- /**
- * Sets the entity secret key.
- *
- * @param string $secret_key
- * Secret key.
- *
- * @return $this
- * The Simplenews Mailjet Subscription entity.
- */
- public function setSecretkey($secret_key) {
- $this->set('secret_key', $secret_key);
- return $this;
- }
+ // /**
+ // * Returns the entity api key.
+ // *
+ // * @return string
+ // * The entity api key.
+ // */
+ // public function getApiKey() {
+ // return $this->get('api_key');
+ // }
+
+ // /**
+ // * Sets the entity api key.
+ // *
+ // * @param string $api_key
+ // * Api key.
+ // *
+ // * @return $this
+ // * The Simplenews Mailjet Subscription entity.
+ // */
+ // public function setApiKey($api_key) {
+ // $this->set('api_key', $api_key);
+ // return $this;
+ // }
+
+ // /**
+ // * Returns the entity secret key.
+ // *
+ // * @return string
+ // * The entity secret key.
+ // */
+ // public function getSecretkey() {
+ // return $this->get('secret_key');
+ // }
+
+ // /**
+ // * Sets the entity secret key.
+ // *
+ // * @param string $secret_key
+ // * Secret key.
+ // *
+ // * @return $this
+ // * The Simplenews Mailjet Subscription entity.
+ // */
+ // public function setSecretkey($secret_key) {
+ // $this->set('secret_key', $secret_key);
+ // return $this;
+ // }
/**
* Sets the entity mapping table.
diff --git a/src/Form/SimplenewsMailjetSubscriptionAddForm.php b/src/Form/SimplenewsMailjetSubscriptionAddForm.php
index 836bee3..bc70090 100644
--- a/src/Form/SimplenewsMailjetSubscriptionAddForm.php
+++ b/src/Form/SimplenewsMailjetSubscriptionAddForm.php
@@ -64,20 +64,20 @@ class SimplenewsMailjetSubscriptionAddForm extends EntityForm {
'exists' => [$this, 'exist'],
],
];
- $form['api_key'] = [
- '#type' => 'textfield',
- '#title' => $this->t('API Key'),
- '#maxlength' => 32,
- '#description' => $this->t('Mailjet Account API Key'),
- '#required' => TRUE,
- ];
- $form['secret_key'] = [
- '#type' => 'password',
- '#title' => $this->t('Secret Key'),
- '#maxlength' => 32,
- '#description' => $this->t('Mailjet Account Secret Key'),
- '#required' => TRUE,
- ];
+ // $form['api_key'] = [
+ // '#type' => 'textfield',
+ // '#title' => $this->t('API Key'),
+ // '#maxlength' => 32,
+ // '#description' => $this->t('Mailjet Account API Key'),
+ // '#required' => TRUE,
+ // ];
+ // $form['secret_key'] = [
+ // '#type' => 'password',
+ // '#title' => $this->t('Secret Key'),
+ // '#maxlength' => 32,
+ // '#description' => $this->t('Mailjet Account Secret Key'),
+ // '#required' => TRUE,
+ // ];
return $form;
}
diff --git a/src/Form/SimplenewsMailjetSubscriptionEditForm.php b/src/Form/SimplenewsMailjetSubscriptionEditForm.php
index 98342b5..f67ba96 100644
--- a/src/Form/SimplenewsMailjetSubscriptionEditForm.php
+++ b/src/Form/SimplenewsMailjetSubscriptionEditForm.php
@@ -76,20 +76,20 @@ class SimplenewsMailjetSubscriptionEditForm extends EntityForm {
'#help' => $this->t('Configuration title'),
'#required' => TRUE,
];
- $form['api_key'] = [
- '#type' => 'textfield',
- '#title' => $this->t('API Key'),
- '#maxlength' => 32,
- '#default_value' => $this->entity->getApiKey(),
- '#help' => $this->t('Mailjet Account API Key'),
- '#required' => TRUE,
- '#disabled' => !$this->entity->isNew(),
- ];
-
- if ($this->entity->getApiKey() && $this->entity->getSecretkey()) {
+ // $form['api_key'] = [
+ // '#type' => 'textfield',
+ // '#title' => $this->t('API Key'),
+ // '#maxlength' => 32,
+ // '#default_value' => $this->entity->getApiKey(),
+ // '#help' => $this->t('Mailjet Account API Key'),
+ // '#required' => TRUE,
+ // '#disabled' => !$this->entity->isNew(),
+ // ];
+
+ // if ($this->entity->getApiKey() && $this->entity->getSecretkey()) {
$this->constructTable($form, $form_state);
- }
+ // }
$form['add_subscription'] = [
'#type' => 'submit',
diff --git a/src/SimplenewsMailjetSubscriptionsInterface.php b/src/SimplenewsMailjetSubscriptionsInterface.php
index c727d26..37c082d 100644
--- a/src/SimplenewsMailjetSubscriptionsInterface.php
+++ b/src/SimplenewsMailjetSubscriptionsInterface.php
@@ -36,43 +36,43 @@ interface SimplenewsMailjetSubscriptionsInterface extends ConfigEntityInterface
*/
public function getId();
- /**
- * Returns the entity api key.
- *
- * @return string
- * The entity api key.
- */
- public function getApiKey();
+ // /**
+ // * Returns the entity api key.
+ // *
+ // * @return string
+ // * The entity api key.
+ // */
+ // public function getApiKey();
- /**
- * Sets the entity api key.
- *
- * @param string $api_key
- * Api key.
- *
- * @return $this
- * The Simplenews Mailjet Subscription entity.
- */
- public function setApiKey($api_key);
+ // /**
+ // * Sets the entity api key.
+ // *
+ // * @param string $api_key
+ // * Api key.
+ // *
+ // * @return $this
+ // * The Simplenews Mailjet Subscription entity.
+ // */
+ // public function setApiKey($api_key);
- /**
- * Returns the entity secret key.
- *
- * @return string
- * The entity secret key.
- */
- public function getSecretkey();
+ // /**
+ // * Returns the entity secret key.
+ // *
+ // * @return string
+ // * The entity secret key.
+ // */
+ // public function getSecretkey();
- /**
- * Sets the entity secret key.
- *
- * @param string $secret_key
- * Secret key.
- *
- * @return $this
- * The Simplenews Mailjet Subscription entity.
- */
- public function setSecretkey($secret_key);
+ // /**
+ // * Sets the entity secret key.
+ // *
+ // * @param string $secret_key
+ // * Secret key.
+ // *
+ // * @return $this
+ // * The Simplenews Mailjet Subscription entity.
+ // */
+ // public function setSecretkey($secret_key);
/**
* Sets the entity mapping table.
diff --git a/src/SimplenewsMailjetSubscriptionsUtilities.php b/src/SimplenewsMailjetSubscriptionsUtilities.php
index 950ff8a..05601ca 100644
--- a/src/SimplenewsMailjetSubscriptionsUtilities.php