Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
label_help
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
label_help
Merge requests
!15
Issue
#3495516
by jwilson3: Add Label Help support for Title field
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Issue
#3495516
by jwilson3: Add Label Help support for Title field
issue/label_help-3495516:3495516-label-help-custom-code
into
2.0.x
Overview
0
Commits
3
Pipelines
6
Changes
3
Merged
James Wilson
requested to merge
issue/label_help-3495516:3495516-label-help-custom-code
into
2.0.x
4 months ago
Overview
0
Commits
3
Pipelines
6
Changes
3
Expand
Closes
#3495516
0
0
Merge request reports
Compare
2.0.x
version 4
5188d5fe
4 months ago
version 3
aadf31bf
4 months ago
version 2
60a78b74
4 months ago
version 1
104fa90c
4 months ago
2.0.x (base)
and
latest version
latest version
2d2326fd
3 commits,
4 months ago
version 4
5188d5fe
1 commit,
4 months ago
version 3
aadf31bf
1 commit,
4 months ago
version 2
60a78b74
4 commits,
4 months ago
version 1
104fa90c
1 commit,
4 months ago
3 files
+
101
−
43
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
modules/label_help_test/label_help_test.module
+
47
−
0
Options
@@ -4,3 +4,50 @@
@@ -4,3 +4,50 @@
* @file
* @file
* Primary module hooks for Label Help Test module.
* Primary module hooks for Label Help Test module.
*/
*/
/**
* Implements hook_form_FORM_ID_alter().
*
* Adds label help text to the core Article node form title field.
*/
function
label_help_test_form_node_article_form_alter
(
&
$form
,
&
$form_state
,
$form_id
)
{
$form
[
'title'
][
'#label_help'
]
=
t
(
'Label help message for the Title field.'
);
}
/**
* Implements hook_form_alter().
*
* Adds label help text to fields in our Test content type form.
*
* This hook implementation targets the test_label_help_core_fields content type
* forms and adds label help text to the core title field and custom fields
* (textfield and checkbox).
*/
function
label_help_test_form_alter
(
&
$form
,
&
$form_state
,
$form_id
)
{
// Only affect the specified content type's add/edit forms.
if
(
!
in_array
(
$form_id
,
[
'node_test_label_help_core_fields_form'
,
'node_test_label_help_core_fields_edit_form'
,
]))
{
return
;
}
// Add Label Help text to the Node Title field.
if
(
isset
(
$form
[
'title'
]))
{
$form
[
'title'
][
'#label_help'
]
=
t
(
'Label help message for the Title field.'
);
}
// Create a custom text field with Label Help text.
$form
[
'field_lh_textfield'
]
=
[
'#type'
=>
'textfield'
,
'#title'
=>
t
(
'Custom text field'
),
'#label_help'
=>
t
(
'Label help message for the Custom text field.'
),
];
// Create a custom checkbox field with Label Help text.
$form
[
'field_lh_checkbox'
]
=
[
'#type'
=>
'checkbox'
,
'#title'
=>
t
(
'Custom checkbox field'
),
'#label_help'
=>
t
(
'Label help message for the Custom checkbox field.'
),
];
}
Loading