|
@@ -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
|