You are here

function openlayers_content_types_openlayers_content_type_admin_info in Openlayers 7.3

Returns the administrative info for a map.

File

modules/openlayers_content_types/plugins/content_types/openlayers.inc, line 74

Code

function openlayers_content_types_openlayers_content_type_admin_info($subtype, $conf, $contexts) {
  $map_name = t('Unknown');
  try {

    /** @var Drupal\openlayers\Types\MapInterface $map */
    if (($map = \Drupal\openlayers\Openlayers::load('Map', $conf['map'])) == TRUE) {
      $map_name = $map
        ->getName();
    }
  } catch (Exception $e) {

    // Avoids that this takes down the whole page because of a failing map.
  }
  $block = new stdClass();
  $block->title = t('Map: %map', array(
    '%map' => $map_name,
  ));
  $block->content = '';
  return $block;
}