🤷♂️
This file contains 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
details { | |
border: 0; | |
summary { | |
position: relative; | |
cursor: pointer; | |
padding: 0; | |
} | |
summary > * { |
This file contains 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
<?php | |
// drush updb ; trigger expection so the update don't pass. | |
// drush cim ; import your new field. | |
// drush updb ; the hook update is successfull and values are copied. | |
/** | |
* Populate formatted texts from previous field on paragraph callout. | |
*/ | |
function mymodule_update_10103(&$sandbox): void { |
This file contains 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
<?php | |
$entity_type = 'node'; | |
$group_name = 'the_group_id'; | |
$context = 'form'; | |
$form_displays = \Drupal::entityTypeManager() | |
->getStorage('entity_form_display') | |
->loadByProperties(['targetEntityType' => 'node']); | |
foreach ($form_displays as $display) { |
This file contains 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
// Format/fix uncommitted files | |
"scripts": { | |
"codefix": "for F in $(git diff --name-only); do vendor/bin/phpcbf \"$F\"; done", | |
} | |
// ... |
This file contains 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
<?php | |
namespace Drupal\mymodule\Form; | |
use Drupal\Core\Form\FormBase; | |
use Drupal\Core\Form\FormStateInterface; | |
/** | |
* Provides a custom form. | |
*/ |
This file contains 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
<?php | |
/** | |
* Get the value out of a view Result for a given date field. | |
* | |
* @param \Drupal\views\ResultRow $result | |
* A given view result. | |
* @param \Drupal\views\Plugin\views\field\EntityField $field | |
* A given date field. | |
* |
This file contains 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
<?php | |
// Custom view page title | |
// @see https://www.drupal.org/node/2067859#comment-14675179 | |
/** | |
* Implements hook_views_post_render(). | |
*/ | |
function mymodule_views_post_render(Drupal\views\ViewExecutable $view) { | |
if ($view->element['#view_id'] == 'id_of_view') { |
This file contains 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
<?php | |
/** | |
* @file | |
* Contains a custom function to get the title from a Url. | |
*/ | |
use Drupal\Core\Url; | |
use Symfony\Component\HttpFoundation\Request; |
This file contains 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
/// Make element fully-clickable. | |
/// @author Matthieu Scarset | |
/// @param string $element | |
/// (optional) The button element which should get the click. Default: 'a'. | |
/// @param string $wrapper | |
/// (optional) The element's HTML wrapper(s), useful if convoluted markup. Default: empty string. | |
/// @link https://gist.github.com/MatthieuScarset/397da3b000ce6d9523dd50f525eabaf0 | |
/// | |
/// @example Simple card div with the link directly inside. | |
/// <div class="fullclick"> |
This file contains 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
/** | |
* @file | |
* Tooltip plugin. | |
*/ | |
(function (Drupal, CKEDITOR) { | |
CKEDITOR.plugins.add('tooltip', { | |
icons: 'tooltip', | |
init: function (editor) { | |
// Stop now if not allowed to use editor. |
NewerOlder