Skip to content
Snippets Groups Projects

allow taxonomy term views and fix multiple contextual filters

4 files
+ 79
42
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -9,6 +9,7 @@ use Drupal\Core\Entity\EntityFieldManagerInterface;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\views\Plugin\views\area\AreaPluginBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\field\Entity\FieldStorageConfig;
/**
* Views area handler to display alphabetic pagination.
@@ -222,7 +223,7 @@ class AlphaPaginationArea extends AreaPluginBase {
// Global options.
$base_table = $this->view->storage->get('base_table');
if ($base_table == 'taxonomy_term_data' || $base_table == 'media_field_data') {
if ($base_table == 'taxonomy_term_field_data' || $base_table == 'media_field_data') {
// Get an array list of all non-image, non-entity or other assorted
// reference fields.
$fields = ['name' => 'name'];
@@ -234,15 +235,16 @@ class AlphaPaginationArea extends AreaPluginBase {
}
$compound_field_types = ['name'];
$single_field_types = ['text', 'text_long', 'text_with_summary', 'string', 'string_long'];
$single_field_types = ['string', 'string_long']; // 'text', 'text_long', 'text_with_summary', can be added but
// they will probably contain HTML tags that will be caught as first character (except if we strit tags
// in AlphaPagination:getEntityPrefixes but that would be heavy on performance)
$all_field_types = array_merge($single_field_types, $compound_field_types);
$all_fields = $this->fieldManager->getFieldMap();
$baseEntityType = $this->view->getBaseEntityType()->id();
foreach ($all_fields[$baseEntityType] as $field_name => $field_definition) {
if (in_array($field_definition['type'], $all_field_types)) {
if (in_array($field_definition['type'], $compound_field_types)) {
$field_info = FieldStorageConfig::loadByName('node', $field_name);
$field_info = field_info_field($field_name);
$field_info = FieldStorageConfig::loadByName($baseEntityType, $field_name);
foreach (array_keys($field_info['columns']) as $compoundFieldKey) {
$compound_field_field_name = sprintf('%s:%s', $field_name, $compoundFieldKey);
$fields[$baseEntityType . '__' . $compound_field_field_name] = $compound_field_field_name;
Loading