Example of batched update some entities with hook_post_update_NAME() or hook_update_N().
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $parameters = \Drupal::routeMatch()->getParameters(); | |
| foreach ($parameters as $parameter) { | |
| if ($parameter instanceof EntityInterface) { | |
| // Entity page. | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% if next or previous %} | |
| <div class="previous-next"> | |
| <div class="previous-next__previous"> | |
| {% if previous %} | |
| <a href="{{ previous.url }}" class="previous-next__link previous-next__link--previous"> | |
| <span>← {{ 'Previous post'|t }}</span> | |
| {{ previous.label }} | |
| </a> | |
| {% endif %} | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { | |
| "provider_name": "23HQ", | |
| "provider_url": "http:\/\/www.23hq.com", | |
| "endpoints": [ | |
| { | |
| "schemes": [ | |
| "http:\/\/www.23hq.com\/*\/photo\/*" | |
| ], | |
| "url": "http:\/\/www.23hq.com\/23\/oembed" |
To use it:
- Create file with .php extension anywhere in your project. E.g. "script.php".
- Change value form
$post_update_nameto post update name you would like to reset. - Run
drush scr path/to/script.phpwith relataive path to file where you create it. - Delete your file "script.php".