You are here

function entity_background_find_background_plugin in Entity background 7

Find out if the plugin for the specified entity exists and return it.

Parameters

$entity_type: An entity type which background should be loaded.

$entity: An entity object which background should be loaded.

Return value

array|boolean An array of information arrays about the plugin received or FALSE if plugin with such name doesn't exist.

1 call to entity_background_find_background_plugin()
entity_background_get_background_plugin_function in ./entity_background.module
Get the specified background plugin function if it exist.

File

./entity_background.module, line 122
Module file entity background.

Code

function entity_background_find_background_plugin($entity_type, $entity) {
  $plugin = FALSE;

  // Get selection value.
  $wrapper = entity_metadata_wrapper($entity_type, $entity);
  $selection = $wrapper->eb_background->eb_selection
    ->value();

  // Continue only if the selection has a value.
  if (!empty($selection)) {
    $plugin_name = entity_background_get_plugin_from_group_name($selection);

    // Get plugin and handler function name.
    $plugin = entity_background_get_background_plugin($plugin_name);
  }
  return $plugin;
}