Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / views / src / Plugin / views / display / DisplayPluginBase.php
index e31b5a295f477907b6bcebed5c6a34b57d5ed0d2..012dec4f21458cfa54e93e03ce5608dc350bf1fc 100644 (file)
@@ -164,7 +164,6 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
       }
     }
 
-
     $this->setOptionDefaults($this->options, $this->defineOptions());
     $this->display = &$display;
 
@@ -234,7 +233,9 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
   /**
    * {@inheritdoc}
    */
-  public function isDefaultDisplay() { return FALSE; }
+  public function isDefaultDisplay() {
+    return FALSE;
+  }
 
   /**
    * {@inheritdoc}
@@ -394,7 +395,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
   /**
    * {@inheritdoc}
    */
-  public function attachTo(ViewExecutable $view, $display_id, array &$build) { }
+  public function attachTo(ViewExecutable $view, $display_id, array &$build) {}
 
   /**
    * {@inheritdoc}
@@ -665,17 +666,23 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
   /**
    * {@inheritdoc}
    */
-  public function hasPath() { return FALSE; }
+  public function hasPath() {
+    return FALSE;
+  }
 
   /**
    * {@inheritdoc}
    */
-  public function usesLinkDisplay() { return !$this->hasPath(); }
+  public function usesLinkDisplay() {
+    return !$this->hasPath();
+  }
 
   /**
    * {@inheritdoc}
    */
-  public function usesExposedFormInBlock() { return $this->hasPath(); }
+  public function usesExposedFormInBlock() {
+    return $this->hasPath();
+  }
 
   /**
    * {@inheritdoc}
@@ -772,7 +779,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
       return $this->default_display->getOption($option);
     }
 
-    if (array_key_exists($option, $this->options)) {
+    if (isset($this->options[$option]) || array_key_exists($option, $this->options)) {
       return $this->options[$option];
     }
   }
@@ -1463,7 +1470,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
           '#title' => $this->t('Show contextual links'),
           '#default_value' => $this->getOption('show_admin_links'),
         ];
-      break;
+        break;
       case 'use_more':
         $form['#title'] .= $this->t('Add a more link to the bottom of the display.');
         $form['use_more'] = [
@@ -1858,7 +1865,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
         if (preg_match('/[^a-zA-Z0-9-_ ]/', $css_class)) {
           $form_state->setError($form['css_class'], $this->t('CSS classes must be alphanumeric or dashes only.'));
         }
-      break;
+        break;
       case 'display_id':
         if ($form_state->getValue('display_id')) {
           if (preg_match('/[^a-z0-9_]/', $form_state->getValue('display_id'))) {
@@ -2051,7 +2058,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
   /**
    * {@inheritdoc}
    */
-  public function renderFilters() { }
+  public function renderFilters() {}
 
   /**
    * {@inheritdoc}
@@ -2115,7 +2122,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
       '#cache' => &$this->view->element['#cache'],
     ];
 
-    $this->applyDisplayCachablityMetadata($this->view->element);
+    $this->applyDisplayCacheabilityMetadata($this->view->element);
 
     return $element;
   }
@@ -2126,7 +2133,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
    * @param array $element
    *   The render array with updated cacheability metadata.
    */
-  protected function applyDisplayCachablityMetadata(array &$element) {
+  protected function applyDisplayCacheabilityMetadata(array &$element) {
     /** @var \Drupal\views\Plugin\views\cache\CachePluginBase $cache */
     $cache = $this->getPlugin('cache');
 
@@ -2138,6 +2145,22 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
       ->applyTo($element);
   }
 
+  /**
+   * Applies the cacheability of the current display to the given render array.
+   *
+   * @param array $element
+   *   The render array with updated cacheability metadata.
+   *
+   * @deprecated in Drupal 8.4.0, will be removed before Drupal 9.0. Use
+   *   DisplayPluginBase::applyDisplayCacheabilityMetadata instead.
+   *
+   * @see \Drupal\views\Plugin\views\display\DisplayPluginBase::applyDisplayCacheabilityMetadata()
+   */
+  protected function applyDisplayCachablityMetadata(array &$element) {
+    @trigger_error('The DisplayPluginBase::applyDisplayCachablityMetadata method is deprecated since version 8.4 and will be removed in 9.0. Use DisplayPluginBase::applyDisplayCacheabilityMetadata instead.', E_USER_DEPRECATED);
+    $this->applyDisplayCacheabilityMetadata($element);
+  }
+
   /**
    * {@inheritdoc}
    */
@@ -2309,7 +2332,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
   /**
    * {@inheritdoc}
    */
-  public function execute() { }
+  public function execute() {}
 
   /**
    * {@inheritdoc}
@@ -2330,7 +2353,7 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
     // of cacheability metadata (e.g.: cache contexts), so they can bubble up.
     // Thus, we add the cacheability metadata first, then modify / remove the
     // cache keys depending on the $cache argument.
-    $this->applyDisplayCachablityMetadata($this->view->element);
+    $this->applyDisplayCacheabilityMetadata($this->view->element);
     if ($cache) {
       $this->view->element['#cache'] += ['keys' => []];
       // Places like \Drupal\views\ViewExecutable::setCurrentPage() set up an