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
/** | |
* Delete multiple nodes by ID. | |
*/ | |
function YOU_MODULE_NAME_update_8001() { | |
$nids = [8418,8419]; | |
/** @var \Drupal\node\NodeStorageInterface $storage */ | |
$node_storage = \Drupal::entityTypeManager()->getStorage('node'); | |
if ($nodes = $storage->loadMultiple($nids)) { | |
$node_storage->delete($nodes); |
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
use Drupal\Core\Database\Database; | |
/** | |
* Update tags url alias'. | |
*/ | |
function YOUR_MODULE_NAME_update_8001() { | |
// "path_alias" is the name of the table being updated (this comes from the pathauto module) | |
// "alias" is the name of the field/column being updated. | |
// So whats happening here is that, we're updating the alias field/column on the path_alias table. | |
// The update being done is we're replacing the value of "//tags" with "/news-and-events/topics/". |
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
use Drupal\views\ViewExecutable; | |
use Drupal\views\Views; | |
/** | |
* Implements hook_preprocess_HOOK(). | |
*/ | |
function YOUR_MODULE_NAME_preprocess_HOOK(&$variables) { | |
$some_entity_id = 10; | |
$view = Views::getView('name_of_view'); | |
if (is_object($view) && $most_linked_profiles_view instanceof ViewExecutable) { |
OlderNewer