Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
N
node_authlink
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
node_authlink
Commits
9ca50fea
Commit
9ca50fea
authored
Aug 22, 2018
by
akalam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
format_iterval function does not exists in d8
parent
036ffd15
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
node_authlink.module
node_authlink.module
+10
-2
No files found.
node_authlink.module
View file @
9ca50fea
...
...
@@ -16,7 +16,7 @@ function node_authlink_form_node_type_form_alter(&$form, FormStateInterface &$fo
/** @var \Drupal\node\Entity\NodeType $node_type */
$node_type
=
$form_state
->
getFormObject
();
$type
=
$node_type
->
id
();
$type
=
$node_type
->
getEntity
()
->
id
();
$config
=
\
Drupal
::
config
(
'node_authlink.settings'
);
$form
[
'node_authlink'
]
=
[
...
...
@@ -48,7 +48,7 @@ function node_authlink_form_node_type_form_alter(&$form, FormStateInterface &$fo
// Time periods: none, 1 day, 1 week, 4 weeks
$time_periods
=
[
0
,
86400
,
604800
,
2419200
];
$period
=
array_map
(
'format_interval'
,
array_combine
(
$time_periods
,
$time_periods
)
);
$period
=
node_authlink_build_options
(
$time_periods
);
$period
[
0
]
=
'<'
.
t
(
'disabled'
)
.
'>'
;
$form
[
'node_authlink'
][
'node_authlink_expire'
]
=
[
...
...
@@ -80,6 +80,14 @@ function node_authlink_form_node_type_form_alter(&$form, FormStateInterface &$fo
$form
[
'#submit'
][]
=
'node_authlink_form_node_type_form_alter_submit'
;
}
function
node_authlink_build_options
(
array
$time_intervals
,
$granularity
=
2
,
$langcode
=
NULL
)
{
$callback
=
function
(
$value
)
use
(
$granularity
,
$langcode
)
{
return
\
Drupal
::
service
(
'date.formatter'
)
->
formatInterval
(
$value
,
$granularity
,
$langcode
);
};
return
array_combine
(
$time_intervals
,
array_map
(
$callback
,
$time_intervals
));
}
/**
* Submit for node_type_form.
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment