You are here

public static function BookAccess::api in Book access 1.x

Verifies the current API version is included between two values passed as arguments.

Parameters

$minimum: The minimum API version required. If the parameter is not passed, the method will use the constant API_COMPATIBLE_VERSION.

$maximum: The maximum version required. This argument is optional; the current API will be checked against this value only if it is passed to the function.

Return value

TRUE, if the current API version is included between the passed values.

File

src/Access/BookAccess.php, line 138
Allows to set the access control for book nodes on a per book basis.

Class

BookAccess
@file

Namespace

Drupal\book_access\Access

Code

public static function api($minimum = NULL, $maximum = NULL) {
  if (!isset($minimum)) {
    $minimum = self::API_COMPATIBLE_VERSION;
  }
  if (version_compare(self::API_VERSION, $minimum, '<')) {
    return FALSE;
  }
  if (isset($maximum) && version_compare(self::API_VERSION, $maximum, '>')) {
    return FALSE;
  }
  return TRUE;
}