Skip to content

Commit

Permalink
Merge branch 'release/v1.0.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
tuxes3 committed Oct 12, 2023
2 parents 3054cce + 5458f05 commit a3f8719
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/6.0/phpunit.xsd"
colors="true"
bootstrap="tests/bootstrap.php"
failOnRisky="true"
Expand Down
5 changes: 5 additions & 0 deletions src/DataLoader/AbstractDataLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ public function setOptions(array $options): void
$this->options = $resolver->resolve($options);
}

public function setOption(string $option, mixed $value): void
{
$this->options[$option] = $value;
}

public function configureOptions(OptionsResolver $resolver): void
{
}
Expand Down
2 changes: 2 additions & 0 deletions src/DataLoader/DataLoaderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public function configureOptions(OptionsResolver $resolver): void;

public function setOptions(array $options): void;

public function setOption(string $option, mixed $value): void;

public function getResults(): iterable;

public function getOption(string $option);
Expand Down
3 changes: 3 additions & 0 deletions src/DataLoader/DoctrineDataLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public function getResults(): iterable
'param' => $param,
'entity' => $qbSave->getDQLPart('from')[0]->getFrom(),
]));
} elseif ($this->requestStack->getCurrentRequest()?->hasSession()) {
$this->requestStack->getSession()->remove(self::LAST_TABLE_QUERY);
}

if ($this->paginationExtension->getLimit()) {
Expand Down Expand Up @@ -133,6 +135,7 @@ protected function getSessionNextPrevData(mixed $current): ?array
if (!$this->requestStack->getCurrentRequest()?->hasSession()) {
return null;
}

$lastQuery = $this->requestStack?->getSession()->get(self::LAST_TABLE_QUERY);
if ($lastQuery === null) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/views/tailwind_2/_table.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
{% endif %}
{% for column in table.columns %}
<th class="px-3 py-3 align-top whitespace-nowrap">
{{ column.option('label')|trans }}
{{ column.option('label_html')|raw }} {{ column.option('label')|trans }}

{% if table.option('sortable') and table.sortExtension and column.option('sortable') %}
{% set currentOrder = table.sortExtension.order(column) %}
Expand Down
3 changes: 3 additions & 0 deletions src/Table/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class Column extends AbstractColumn implements FormattableColumnInterface
{
public const OPT_LABEL = 'label';

public const OPT_LABEL_HTML = 'label_html';

public const OPT_ACCESSOR_PATH = 'accessor_path';

public const OPT_CALLABLE = 'callable';
Expand Down Expand Up @@ -42,6 +44,7 @@ public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
self::OPT_LABEL => $this->identifier,
self::OPT_LABEL_HTML => null,
self::OPT_ACCESSOR_PATH => $this->identifier,
self::OPT_CALLABLE => null,
self::OPT_LINK_THE_COLUMN_CONTENT => false,
Expand Down

0 comments on commit a3f8719

Please sign in to comment.