Skip to content

Instantly share code, notes, and snippets.

@edutrul
Last active November 21, 2016 19:04
Show Gist options
  • Save edutrul/36abd6b71bbe662e279ba04c4b639807 to your computer and use it in GitHub Desktop.
Save edutrul/36abd6b71bbe662e279ba04c4b639807 to your computer and use it in GitHub Desktop.
<?php
//https://api.drupal.org/api/views/views.api.php/function/hook_views_pre_view/7.x-3.x
/**
* Implements hook_views_pre_view().
*/
function dies_service_views_pre_view(ViewExecutable $view, $display_id, array &$args) {
// The term name cannot be extracted and assigned to the view as a
// contextual filter using page_manager currently. Instead, we
// pass keyword argument here.
if ($view->id() === 'name_of_view' && $display_id === 'view_display_name') {
//$nid = \Drupal::request()->attributes->get('nid');
// @TODO: 1) Como obtener el nodo ID de la pagina actual $nid = function_obtener_nodoId_actual();
//$args[0] = $nid;
$args[0] = 39;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment