You are here

public static function EntityHelper::queryIdByLabel in Helper 7

Fetch an entity ID that have a certain label.

Parameters

string $entity_type: The entity type of $entity.

string $label: The label of the entity to load.

string $bundle: An optional bundle to restrict the results to.

object $query: An optional EntityFieldQuery object to use to perform the query.

Return value

int|bool An entity ID if a match was found, or FALSE otherwise.

Throws

Exception

File

lib/EntityHelper.php, line 112

Class

EntityHelper

Code

public static function queryIdByLabel($entity_type, $label, $bundle = NULL, $query = NULL) {
  $ids = static::queryIdsByLabel($entity_type, $label, $bundle, $query);
  return reset($ids);
}