Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291717

Views - Replacement patterns list is not complete

$
0
0

I created a view with context filters and several fields. So, I expected to see them within Replacement Patterns but there were only patterns from Context Filter.

That was a disappointment, however when I tried to test Replacement Patterns which were not in the list - they worked.

The problem is within generating Replacement Pattern list:
core\modules\views\src\Plugin\views\area\TokenizeAreaPluginBase.php:81

This:

      foreach (array_keys($options) as $type) {
        if (!empty($options[$type])) {
          $items = array();
          foreach ($options[$type] as $key => $value) {
            $items[] = $key . ' == ' . $value;
          }
          $form['tokens']['tokens'] = array(
            '#theme' => 'item_list',
            '#items' => $items,
          );
        }
      }

Should be changed to this:


      $items = array();
      foreach (array_keys($options) as $type) {
        if (!empty($options[$type])) {
          foreach ($options[$type] as $key => $value) {
            $items[] = $key . ' == ' . $value;
          }
        }
      }
      $form['tokens']['tokens'] = array(
        '#theme' => 'item_list',
        '#items' => $items,
      );

$options has 2 keys: 'fields' and 'context'. And $form['tokens']['tokens'] rewrites the first 'fields' values with 'context' ones.

Problem persists for 8.1.x dev.

Please add a fix to this issue to the new version :)


Viewing all articles
Browse latest Browse all 291717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>