Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
iconify_icons
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
iconify_icons
Commits
eca5c1f4
Commit
eca5c1f4
authored
1 month ago
by
David Galeano
Browse files
Options
Downloads
Patches
Plain Diff
Resolve
#3495277
"Add a link"
parent
26a5f44e
No related branches found
No related tags found
1 merge request
!26
Resolve #3495277 "Add a link"
Pipeline
#384829
passed with warnings
1 month ago
Stage: build
Stage: validate
Stage: test
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/iconify_icons_provider/iconify_icons_provider.info.yml
+1
-1
1 addition, 1 deletion
...es/iconify_icons_provider/iconify_icons_provider.info.yml
modules/iconify_icons_provider/iconify_icons_provider.module
+40
-5
40 additions, 5 deletions
modules/iconify_icons_provider/iconify_icons_provider.module
with
41 additions
and
6 deletions
modules/iconify_icons_provider/iconify_icons_provider.info.yml
+
1
−
1
View file @
eca5c1f4
...
...
@@ -2,6 +2,6 @@ name: 'Iconify Icons Provider'
type
:
module
description
:
'
Iconify
Icons
provider
to
allow
definition
of
Icons
from
Iconify.'
package
:
User interface
core_version_requirement
:
^10.3 ||
^11
core_version_requirement
:
^11
dependencies
:
-
iconify_icons:iconify_icons
This diff is collapsed.
Click to expand it.
modules/iconify_icons_provider/iconify_icons_provider.module
+
40
−
5
View file @
eca5c1f4
...
...
@@ -22,6 +22,10 @@ function iconify_icons_provider_icon_pack_alter(array &$icon_pack_definitions):
$collections
=
$config
->
get
(
'collections'
);
if
(
empty
(
$collections
))
{
return
;
}
// Iterate through each collection and create a corresponding icon pack.
foreach
(
$collections
as
$collection
)
{
// Generate a machine name for the icon pack based on the collection name.
...
...
@@ -133,11 +137,42 @@ function _iconify_icons_provider_build_icon_template(): string {
* is enabled.
*/
function
iconify_icons_provider_form_field_config_edit_form_alter
(
&
$form
,
FormStateInterface
$form_state
,
$form_id
)
:
void
{
if
(
\Drupal
::
moduleHandler
()
->
moduleExists
(
'ui_icons_field'
))
{
$settings
=
$form
[
'settings'
]
??
[];
if
(
!
\Drupal
::
moduleHandler
()
->
moduleExists
(
'ui_icons_field'
))
{
return
;
}
if
(
$settings
&&
array_key_exists
(
'allowed_icon_pack'
,
$settings
))
{
$form
[
'settings'
][
'allowed_icon_pack'
][
'#description'
]
.
=
'<br /><a href="'
.
Url
::
fromRoute
(
'iconify_icons_provider.settings'
,
[],
[
'absolute'
=>
TRUE
])
->
toString
()
.
'">'
.
t
(
'Add Iconify Icons Packs'
)
.
'</a>'
;
}
$settings
=
$form
[
'settings'
]
??
[];
if
(
$settings
&&
array_key_exists
(
'allowed_icon_pack'
,
$settings
))
{
$form
[
'settings'
][
'allowed_icon_pack'
][
'#description'
]
.
=
_iconify_icons_provider_get_iconify_icons_pack_link
();
}
}
/**
* Implements hook_form_FORM_ID_alter().
*
* Add a link to the Iconify Icons Packs configuration page if ui_icons_text
* is enabled.
*/
function
iconify_icons_provider_form_alter
(
&
$form
,
FormStateInterface
$form_state
,
$form_id
)
:
void
{
if
(
!
\Drupal
::
moduleHandler
()
->
moduleExists
(
'ui_icons_text'
))
{
return
;
}
$icon_embed
=
$form
[
'filters'
][
'settings'
][
'icon_embed'
]
??
[];
if
(
isset
(
$icon_embed
[
'allowed_icon_pack'
]))
{
$form
[
'filters'
][
'settings'
][
'icon_embed'
][
'allowed_icon_pack'
][
'#description'
]
.
=
_iconify_icons_provider_get_iconify_icons_pack_link
();
}
}
/**
* Helper method to get the link to the Iconify Icons Packs configuration page.
*
* @return string
* The link to the Iconify Icons Packs configuration page.
*/
function
_iconify_icons_provider_get_iconify_icons_pack_link
():
string
{
$url
=
Url
::
fromRoute
(
'iconify_icons_provider.settings'
,
[],
[
'absolute'
=>
TRUE
])
->
toString
();
return
'<br /><a target="_blank" href="'
.
$url
.
'">'
.
t
(
'Add Iconify Icons Packs'
)
.
'</a>'
;
}
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