You are here

public function Collection::getObjectById in Openlayers 7.3

Return an object given an ID.

Parameters

string|array $type: The type of object to get.

string $id: The id of the object to get.

Return value

false|\Drupal\openlayers\Types\ObjectInterface If found, returns the object. False otherwise.

File

src/Types/Collection.php, line 225
Class Collection.

Class

Collection
Class Collection.

Namespace

Drupal\openlayers\Types

Code

public function getObjectById($type = array(), $id) {
  foreach ($this
    ->getFlatList((array) $type) as $object) {
    if ($id === $object
      ->getMachineName()) {
      return $object;
    }
  }
  return FALSE;
}