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
/** | |
* 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 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) { |
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 will work for paragraphs or nodes. #} | |
element['#object'] |
OlderNewer