Commit 3447bba5 authored by git's avatar git Committed by Paul McKibben
Browse files

Issue #3303239 by alyaj2a, paulmckibben, atul ghate, Jaydev Bhatt: Coding Standard issues

parent bab24ee9
Loading
Loading
Loading
Loading
+1 −14
Original line number Diff line number Diff line
@@ -45,20 +45,7 @@ function colorbox_requirements($phase) {
      'title' => t('DOMPurify library'),
      'value' => $dompurify_exists ? t('Installed') : t('Not installed'),
      'description' => $dompurify_exists ? '' :
        t('The DOMPurify library is not installed. ' .
          'The Colorbox module uses this library to sanitize HTML captions. ' .
          'Without this library, all captions will be treated as plain text. ' .
          'If you intend to have HTML captions in Colorbox content, ' .
          'download the <a href="@url">DOMPurify library</a>, extract it, ' .
          'and copy the dist directory into the /libraries/DOMPurify folder ' .
          'in your Drupal installation directory. ' .
          'Specifically, the system looks for ' .
          '/libraries/DOMPurify/dist/purify.min.js. <br /><br />' .
          'To avoid potential security ' .
          'issues, please only install the dist directory, and not any other ' .
          'files from the archive.<br /><br />' .
          'If you do not intend to use HTML captions, you can suppress this warning on the ' .
          '<a href="@config">Colorbox configuration page.</a>',
      t('The DOMPurify library is not installed. The Colorbox module uses this library to sanitize HTML captions. Without this library, all captions will be treated as plain text. If you intend to have HTML captions in Colorbox content, download the <a href="@url">DOMPurify library</a>, extract it, and copy the dist directory into the /libraries/DOMPurify folder in your Drupal installation directory. Specifically, the system looks for /libraries/DOMPurify/dist/purify.min.js. <br /><br /> To avoid potential security issues, please only install the dist directory, and not any other files from the archive.<br /><br /> If you do not intend to use HTML captions, you can suppress this warning on the <a href="@config">Colorbox configuration page.</a>',
          [
            '@url' => 'https://github.com/cure53/DOMPurify/archive/main.zip',
            '@config' => Url::fromRoute('colorbox.admin_settings')->toString(),
+1 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@
use Drupal\file\Entity\File;
use Drupal\image\Entity\ImageStyle;
use Drupal\Component\Utility\Xss;

/**
 * Prepares variables for colorbox formatter templates.
 *
+0 −1
Original line number Diff line number Diff line
@@ -195,5 +195,4 @@ class ColorboxCommands extends DrushCommands {
    }
  }


}
+10 −16
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ class ColorboxSettingsForm extends ConfigFormBase {
  /**
   * Library discovery service.
   *
   * @var LibraryDiscoveryInterface
   * @var Drupal\Core\Asset\LibraryDiscoveryInterface
   */
  protected $libraryDiscovery;

@@ -116,30 +116,24 @@ class ColorboxSettingsForm extends ConfigFormBase {
      '#open' => TRUE,
    ];
    $dompurify_message = $dompurify_exists ?
      $this->t('The DOMPurify library is installed. ' .
        'This library will sanitize HTML in Colorbox captions.') :
      $this->t('The <a href="@dompurify_link">DOMPurify</a> ' .
        'library is not installed. ' .
        'This library is necessary if you want to use HTML in Colorbox captions. ' .
        'Without it, all captions will be treated as plain text.',
      $this->t('The DOMPurify library is installed. This library will sanitize HTML in Colorbox captions.') :
      $this->t('The <a href="@dompurify_link">DOMPurify</a> library is not installed. This library is necessary if you want to use HTML in Colorbox captions. Without it, all captions will be treated as plain text.',
        [
          '@dompurify_link' => 'https://github.com/cure53/DOMPurify/archive/main.zip'
          '@dompurify_link' => 'https://github.com/cure53/DOMPurify/archive/main.zip',
        ]);
    $form['colorbox_dompurify']['dompurify_message'] = array(
    $form['colorbox_dompurify']['dompurify_message'] = [
      '#type' => 'markup',
      '#prefix' => '<p>',
      '#suffix' => '</p>',
      '#markup' => $dompurify_message,
    );
    ];
    if (!$dompurify_exists) {
      $form['colorbox_dompurify']['dompurify_hide_warning'] = array(
      $form['colorbox_dompurify']['dompurify_hide_warning'] = [
        '#type' => 'checkbox',
        '#title' => t('Don\'t show warning on status report'),
        '#title' => t("Don\'t show warning on status report"),
        '#default_value' => $config->get('dompurify_hide_warning'),
        '#description' => t('By default, a warning appears on Drupal\'s ' .
          'status report if this library is missing. Check this box to ' .
          'suppress the warning.'),
      );
        '#description' => t("By default, a warning appears on Drupal\'s status report if this library is missing. Check this box to suppress the warning."),
      ];
    }

    $form['colorbox_custom_settings'] = [