Skip to content

Commit cc2540a

Browse files
committedNov 26, 2024·
minor #6578 Misc tweaks related to icons (javiereguiluz)
This PR was merged into the 4.x branch. Discussion ---------- Misc tweaks related to icons Commits ------- b49c4df Misc tweaks related to icons
2 parents 074cec1 + b49c4df commit cc2540a

File tree

6 files changed

+32
-17
lines changed

6 files changed

+32
-17
lines changed
 

‎UPGRADE.md

+16-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,22 @@ icons included by default in EasyAdmin are now inlined as SVGs. The font files
1212

1313
This doesn't require any change on your side, unless you were relying on the
1414
FontAwesome CSS classes to style the icons, which is something undocumented and
15-
not recommended.
15+
not recommended. In that case, replace the `fa-*` CSS classes by the new Twig
16+
Component that renders icons:
17+
18+
```twig
19+
{# Before: #}
20+
<i class="fa-regular fa-user"></i>
21+
<i class="far fa-user"></i>
22+
<i class="fa-solid fa-tags"></i>
23+
<i class="fas fa-tags"></i>
24+
25+
{# After: #}
26+
<twig:ea:Icon name="fa6-regular:user" />
27+
<twig:ea:Icon name="fa6-regular:user" />
28+
<twig:ea:Icon name="fa6-solid:tags" />
29+
<twig:ea:Icon name="fa6-solid:tags" />
30+
```
1631

1732
EasyAdmin 4.14.0
1833
----------------

‎doc/dashboards.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -537,11 +537,11 @@ the second argument is the icon to display. The icon name follows the pattern
537537
(``fa6-regular:``, ``fa6-solid:`` and ``fa6-brands:``), but you can
538538
:ref:`use your own icon sets <icon-customization>`.
539539

540-
.. deprecated:: 4.16
540+
.. deprecated:: 4.16
541541

542-
In EasyAdmin versions prior to 4.16.0, the icon name was defined as the full
543-
FontAwesome CSS class: e.g., ``fa-regular fa-user``. This syntax is now
544-
deprecated and will be removed in EasyAdmin 5.0.0.
542+
In EasyAdmin versions prior to 4.16.0, the icon name was defined as the full
543+
FontAwesome CSS class: e.g., ``fa-regular fa-user`` or ``far fa-user``.
544+
This syntax is now deprecated and will be removed in EasyAdmin 5.0.0.
545545

546546
Menu Item Configuration Options
547547
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

‎doc/design.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ icons), pass it to the ``useCustomIconSet()`` method::
6363

6464
return Assets::new()->useCustomIconSet('tabler');
6565

