Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
aggrid
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
aggrid
Commits
5e7de2c6
Commit
5e7de2c6
authored
4 years ago
by
Mike Feranda
Committed by
Mike Feranda
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3171640
by mferanda: Add twig and output variables from htmlformatter
parent
63b7765b
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
aggrid.module
+8
-2
8 additions, 2 deletions
aggrid.module
src/Plugin/Field/FieldFormatter/HtmlFormatterType.php
+22
-4
22 additions, 4 deletions
src/Plugin/Field/FieldFormatter/HtmlFormatterType.php
templates/aggrid-table.html.twig
+13
-0
13 additions, 0 deletions
templates/aggrid-table.html.twig
with
43 additions
and
6 deletions
aggrid.module
+
8
−
2
View file @
5e7de2c6
...
...
@@ -47,8 +47,14 @@ function aggrid_help($route_name, RouteMatchInterface $route_match) {
*/
function
aggrid_theme
()
{
return
[
'aggrid'
=>
[
'render element'
=>
'children'
,
'aggrid_table'
=>
[
'variables'
=>
[
'headers'
=>
NULL
,
'rowSettings'
=>
NULL
,
'rowSuppression'
=>
NULL
,
'rowData'
=>
NULL
,
'attributes'
=>
[]
],
],
];
}
...
...
This diff is collapsed.
Click to expand it.
src/Plugin/Field/FieldFormatter/HtmlFormatterType.php
+
22
−
4
View file @
5e7de2c6
...
...
@@ -29,6 +29,13 @@ class HtmlFormatterType extends FormatterBase {
* @var boolean
*/
protected
$suppComplimentary
;
/**
* Complimentary suppression for aggrid item.
*
* @var array
*/
protected
$rowSuppression
;
/**
* {@inheritdoc}
...
...
@@ -605,6 +612,11 @@ class HtmlFormatterType extends FormatterBase {
}
}
// If suppression, then apply to variable
if
(
$suppCell
)
{
$this
->
rowSuppression
=
$suppCell
;
}
// Process actual suppressions
if
(
!
$suppOverride
)
{
foreach
(
$suppCell
as
$row
=>
$value
)
{
...
...
@@ -896,7 +908,9 @@ class HtmlFormatterType extends FormatterBase {
// Data rows.
$table_render
.
=
$this
->
createAggridRowData
(
$rowSettings
,
$headers
,
$rowData
);
// Set the row suppression from after the actual rowData is run
$rowSuppression
=
$this
->
rowSuppression
;
// Pinned Bottom Row Settings.
$pinnedBottomRowSettings
[][][]
=
""
;
$pinnedBottomRowSettings
=
$this
->
getRowSettings
(
$aggridRowSettings
,
$headers
,
$pinnedBottomRowData
,
'b-'
);
...
...
@@ -906,10 +920,15 @@ class HtmlFormatterType extends FormatterBase {
// Close up the table.
$table_render
.
=
'</tbody></table>'
;
$elements
[
$delta
][
'container'
]
=
[
'#theme'
=>
'aggrid_table'
,
'#title'
=>
$this
->
fieldDefinition
->
label
(),
'#description'
=>
$this
->
fieldDefinition
->
getDescription
(),
'#headers'
=>
$headers
,
'#rowSettings'
=>
$rowSettings
,
'#rowSuppression'
=>
$rowSuppression
,
'#rowData'
=>
$rowData
,
'#suffix'
=>
$table_render
,
'#attached'
=>
[
'library'
=>
[
...
...
@@ -917,8 +936,7 @@ class HtmlFormatterType extends FormatterBase {
],
],
];
/*
* Putting this code to the side for now. They're currently working on multiple headers
* for the '#type' => 'table'
...
...
This diff is collapsed.
Click to expand it.
templates/aggrid-table.html.twig
0 → 100644
+
13
−
0
View file @
5e7de2c6
{#
/**
* @file
* Theme for Plugin/Field/FieldFormatter/HtmlFormatterType.php
*
* Available variables:
* - headers: Header data
* - rowSettings: All settings for this aggrid item.
* - rowSuppression: All suppression information
* - rowData: Actual data from DB (json field)
*
*/
#}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment