Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
user_manual
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
user_manual
Commits
d7f368c7
Commit
d7f368c7
authored
2 years ago
by
Sagar Ramgade
Committed by
Jeff Landfried
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3308569
by Sagar Ramgade, jlandfried, Andy Inman: Add URL aliases to entities
parent
9b9edc5e
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!16
Issue #3308569: Add URL aliases to entities
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/Entity/UserManual.php
+13
-0
13 additions, 0 deletions
src/Entity/UserManual.php
src/Form/UserManualForm.php
+1
-1
1 addition, 1 deletion
src/Form/UserManualForm.php
user_manual.module
+8
-2
8 additions, 2 deletions
user_manual.module
with
22 additions
and
3 deletions
src/Entity/UserManual.php
+
13
−
0
View file @
d7f368c7
...
...
@@ -234,6 +234,19 @@ class UserManual extends EditorialContentEntityBase {
'weight'
=>
-
3
,
]);
if
(
\Drupal
::
moduleHandler
()
->
moduleExists
(
'path'
))
{
$fields
[
'path'
]
=
BaseFieldDefinition
::
create
(
'path'
)
->
setCustomStorage
(
TRUE
)
->
setLabel
(
t
(
'URL alias'
))
->
setTranslatable
(
TRUE
)
->
setComputed
(
TRUE
)
->
setDisplayOptions
(
'form'
,
[
'type'
=>
'path'
,
'weight'
=>
100
,
])
->
setDisplayConfigurable
(
'form'
,
TRUE
);
}
$fields
[
'created'
]
=
BaseFieldDefinition
::
create
(
'created'
)
->
setLabel
(
t
(
'Created'
))
->
setDescription
(
t
(
'The time that the entity was created.'
));
...
...
This diff is collapsed.
Click to expand it.
src/Form/UserManualForm.php
+
1
−
1
View file @
d7f368c7
...
...
@@ -52,7 +52,7 @@ class UserManualForm extends ContentEntityForm {
'#title'
=>
$this
->
t
(
'Publishing Information'
),
'#open'
=>
TRUE
,
'#tree'
=>
FALSE
,
'#weight'
=>
1
00
,
'#weight'
=>
1
1
,
];
if
(
isset
(
$form
[
'new_revision'
]))
{
...
...
This diff is collapsed.
Click to expand it.
user_manual.module
+
8
−
2
View file @
d7f368c7
...
...
@@ -5,6 +5,8 @@
* User Manual module file.
*/
use
Drupal\Core\Entity\EntityTypeInterface
;
use
Drupal\Core\Field\BaseFieldDefinition
;
use
Drupal\field\Entity\FieldConfig
;
use
Drupal\field\Entity\FieldStorageConfig
;
use
Drupal\Core\Link
;
...
...
@@ -160,7 +162,8 @@ function user_manual_add_default_fields($user_manual_type_id) {
'teaser'
=>
[
'display_label'
=>
'hidden'
,
'display_type'
=>
'text_summary_or_trimmed'
]
],
'weight'
=>
5
,
],
'field_manual_topics'
=>
[
'label'
=>
'Topics'
,
...
...
@@ -182,6 +185,7 @@ function user_manual_add_default_fields($user_manual_type_id) {
],
],
],
'weight'
=>
6
,
]
];
...
...
@@ -218,7 +222,8 @@ function user_manual_add_default_fields($user_manual_type_id) {
$display_repository
->
getFormDisplay
(
'user_manual'
,
$user_manual_type_id
)
->
setComponent
(
$field_key
,
[
'type'
=>
$field_data
[
'type'
],
'settings'
=>
$field_data
[
'form_settings'
]
'settings'
=>
$field_data
[
'form_settings'
],
'weight'
=>
$field_data
[
'weight'
],
])
->
save
();
// Assign display settings for default view mode.
...
...
@@ -240,3 +245,4 @@ function user_manual_add_default_fields($user_manual_type_id) {
}
}
}
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