66-
Now, the `tabler:`` prefix will be added automatically to all your custom icon
66+
Now, the ``tabler:`` prefix will be added automatically to all your custom icon
6767
names. This way, you can use names like ``user`` and ``file`` instead of
6868
``tabler:user`` and ``tabler:file``.
6969

‎src/Config/Action.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __toString()
4343

4444
/**
4545
* @param TranslatableInterface|string|false|null $label Use FALSE to hide the label; use NULL to autogenerate it
46-
* @param string|null $icon The full CSS classes of the FontAwesome icon to render (see https://fontawesome.com/v6/search?m=free)
46+
* @param string|null $icon The full FontAwesome icon name to render (e.g. 'fa6-solid:user', 'fa6-regular:lines') (see https://fontawesome.com/v6/search?m=free)
4747
*/
4848
public static function new(string $name, $label = null, ?string $icon = null): self
4949
{

‎src/Config/MenuItem.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -22,63 +22,63 @@ private function __construct()
2222
}
2323

2424
/**
25-
* @param string|null $icon The full CSS classes of the FontAwesome icon to render (see https://fontawesome.com/v6/search?m=free)
25+
* @param string|null $icon The full FontAwesome icon name to render (e.g. 'fa6-solid:user', 'fa6-regular:lines') (see https://fontawesome.com/v6/search?m=free)
2626
*/
2727
public static function linkToCrud(TranslatableInterface|string $label, ?string $icon, string $entityFqcn): CrudMenuItem
2828
{
2929
return new CrudMenuItem($label, $icon, $entityFqcn);
3030
}
3131

3232
/**
33-
* @param string|null $icon The full CSS classes of the FontAwesome icon to render (see https://fontawesome.com/v6/search?m=free)
33+
* @param string|null $icon The full FontAwesome icon name to render (e.g. 'fa6-solid:user', 'fa6-regular:lines') (see https://fontawesome.com/v6/search?m=free)
3434
*/
3535
public static function linkToDashboard(TranslatableInterface|string $label, ?string $icon = null): DashboardMenuItem
3636
{
3737
return new DashboardMenuItem($label, $icon);
3838
}
3939

4040
/**
41-
* @param string|null $icon The full CSS classes of the FontAwesome icon to render (see https://fontawesome.com/v6/search?m=free)
41+
* @param string|null $icon The full FontAwesome icon name to render (e.g. 'fa6-solid:user', 'fa6-regular:lines') (see https://fontawesome.com/v6/search?m=free)
4242
*/
4343
public static function linkToExitImpersonation(TranslatableInterface|string $label, ?string $icon = null): ExitImpersonationMenuItem
4444
{
4545
return new ExitImpersonationMenuItem($label, $icon);
4646
}
4747

4848
/**
49-
* @param string|null $icon The full CSS classes of the FontAwesome icon to render (see https://fontawesome.com/v6/search?m=free)
49+
* @param string|null $icon The full FontAwesome icon name to render (e.g. 'fa6-solid:user', 'fa6-regular:lines') (see https://fontawesome.com/v6/search?m=free)
5050
*/
5151
public static function linkToLogout(TranslatableInterface|string $label, ?string $icon = null): LogoutMenuItem
5252
{
5353
return new LogoutMenuItem($label, $icon);
5454
}
5555

5656
/**
57-
* @param string|null $icon The full CSS classes of the FontAwesome icon to render (see https://fontawesome.com/v6/search?m=free)
57+
* @param string|null $icon The full FontAwesome icon name to render (e.g. 'fa6-solid:user', 'fa6-regular:lines') (see https://fontawesome.com/v6/search?m=free)
5858
*/
5959
public static function linkToRoute(TranslatableInterface|string $label, ?string $icon, string $routeName, array $routeParameters = []): RouteMenuItem
6060
{
6161
return new RouteMenuItem($label, $icon, $routeName, $routeParameters);
6262
}
6363

6464
/**
65-
* @param string|null $icon The full CSS classes of the FontAwesome icon to render (see https://fontawesome.com/v6/search?m=free)
65+
* @param string|null $icon The full FontAwesome icon name to render (e.g. 'fa6-solid:user', 'fa6-regular:lines') (see https://fontawesome.com/v6/search?m=free)
6666
*/
6767
public static function linkToUrl(TranslatableInterface|string $label, ?string $icon, string $url): UrlMenuItem
6868
{
6969
return new UrlMenuItem($label, $icon, $url);
7070
}
7171

7272
/**
73-
* @param string|null $icon The full CSS classes of the FontAwesome icon to render (see https://fontawesome.com/v6/search?m=free)
73+
* @param string|null $icon The full FontAwesome icon name to render (e.g. 'fa6-solid:user', 'fa6-regular:lines') (see https://fontawesome.com/v6/search?m=free)
7474
*/
7575
public static function section(TranslatableInterface|string|null $label = null, ?string $icon = null): SectionMenuItem
7676
{
7777
return new SectionMenuItem($label, $icon);
7878
}
7979

8080
/**
81-
* @param string|null $icon The full CSS classes of the FontAwesome icon to render (see https://fontawesome.com/v6/search?m=free)
81+
* @param string|null $icon The full FontAwesome icon name to render (e.g. 'fa6-solid:user', 'fa6-regular:lines') (see https://fontawesome.com/v6/search?m=free)
8282
*/
8383
public static function subMenu(TranslatableInterface|string $label, ?string $icon = null): SubMenuItem
8484
{

‎src/Field/FormField.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public static function new(string $propertyName, $label = null)
3737

3838
/**
3939
* @param TranslatableInterface|string|false|null $label
40-
* @param string|null $icon The full CSS classes of the FontAwesome icon to render (see https://fontawesome.com/v6/search?m=free)
40+
* @param string|null $icon The full FontAwesome icon name to render (e.g. 'fa6-solid:user', 'fa6-regular:lines') (see https://fontawesome.com/v6/search?m=free)
4141
*/
4242
public static function addPanel($label = false, ?string $icon = null): self
4343
{
@@ -52,7 +52,7 @@ public static function addPanel($label = false, ?string $icon = null): self
5252

5353
/**
5454
* @param TranslatableInterface|string|false|null $label
55-
* @param string|null $icon The full CSS classes of the FontAwesome icon to render (see https://fontawesome.com/v6/search?m=free)
55+
* @param string|null $icon The full FontAwesome icon name to render (e.g. 'fa6-solid:user', 'fa6-regular:lines') (see https://fontawesome.com/v6/search?m=free)
5656
*/
5757
public static function addFieldset($label = false, ?string $icon = null): self
5858
{

0 commit comments

Comments
 (0)
Please sign in to comment.