You are here

function _views_exclude_previous in Views exclude previous 8

Same name and namespace in other branches
  1. 7 views_exclude_previous.module \_views_exclude_previous()

This function stores/returns nids for the given category.

Static storage of our excluded nids.

Parameters

string $cat: A category given by the exclude plugin.

int $nid: The nid to be excluded. Optional so the function just returns the category.

Return value

array Always returns the given category.

4 calls to _views_exclude_previous()
ViewsExcludePreviousNodes::query in src/Plugin/views/filter/ViewsExcludePreviousNodes.php
Exclude all node's yet displayed.
views_exclude_previous_node_load in ./views_exclude_previous.module
Implements hook_node_load().
views_exclude_previous_node_view in ./views_exclude_previous.module
Implements hook_ENTITY_TYPE_view() for node entities.
views_exclude_previous_views_post_execute in ./views_exclude_previous.views.inc
Implements hook_views_post_execute().

File

./views_exclude_previous.module, line 53
Main file of the views exclude previous module.

Code

function _views_exclude_previous($cat, $nid = NULL) {
  $excludes =& drupal_static(__FUNCTION__);

  // Add nid to be excluded in the current category.
  if (!empty($nid)) {
    $excludes[$cat][$nid] = $nid;
  }
  return !empty($excludes[$cat]) ? $excludes[$cat] : [
    0,
  ];
}