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
name: Example | |
description: 'Example theme' | |
base theme: false | |
type: theme | |
package: example | |
core_version_requirement: ^10 | |
ckeditor_stylesheets: | |
- //fonts.googleapis.com/css2?family=Public+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap |
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
services: | |
asset.css.collection_optimizer: | |
class: Drupal\Core\Asset\CssCollectionOptimizer | |
arguments: [ '@asset.css.collection_grouper', '@asset.css.optimizer', '@asset.css.dumper', '@state', '@file_system' ] | |
asset.js.collection_optimizer: | |
class: Drupal\Core\Asset\JsCollectionOptimizer | |
arguments: [ '@asset.js.collection_grouper', '@asset.js.optimizer', '@asset.js.dumper', '@state', '@file_system'] | |
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
/** | |
* Implements hook_form_BASE_FORM_ID_alter(). | |
*/ | |
function example_form_webform_ui_element_form_alter(&$form, FormStateInterface $form_state, $form_id) { | |
if ($form["properties"]["type"]["#value"] == 'example_element') { | |
$form["token_tree_link"]["token_tree_link"]["#token_types"][] = 'node'; | |
$form["token_tree_link"]["token_tree_link"]["#recursion_limit"] = 4; | |
} | |
} |
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
/** | |
* Implements hook_preprocess_HOOK(). | |
* | |
* HOOK: 'form_element' | |
*/ | |
function example_preprocess_form_element(&$variables) { | |
if (isset($variables['element']['#element_title'])) { | |
$variables['label']['#title'] = $variables['element']['#element_title']; | |
} | |
} |
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
<?php | |
namespace Drupal\example\Plugin\Condition; | |
use Drupal\Core\Condition\ConditionPluginBase; | |
use Drupal\Core\Form\FormStateInterface; | |
use Drupal\Core\Http\RequestStack; | |
use Drupal\Core\Plugin\ContainerFactoryPluginInterface; | |
use Symfony\Component\DependencyInjection\ContainerInterface; |
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
(?:youtube(?:-nocookie)?\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)|(?:shorts)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11}) |
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 (PHP_SAPI !== 'cli' && $_SERVER['HTTP_X_FORWARDED_PORT'] == 443) { | |
$GLOBALS['request']->headers->set('X_FORWARDED_PROTO', 'https'); | |
} |
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
<?php | |
/** | |
* Implements hook_ENTITY_TYPE_presave(). | |
*/ | |
function example_media_presave(EntityInterface $entity) { | |
if ($entity->bundle() == 'resource') { | |
if (!$entity->get('field_thumbnail')->isEmpty()) { | |
$file = $entity->field_thumbnail->entity; | |
$entity->set('thumbnail', $file); |
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
<?php | |
/** | |
* Implements hook_theme_suggestions_HOOK_alter(). | |
*/ | |
function example_theme_suggestions_file_link_alter(array &$suggestions, array $variables) { | |
/** @var \Drupal\file\Entity\File $file */ | |
$file = $variables['file']; | |
try { |
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
<?php | |
namespace Drupal\example\Plugin\Condition; | |
use Drupal\Core\Condition\ConditionPluginBase; | |
use Drupal\Core\Entity\EntityTypeManagerInterface; | |
use Drupal\Core\Plugin\ContainerFactoryPluginInterface; | |
use Drupal\ctools\ConstraintConditionInterface; | |
use Symfony\Component\DependencyInjection\ContainerInterface; |
NewerOlder