Skip to content

Commit

Permalink
bug #4643 [3.5] Regression Fix - Remove text align as it overwrites t…
Browse files Browse the repository at this point in the history
…he attribute (breaks some custom fields) (Schyzophrenic)

This PR was squashed before being merged into the 4.x branch.

Discussion
----------

[3.5] Regression Fix - Remove text align as it overwrites the attribute (breaks some custom fields)

This change fixes some Custom fields post 3.5 migration, The $textAlign variable overwrote any other attribute which could have been defined in a Custom field and would therefore prevent them from working properly.

I am not sure why this was introduced, but we surely can handle the same via a css class instead. I didn't observe any noticeable changes.

This seems quite critical to me to be able to use the attr to pass on parameters to the fields.

Commits
-------

aa2bc5a [3.5] Regression Fix - Remove text align as it overwrites the attribute (breaks some custom fields)
  • Loading branch information
javiereguiluz committed Jul 16, 2022
2 parents a76278c + aa2bc5a commit 06ca05a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/Dto/FieldDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Config\KeyValueStore;
use EasyCorp\Bundle\EasyAdminBundle\Config\Option\TextAlign;
use function Symfony\Component\String\u;
use Symfony\Component\Uid\Ulid;
use Symfony\Contracts\Translation\TranslatableInterface;
Expand Down Expand Up @@ -239,7 +238,7 @@ public function setVirtual(bool $isVirtual): void
$this->virtual = $isVirtual;
}

public function getTextAlign(): string
public function getTextAlign(): ?string
{
return $this->textAlign;
}
Expand Down

4 comments on commit 06ca05a

@Ang3
Copy link
Contributor

@Ang3 Ang3 commented on 06ca05a Jul 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,

<td data-label="{{ field.label|trans|e('html_attr') }}" class="{{ field.property == sort_field_name ? 'sorted' }} text-{{ field.textAlign }} {{ field.cssClass }}" dir="{{ ea.i18n.textDirection }}">

Look at the end, text-{{ field.textAlign }}. There is no default value so I have text- now.

@javiereguiluz
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ang3 yes, but it's OK because it doesn't have any practical affect (I mean, it doesn't break anything in the design).

@Ang3
Copy link
Contributor

@Ang3 Ang3 commented on 06ca05a Jul 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@javiereguiluz Thank your for your fast answer. I don't know if this PR breaks the association field, but now all my association fields are aligned to the right (but I'm in LTR).

if (null === $field->getTextAlign()) {
$field->setTextAlign(TextAlign::RIGHT);
}

I had to create a configurator to modify this alignment. Maybe we should take care of the intl mode here (LTR/RTL).

@javiereguiluz
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've created a new issue to not forget about solving this problem: #5342

Please sign in to comment.