You are here

public static function Check::isGroup in Hook Update Deploy Tools 7

A strict check for entity being a group. Fails update if !group.

Parameters

string $name: The name of a variable being checked for Group.

object $entity: The enitity object being checked.

Return value

bool TRUE if $value is a Group.

Throws

HudtException if it is not a group.

2 calls to Check::isGroup()
Groups::assignUsersToGroup in src/Groups.php
Add users to an Organic Group.
Groups::loadByName in src/Groups.php
Load a Group by name.

File

src/Check.php, line 125
File for methods related to strictly checking things.

Class

Check
Public methods for dealing with Checking things.

Namespace

HookUpdateDeployTools

Code

public static function isGroup($name, $entity) {
  Check::canUse('og');
  Check::canCall('og_is_group');
  if (og_is_group('node', $entity)) {
    $return = TRUE;
  }
  else {

    // This is strict, so make message and throw DrupalUpdateException.
    $message = 'The entity !name was not an Organic Group. Could not proceed.';
    $vars = array(
      '!name' => $entity,
    );
    throw new HudtException($message, $vars, WATCHDOG_ERROR, TRUE);
  }
  return $return;
}