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 translates a node programmatically. | |
* To translate a node programmatically the following properties need to be set: | |
* - tnid: the nid of node that is being translated. | |
* - translation_source: the node object that is being translated. | |
* | |
* The translation_source property makes sure that the source's tnid will get | |
* set to its own nid if not done already. | |
*/ |
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
gem install specific_install | |
gem specific_install git://github.com/Crosscheck/didi.git |
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 | |
if (module_exists('facetapi')) { | |
$searcher = 'search_api@default_node_index'; | |
$realm = 'block'; | |
$titles = array( | |
'type' => 'Filter on content', | |
); | |
// Change the titles of the corresponding blocks. |
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 | |
* Base Migrations for resource nodes. | |
*/ | |
class ImportResourceNodes extends ImportNodeAdvanced { | |
public function __construct() { |
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())); |
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 | |
$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 | |
$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 | |
$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
|