Skip to content

Instantly share code, notes, and snippets.

View Niklan's full-sized avatar
🍵
Working from home

Nikita Malyshev Niklan

🍵
Working from home
View GitHub Profile
@Niklan
Niklan / readme.md
Created January 24, 2020 10:42
Rerun Drupal hook_post_update_NAME()

To use it:

  1. Create file with .php extension anywhere in your project. E.g. "script.php".
  2. Change value form $post_update_name to post update name you would like to reset.
  3. Run drush scr path/to/script.php with relataive path to file where you create it.
  4. Delete your file "script.php".
@Niklan
Niklan / README.md
Last active December 17, 2020 06:50
Drupal 8: Batched hook_post_update_NAME() and hook_update_N() example
@Niklan
Niklan / providers.json
Created September 12, 2018 14:09
Copy of https://oembed.com/providers.json which blocked in Russia. Used for mirroring.
[
{
"provider_name": "23HQ",
"provider_url": "http:\/\/www.23hq.com",
"endpoints": [
{
"schemes": [
"http:\/\/www.23hq.com\/*\/photo\/*"
],
"url": "http:\/\/www.23hq.com\/23\/oembed"
@Niklan
Niklan / MYMODULE-previous-next.html.twig
Last active August 8, 2022 12:58
Previous - next links for Drupal 8
{% 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>
@Niklan
Niklan / d8.php
Last active April 4, 2018 17:40
Drupal 8 detect if there entity on page
$parameters = \Drupal::routeMatch()->getParameters();
foreach ($parameters as $parameter) {
if ($parameter instanceof EntityInterface) {
// Entity page.
}
}