Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / modules / contrib / security_review / src / Form / SettingsForm.php
index bd6dc9c66c97ac94a6d4ec3e43e593538facfc54..5ba075772287328bd9953f3ceb16ce3b9eab3279 100644 (file)
@@ -1,14 +1,9 @@
 <?php
 
-/**
- * @file
- * Contains \Drupal\security_review\Form\SettingsForm.
- */
-
 namespace Drupal\security_review\Form;
 
-use Drupal\Component\Utility\SafeMarkup;
 use Drupal\Core\Config\ConfigFactoryInterface;
+use Drupal\Core\Datetime\DateFormatterInterface;
 use Drupal\Core\Form\ConfigFormBase;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Session\AccountInterface;
@@ -43,6 +38,13 @@ class SettingsForm extends ConfigFormBase {
    */
   protected $securityReview;
 
+  /**
+   * The date.formatter service.
+   *
+   * @var \Drupal\Core\Datetime\DateFormatterInterface
+   */
+  private $dateFormatter;
+
   /**
    * Constructs a SettingsForm.
    *
@@ -54,12 +56,15 @@ class SettingsForm extends ConfigFormBase {
    *   The security_review.security service.
    * @param \Drupal\security_review\SecurityReview $security_review
    *   The security_review service.
+   * @param \Drupal\Core\Datetime\DateFormatterInterface $dateFormatter
+   *   The date.formatter service.
    */
-  public function __construct(ConfigFactoryInterface $config_factory, Checklist $checklist, Security $security, SecurityReview $security_review) {
+  public function __construct(ConfigFactoryInterface $config_factory, Checklist $checklist, Security $security, SecurityReview $security_review, DateFormatterInterface $dateFormatter) {
     parent::__construct($config_factory);
     $this->checklist = $checklist;
     $this->security = $security;
     $this->securityReview = $security_review;
+    $this->dateFormatter = $dateFormatter;
   }
 
   /**
@@ -70,7 +75,8 @@ class SettingsForm extends ConfigFormBase {
       $container->get('config.factory'),
       $container->get('security_review.checklist'),
       $container->get('security_review.security'),
-      $container->get('security_review')
+      $container->get('security_review'),
+      $container->get('date.formatter')
     );
   }
 
@@ -92,7 +98,7 @@ class SettingsForm extends ConfigFormBase {
     $roles = user_roles();
     $options = [];
     foreach ($roles as $rid => $role) {
-      $options[$rid] = SafeMarkup::checkPlain($role->label());
+      $options[$rid] = $role->label();
     }
 
     // Notify the user if anonymous users can create accounts.
@@ -139,7 +145,7 @@ class SettingsForm extends ConfigFormBase {
           [
             '@name' => $check->getTitle(),
             '@uid' => $check->skippedBy()->id(),
-            '@date' => format_date($check->skippedOn()),
+            '@date' => $this->dateFormatter->format($check->skippedOn()),
           ]
         );
       }