Commit ea278e41 authored by Sven Berg Ryen's avatar Sven Berg Ryen Committed by Sven Berg Ryen
Browse files

Issue #3193826 by svenryen, Mile23: Allow never setting policy version cookie

parent 4faa5672
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -293,3 +293,6 @@ eu_cookie_compliance.cookie_compliance_set.*:
    consent_by_clicking:
      type: boolean
      label: 'Consent by clicking'
    enable_policy_versioning:
      type: boolean
      label: 'Enable policy versioning'
+9 −1
Original line number Diff line number Diff line
@@ -70,7 +70,8 @@ use Drupal\eu_cookie_compliance\CookieComplianceSetInterface;
 *     "reload_options",
 *     "reload_routes_list",
 *     "set_cookie_session_zero_on_disagree",
 *     "consent_by_clicking"
 *     "consent_by_clicking",
 *     "enable_policy_versioning"
 *   }
 * )
 */
@@ -293,5 +294,12 @@ class CookieComplianceSet extends ConfigEntityBase implements CookieComplianceSe
   */
  protected $consent_by_clicking;

  /**
   * Whether to allow policy versioning.
   *
   * @var bool
   */
  protected $enable_policy_versioning;


}
+11 −0
Original line number Diff line number Diff line
@@ -334,12 +334,23 @@ class CookieComplianceSetForm extends EntityForm {
      '#default_value' => $this->entity->get('open_privacy_link_in_new_window'),
    ];

    $form['privacy_policy']['enable_policy_versioning'] = [
      '#type' => 'checkbox',
      '#title' => $this->t('Enable policy versioning.'),
      '#default_value' => $this->entity->get('enable_policy_versioning') === NULL ? TRUE : $this->entity->get('enable_policy_versioning'),
    ];

    $form['privacy_policy']['privacy_policy_version'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Privacy policy version'),
      '#description' => $this->t('Change this value to make the cookie information banner reappear for all visitors. A typical usage of this field is to increase the value when the privacy policy has been changed.'),
      '#default_value' => $this->entity->get('privacy_policy_version') ?: '1.0.0',
      '#required' => TRUE,
      '#states' => [
        'visible' => [
          "input[name='enable_policy_versioning']" => ['checked' => TRUE],
        ],
      ],
    ];

    $form['cookie'] = [