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
|
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
import * as Yup from 'yup'; | |
import type { MyType } from 'my-types-package'; | |
import { MyOtherSchema } from 'kotk-vdb'; | |
export const MySchema = ( | |
otherData: MyType, | |
otherValidatorFn: (value: string, dataId: string) => Promise<boolean> | |
) => { | |
return { | |
simpleSelect: Yup.string() |
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
/** | |
* Add the entity_type field_name field. | |
*/ | |
function module_name_update_9001() { | |
$type_manager = \Drupal::entityTypeManager(); | |
$type_manager->clearCachedDefinitions(); | |
$entity_type = $type_manager->getDefinition('entity_type'); | |
$storage_definition = EntityTypeClass::baseFieldDefinitions($entity_type); | |
\Drupal::entityDefinitionUpdateManager()->installFieldStorageDefinition( |
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
import Router from "next/router"; | |
export const functionName = () => { | |
console.log(Router.basePath); | |
}; |
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
|
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 | |
$uri = 'public://path/to/file.txt'; | |
/** @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface $stream_wrapper_manager */ | |
$stream_wrapper_manager = \Drupal::service('stream_wrapper_manager'); | |
$scheme = $stream_wrapper_manager->getScheme($uri); | |
// $scheme = 'public'; |
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 | |
$uri = 'public://path/to/file.txt'; | |
/** @var \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface $stream_wrapper_manager */ | |
$stream_wrapper_manager = \Drupal::service('stream_wrapper_manager'); | |
$target = $stream_wrapper_manager->getTarget($uri); | |
// $target = 'path/to/file.txt'; |
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 | |
$external_file = 'https://www.example.com/test.png' | |
$destination = 'public://file.png'; | |
$response = \Drupal::httpClient()->get($external_file, ['sink' => $destination]); |
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 | |
* Default page manager content. | |
*/ | |
/** | |
* Implements hook_default_page_manager_handlers(). | |
*/ |
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 | |
/** | |
* Implements hook_addthis_markup_alter(). | |
* | |
* Fix addthis bug where services aren't added. | |
*/ | |
function your_module_addthis_markup_alter(&$markup) { | |
if (isset($markup['#display']['type']) && $markup['#display']['type'] == 'addthis_basic_toolbox') { | |
$addthis_services = array_filter(variable_get('addthis_enabled_services', array())); |
NewerOlder