Loading modal_page.module +13 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,8 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Routing\RouteMatchInterface; use Symfony\Component\HttpFoundation\Cookie; use Symfony\Component\HttpFoundation\Response; /** * Implements hook_form_alter(). Loading Loading @@ -192,13 +194,24 @@ function modal_page_entity_presave(EntityInterface $entity) { */ function modal_page_modal_submit($modal, $modal_state, $modal_id) { // If isn't the Modal for welcome, skip. if ($modal_id != 'thank_you_for_installing_modal_page') { return FALSE; } // If wasn't clicked on don't show again, skip. if (empty($modal_state['dont_show_again_option']) || $modal_state['dont_show_again_option'] == 'false') { return FALSE; } // Delete the Modal used on welcome Message. $modal->delete(); // Delete cookie for welcome Modal. if (!empty(\Drupal::service('request_stack')->getCurrentRequest()->cookies->get('hide_modal_id_thank_you_for_installing_modal_page'))) { $response = new Response(); $cookie = new Cookie('hide_modal_id_thank_you_for_installing_modal_page', '', time() - 3600, '/', NULL, FALSE); $response->headers->setCookie($cookie); $response->send(); } } Loading
modal_page.module +13 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,8 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Routing\RouteMatchInterface; use Symfony\Component\HttpFoundation\Cookie; use Symfony\Component\HttpFoundation\Response; /** * Implements hook_form_alter(). Loading Loading @@ -192,13 +194,24 @@ function modal_page_entity_presave(EntityInterface $entity) { */ function modal_page_modal_submit($modal, $modal_state, $modal_id) { // If isn't the Modal for welcome, skip. if ($modal_id != 'thank_you_for_installing_modal_page') { return FALSE; } // If wasn't clicked on don't show again, skip. if (empty($modal_state['dont_show_again_option']) || $modal_state['dont_show_again_option'] == 'false') { return FALSE; } // Delete the Modal used on welcome Message. $modal->delete(); // Delete cookie for welcome Modal. if (!empty(\Drupal::service('request_stack')->getCurrentRequest()->cookies->get('hide_modal_id_thank_you_for_installing_modal_page'))) { $response = new Response(); $cookie = new Cookie('hide_modal_id_thank_you_for_installing_modal_page', '', time() - 3600, '/', NULL, FALSE); $response->headers->setCookie($cookie); $response->send(); } }