Skip to content
Snippets Groups Projects
Commit dc5e5dd2 authored by Michael Lee's avatar Michael Lee
Browse files

Upgrading drupal/views_fieldsets (3.4.0 => 4.0.0)

parent 4208a23a
No related branches found
No related tags found
No related merge requests found
Showing
with 325 additions and 109 deletions
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "51c5ea77e1c51210745e1075221adcb4",
"content-hash": "c3d4edaf58753eda386bd3532bbf23cf",
"packages": [
{
"name": "alchemy/zippy",
......@@ -7786,26 +7786,26 @@
},
{
"name": "drupal/views_fieldsets",
"version": "3.4.0",
"version": "4.0.0",
"source": {
"type": "git",
"url": "https://git.drupalcode.org/project/views_fieldsets.git",
"reference": "8.x-3.4"
"reference": "4.0.0"
},
"dist": {
"type": "zip",
"url": "https://ftp.drupal.org/files/projects/views_fieldsets-8.x-3.4.zip",
"reference": "8.x-3.4",
"shasum": "fac5be9b5c4f421282947592400649c6a31ac92d"
"url": "https://ftp.drupal.org/files/projects/views_fieldsets-4.0.0.zip",
"reference": "4.0.0",
"shasum": "640e2ad1d38b5e507eff0da482df46705c49754d"
},
"require": {
"drupal/core": "^8 || ^9"
"drupal/core": ">=9"
},
"type": "drupal-module",
"extra": {
"drupal": {
"version": "8.x-3.4",
"datestamp": "1623608186",
"version": "4.0.0",
"datestamp": "1693927686",
"security-coverage": {
"status": "covered",
"message": "Covered by Drupal's security advisory policy"
......@@ -7828,12 +7828,17 @@
{
"name": "rudiedirkx",
"homepage": "https://www.drupal.org/user/890274"
},
{
"name": "smustgrave",
"homepage": "https://www.drupal.org/user/3252890"
}
],
"description": "Adds fieldsets to Views.",
"homepage": "https://www.drupal.org/project/views_fieldsets",
"homepage": "https://drupal.org/project/views_fieldsets",
"support": {
"source": "https://git.drupalcode.org/project/views_fieldsets"
"source": "https://git.drupalcode.org/project/views_fieldsets",
"issues": "https://www.drupal.org/project/issues/views_fieldsets"
}
},
{
......
......@@ -8118,27 +8118,27 @@
},
{
"name": "drupal/views_fieldsets",
"version": "3.4.0",
"version_normalized": "3.4.0.0",
"version": "4.0.0",
"version_normalized": "4.0.0.0",
"source": {
"type": "git",
"url": "https://git.drupalcode.org/project/views_fieldsets.git",
"reference": "8.x-3.4"
"reference": "4.0.0"
},
"dist": {
"type": "zip",
"url": "https://ftp.drupal.org/files/projects/views_fieldsets-8.x-3.4.zip",
"reference": "8.x-3.4",
"shasum": "fac5be9b5c4f421282947592400649c6a31ac92d"
"url": "https://ftp.drupal.org/files/projects/views_fieldsets-4.0.0.zip",
"reference": "4.0.0",
"shasum": "640e2ad1d38b5e507eff0da482df46705c49754d"
},
"require": {
"drupal/core": "^8 || ^9"
"drupal/core": ">=9"
},
"type": "drupal-module",
"extra": {
"drupal": {
"version": "8.x-3.4",
"datestamp": "1623608186",
"version": "4.0.0",
"datestamp": "1693927686",
"security-coverage": {
"status": "covered",
"message": "Covered by Drupal's security advisory policy"
......@@ -8162,12 +8162,17 @@
{
"name": "rudiedirkx",
"homepage": "https://www.drupal.org/user/890274"
},
{
"name": "smustgrave",
"homepage": "https://www.drupal.org/user/3252890"
}
],
"description": "Adds fieldsets to Views.",
"homepage": "https://www.drupal.org/project/views_fieldsets",
"homepage": "https://drupal.org/project/views_fieldsets",
"support": {
"source": "https://git.drupalcode.org/project/views_fieldsets"
"source": "https://git.drupalcode.org/project/views_fieldsets",
"issues": "https://www.drupal.org/project/issues/views_fieldsets"
},
"install-path": "../../web/modules/views_fieldsets"
},
......
......@@ -3,7 +3,7 @@
'name' => 'osu-asc-webservices/d8-upstream',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '512f89c06e376c965fa2597fbfeeb1181b5887cc',
'reference' => '4208a23af6f970796fb0f516a8fb274a5d4e8c39',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
......@@ -1274,9 +1274,9 @@
'dev_requirement' => false,
),
'drupal/views_fieldsets' => array(
'pretty_version' => '3.4.0',
'version' => '3.4.0.0',
'reference' => '8.x-3.4',
'pretty_version' => '4.0.0',
'version' => '4.0.0.0',
'reference' => '4.0.0',
'type' => 'drupal-module',
'install_path' => __DIR__ . '/../../web/modules/views_fieldsets',
'aliases' => array(),
......@@ -1531,7 +1531,7 @@
'osu-asc-webservices/d8-upstream' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '512f89c06e376c965fa2597fbfeeb1181b5887cc',
'reference' => '4208a23af6f970796fb0f516a8fb274a5d4e8c39',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
......
################
# DrupalCI GitLabCI template
#
# Gitlab-ci.yml to replicate DrupalCI testing for Contrib
#
# With thanks to:
# * The GitLab Acceleration Initiative participants
# * DrupalSpoons
################
################
# Guidelines
#
# This template is designed to give any Contrib maintainer everything they need to test, without requiring modification. It is also designed to keep up to date with Core Development automatically through the use of include files that can be centrally maintained.
#
# However, you can modify this template if you have additional needs for your project.
################
################
# Includes
#
# Additional configuration can be provided through includes.
# One advantage of include files is that if they are updated upstream, the changes affect all pipelines using that include.
#
# Includes can be overridden by re-declaring anything provided in an include, here in gitlab-ci.yml
# https://docs.gitlab.com/ee/ci/yaml/includes.html#override-included-configuration-values
################
include:
################
# DrupalCI includes:
# As long as you include this, any future includes added by the Drupal Association will be accessible to your pipelines automatically.
# View these include files at https://git.drupalcode.org/project/gitlab_templates/
################
- project: $_GITLAB_TEMPLATES_REPO
ref: $_GITLAB_TEMPLATES_REF
file:
- '/includes/include.drupalci.main.yml'
- '/includes/include.drupalci.variables.yml'
- '/includes/include.drupalci.workflows.yml'
################
# Pipeline configuration variables
#
# These are the variables provided to the Run Pipeline form that a user may want to override.
#
# Docs at https://git.drupalcode.org/project/gitlab_templates/-/blob/1.0.x/includes/include.drupalci.variables.yml
################
# variables:
# SKIP_ESLINT: '1'
###################################################################################
#
# *
# /(
# ((((,
# /(((((((
# ((((((((((*
# ,(((((((((((((((
# ,(((((((((((((((((((
# ((((((((((((((((((((((((*
# *(((((((((((((((((((((((((((((
# ((((((((((((((((((((((((((((((((((*
# *(((((((((((((((((( .((((((((((((((((((
# ((((((((((((((((((. /(((((((((((((((((*
# /((((((((((((((((( .(((((((((((((((((,
# ,(((((((((((((((((( ((((((((((((((((((
# .(((((((((((((((((((( .(((((((((((((((((
# ((((((((((((((((((((((( ((((((((((((((((/
# (((((((((((((((((((((((((((/ ,(((((((((((((((*
# .((((((((((((((/ /(((((((((((((. ,(((((((((((((((
# *(((((((((((((( ,(((((((((((((/ *((((((((((((((.
# ((((((((((((((, /(((((((((((((. ((((((((((((((,
# (((((((((((((/ ,(((((((((((((* ,(((((((((((((,
# *((((((((((((( .((((((((((((((( ,(((((((((((((
# ((((((((((((/ /((((((((((((((((((. ,((((((((((((/
# ((((((((((((( *(((((((((((((((((((((((* *((((((((((((
# ((((((((((((( ,(((((((((((((..((((((((((((( *((((((((((((
# ((((((((((((, /((((((((((((* /((((((((((((/ ((((((((((((
# ((((((((((((( /((((((((((((/ (((((((((((((* ((((((((((((
# (((((((((((((/ /(((((((((((( ,((((((((((((, *((((((((((((
# (((((((((((((( *(((((((((((/ *((((((((((((. ((((((((((((/
# *((((((((((((((((((((((((((, /(((((((((((((((((((((((((
# ((((((((((((((((((((((((( ((((((((((((((((((((((((,
# .(((((((((((((((((((((((/ ,(((((((((((((((((((((((
# ((((((((((((((((((((((/ ,(((((((((((((((((((((/
# *((((((((((((((((((((( (((((((((((((((((((((,
# ,(((((((((((((((((((((, ((((((((((((((((((((/
# ,(((((((((((((((((((((* /((((((((((((((((((((
# ((((((((((((((((((((((, ,/((((((((((((((((((((,
# ,(((((((((((((((((((((((((((((((((((((((((((((((((((
# .(((((((((((((((((((((((((((((((((((((((((((((
# .((((((((((((((((((((((((((((((((((((,.
# .,(((((((((((((((((((((((((.
#
###################################################################################
CONTENTS OF THIS FILE
---------------------
* Introduction
* Requirements
* Installation
* Configuration
* Maintainers
INTRODUCTION
------------
# Views Fieldsets
Creates fieldset (and details and div) in Views fields output, to group fields,
by adding a new field: "Global: Fieldset" and a few preprocessors. Also
introduces a new template: views-fieldsets-fieldset.tpl.php where you can
customize your fieldset output.
* For a full description of the module, visit the project page:
https://www.drupal.org/project/views_fieldsets
For a full description of the module, visit the
[project page](https://www.drupal.org/project/admin_menu).
* To submit bug reports and feature suggestions, or to track changes:
https://www.drupal.org/project/issues/views_fieldsets
Submit bug reports and feature suggestions, or track changes in the
[issue queue](https://www.drupal.org/project/issues/admin_menu).
REQUIREMENTS
------------
## Table of contents
This module requires no modules outside of Drupal core.
- Requirements
- Installation
- Configuration
- Maintainers
## Requirements
INSTALLATION
------------
This module requires no modules outside of Drupal core.
## Installation
* Install the Views fieldsets module as you would normally install a
contributed Drupal module. Visit
https://www.drupal.org/node/1897420 for further information.
Install as you would normally install a contributed Drupal module. For further
information, see
[Installing Drupal Modules](https://www.drupal.org/docs/extending-drupal/installing-drupal-modules).
CONFIGURATION
-------------
## Configuration
1. Navigate to Administration > Extend and enable the module.
2. Navigate to Administration > Structure > views and open existing view or
a create a new view.
3. Add some fields.
4. Add field "Global: Fieldset" and customize settings (html tag,
collapsible, tokens etc)
5. Rearrange fields to drag normal fields under Fieldset fields. You can
nest fieldsets. The result will be visible in Preview.
1. Navigate to Administration > Extend and enable the module.
2. Navigate to Administration > Structure > views and open existing view or
a create a new view.
3. Add some fields.
4. Add field "Global: Fieldset" and customize settings (html tag,
collapsible, tokens etc)
5. Rearrange fields to drag normal fields under Fieldset fields. You can
nest fieldsets. The result will be visible in Preview.
Theming:
There are several new templates. You can specify the filename the Views way. See
Theme: Information for theme hook suggestion specifics. Available:
* views-fieldsets-fieldset.tpl.php
* views-fieldsets-fieldset--events.tpl.php
* views-fieldsets-fieldset--default.tpl.php (all tags)
* views-fieldsets-fieldset--default.tpl.php (per tag)
* views-fieldsets-fieldset--page.tpl.php
* views-fieldsets-fieldset--events--page.tpl.php
- views-fieldsets-fieldset.html.twig
- views-fieldsets-fieldset--events.html.twig
- views-fieldsets-fieldset--default.html.twig (all tags)
- views-fieldsets-fieldset--default.html.twig (per tag)
- views-fieldsets-fieldset--page.html.twig
- views-fieldsets-fieldset--events--page.html.twig
And of course the related preprocessors:
```
......@@ -67,12 +59,10 @@ template_preprocess_views_fieldsets_fieldset(),
template_preprocess_views_fieldsets_fieldset__events() etc.
```
## Maintainers
MAINTAINERS
-----------
* rudiedirkx - https://www.drupal.org/u/rudiedirkx
- rudiedirkx (rudiedirkx) - https://www.drupal.org/u/rudiedirkx
Supporting organizations:
* GOLEMS GABB - https://www.drupal.org/golems-gabb
- GOLEMS GABB (golems-gabb) - https://www.drupal.org/golems-gabb
{
"name": "drupal/views_fieldsets",
"description": "Adds fieldsets to Views.",
"type": "drupal-module",
"license": "GPL-2.0-or-later",
"minimum-stability": "dev",
"homepage": "https://drupal.org/project/views_fieldsets",
"support": {
"issues": "https://www.drupal.org/project/issues/views_fieldsets",
"source": "https://git.drupalcode.org/project/views_fieldsets"
}
}
views.field.fieldset:
type: views_field
label: 'Views fieldset field'
mapping:
fields:
type: sequence
sequence:
type: string
wrapper:
type: string
legend:
type: string
classes:
type: string
collapsible:
type: boolean
constraints:
NotNull: [ ]
collapsed:
type: boolean
constraints:
NotNull: [ ]
......@@ -76,6 +76,8 @@ public static function getWrapperTypes() {
'fieldset' => 'fieldset',
'div' => 'div',
];
\Drupal::moduleHandler()->invokeAll('views_fieldsets_wrapper_types_alter', [&$types]);
}
return $types;
}
......@@ -152,9 +154,8 @@ protected function defineOptions() {
* {@inheritdoc}
*/
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$fake_form = [];
parent::buildOptionsForm($fake_form, $form_state);
$form['admin_label'] = $fake_form['admin_label'];
parent::buildOptionsForm($form, $form_state);
$form['fields'] = [
'#type' => 'value',
'#value' => $this->options['fields'],
......@@ -177,7 +178,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
'#type' => 'textfield',
'#title' => $this->t('Wrapper classes'),
'#default_value' => $this->options['classes'],
'#description' => $help_token . ' ' . $this->t('Separate classes with DOUBLE SPACES. Single spaces and much else will be converted to valid class name.'),
'#description' => $help_token . ' ' . $this->t('Separate classes with a comma (,).'),
];
$form['collapsible'] = [
'#type' => 'checkbox',
......@@ -230,6 +231,9 @@ protected function allowAdvancedRender() {
* Override default unneeded method to avoid PHP notices.
*/
public function submitOptionsForm(&$form, FormStateInterface $form_state) {
parent::submitOptionsForm($form, $form_state);
$form_state->setValue('collapsible', (bool) $form_state->getValue('collapsible'));
$form_state->setValue('collapsed', (bool) $form_state->getValue('collapsed'));
}
}
......@@ -9,15 +9,30 @@
use Drupal\views_fieldsets\Plugin\views\field\Fieldset;
/**
* {@inheritdoc}
* Custom class for handling RowFieldset.
*/
class RowFieldset {
public $row;
/**
* Current row being worked.
*
* @var \Drupal\views\ResultRow
*/
public ResultRow $row;
public $properties = [];
/**
* An array of properties for fieldset.
*
* @var array
*/
public array $properties = [];
public $children = [];
/**
* An array children for fieldset.
*
* @var array
*/
public array $children = [];
/**
* Constructs an RowFieldset object.
......@@ -79,10 +94,21 @@ public function getElementtype() {
* Object render().
*/
public function render() {
// @todo Theme hook suggestions!
$children = $this->children;
$show_fieldset = FALSE;
foreach ($children as $child) {
if (isset($child->content)) {
$text = trim(strip_tags($child->content));
if (!empty($text)) {
$show_fieldset = TRUE;
break;
}
}
}
$element = [
'#theme' => 'views_fieldsets_' . $this->getWrapperType(),
'#theme' => $this->themeFunctions($this->getWrapperType()),
'#fields' => $this->children,
'#show_fieldset' => $show_fieldset,
'#legend' => Markup::create($this->getLegend()),
'#collapsible' => (bool) $this->handler->options['collapsible'],
'#attributes' => [
......@@ -93,7 +119,7 @@ public function render() {
$element['#attributes']['class'][] = 'collapsed';
}
return render($element);
return \Drupal::service('renderer')->render($element);
}
/**
......@@ -121,12 +147,10 @@ protected function getLegend() {
* Object getClasses().
*/
protected function getClasses() {
$classes = explode(' ', $this->handler->options['classes']);
$classes = array_map(function ($class) {
$classes = preg_split('/(,| )/', $this->handler->options['classes']);
return array_map(function ($class) {
return Html::getClass($this->tokenize($class));
}, $classes);
return $classes;
}
/**
......@@ -151,4 +175,39 @@ public function addChild(array $fields, $field_name) {
$this->children[$field_name] = $fields[$field_name];
}
/**
* Generate a list of theme hook suggestions.
*
* @param string $type
* Fieldset type.
*
* @return array
* List of theme suggestions.
*/
public function themeFunctions(string $type): array {
$themes = [];
$hook = 'views_fieldsets_' . $type;
$display = $this->handler->view->display_handler->display;
if (!empty($display)) {
$themes[] = $hook . '__' . $this->handler->view->storage->id() . '__' . $display['id'] . '__' . $this->handler->options['id'];
$themes[] = $hook . '__' . $this->handler->view->storage->id() . '__' . $display['id'];
$themes[] = $hook . '__' . $display['id'] . '__' . $this->handler->options['id'];
$themes[] = $hook . '__' . $display['id'];
if ($display['id'] != $display['display_plugin']) {
$themes[] = $hook . '__' . $this->handler->view->storage->id() . '__' . $display['display_plugin'] . '__' . $this->handler->options['id'];
$themes[] = $hook . '__' . $this->handler->view->storage->id() . '__' . $display['display_plugin'];
$themes[] = $hook . '__' . $display['display_plugin'] . '__' . $this->handler->options['id'];
$themes[] = $hook . '__' . $display['display_plugin'];
}
}
$themes[] = $hook . '__' . $this->handler->view->storage->id() . '__' . $this->handler->options['id'];
$themes[] = $hook . '__' . $this->handler->view->storage->id();
$themes[] = $hook . '__' . $this->handler->options['id'];
$themes[] = $hook;
return $themes;
}
}
{% if show_fieldset %}
<details {{ attributes }}>
{% if legend %}
<summary>{{ legend }}</summary>
{% endif %}
{% include 'views-view-fields.html.twig' %}
</details>
{% endif %}
{% if show_fieldset %}
<div {{ attributes }}>
{% include 'views-view-fields.html.twig' %}
</div>
{% endif %}
{% if show_fieldset %}
<fieldset {{ attributes }}>
{% if legend %}
<legend>{{ legend }}</legend>
{% endif %}
{% include 'views-view-fields.html.twig' %}
</fieldset>
{% endif %}
<details {{ attributes }}>
{% if legend %}
<summary>{{ legend }}</summary>
{% endif %}
{% include 'views-view-fields.html.twig' %}
</details>
<div {{ attributes }}>
{% include 'views-view-fields.html.twig' %}
</div>
<fieldset {{ attributes }}>
{% if legend %}
<legend>{{ legend }}</legend>
{% endif %}
{% include 'views-view-fields.html.twig' %}
</fieldset>
<?php
/**
* @file
* Hooks defined by Views Fieldset.
*/
/**
* Alter the options for the views fieldset module.
*
* @param array $data
* List of fieldset options.
*/
function hook_views_fieldsets_wrapper_types_alter(array &$data) {
$data["modal-group"] = "modal-group";
}
......@@ -2,9 +2,9 @@ name: Views Fieldsets
type: module
description: Adds fieldsets to Views.
package: Views
core_version_requirement: ^8 || ^9
core_version_requirement: '>=9'
# Information added by Drupal.org packaging script on 2021-06-13
version: '8.x-3.4'
# Information added by Drupal.org packaging script on 2023-09-05
version: '4.0.0'
project: 'views_fieldsets'
datestamp: 1623608187
datestamp: 1693927688
......@@ -2,4 +2,4 @@ admin:
version: 1.x
css:
theme:
views_fieldsets.admin.css: {}
css/views-fieldsets-admin.css: {}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment