Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
Project
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
Gorodkov Denis
Project
Commits
733de4d5
Commit
733de4d5
authored
May 23, 2022
by
Gorodkov Denis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add cache context
parent
c62384ff
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
1 deletion
+19
-1
mymodule.module
app/docroot/modules/custom/mymodule/mymodule.module
+16
-1
DrupalJedi.theme
app/docroot/themes/custom/DrupalJedi/DrupalJedi.theme
+3
-0
No files found.
app/docroot/modules/custom/mymodule/mymodule.module
View file @
733de4d5
...
@@ -3,8 +3,10 @@
...
@@ -3,8 +3,10 @@
* @file
* @file
* Main file for hooks and custom functions.
* Main file for hooks and custom functions.
*/
*/
use
Symfony\Component\HttpKernel\Exception\NotFoundHttpException
;
use
Drupal\Core\Cache\CacheableMetadata
;
use
Symfony\Component\HttpKernel\Exception\NotFoundHttpException
;
use
Drupal\Core\Entity\EntityInterface
;
/**
/**
* Implements hook_cron().
* Implements hook_cron().
*/
*/
...
@@ -69,3 +71,16 @@ function mymodule_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_
...
@@ -69,3 +71,16 @@ function mymodule_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_
$form
[
"actions"
][
"reset"
][
"#access"
]
=
true
;
$form
[
"actions"
][
"reset"
][
"#access"
]
=
true
;
}
}
}
}
/**
* Implements hook_node_view().
*/
function
mymodule_node_view
(
array
&
$build
,
\Drupal\Core\Entity\EntityInterface
$entity
,
\Drupal\Core\Entity\Display\EntityViewDisplayInterface
$display
,
$view_mode
)
{
$bundle
=
$entity
->
bundle
();
if
(
$bundle
==
'people'
)
{
$build
[
'#cache'
][
'contexts'
][]
=
'url.query_args'
;
$entity
->
save
();
}
}
app/docroot/themes/custom/DrupalJedi/DrupalJedi.theme
View file @
733de4d5
<?php
<?php
use
Drupal\Core\Cache\CacheableMetadata
;
use
Drupal\Core\Entity\EntityInterface
;
/**
/**
* @file
* @file
* Bootstrap sub-theme.
* Bootstrap sub-theme.
...
...
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