You are here

function rdf_get_namespaces in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/rdf/rdf.module \rdf_get_namespaces()

Retrieves RDF namespaces.

Invokes hook_rdf_namespaces() and collects RDF namespaces from modules that implement it.

Related topics

4 calls to rdf_get_namespaces()
GetRdfNamespacesTest::testGetRdfNamespaces in core/modules/rdf/src/Tests/GetRdfNamespacesTest.php
Tests getting RDF namespaces.
rdf_preprocess_html in core/modules/rdf/rdf.module
Implements hook_preprocess_HOOK() for HTML document templates.
Rss::render in core/modules/node/src/Plugin/views/row/Rss.php
Render a row object. This usually passes through to a theme template of some form, but not always.
RssFields::render in core/modules/views/src/Plugin/views/row/RssFields.php
Render a row object. This usually passes through to a theme template of some form, but not always.
2 string references to 'rdf_get_namespaces'
Rss::render in core/modules/node/src/Plugin/views/row/Rss.php
Render a row object. This usually passes through to a theme template of some form, but not always.
RssFields::render in core/modules/views/src/Plugin/views/row/RssFields.php
Render a row object. This usually passes through to a theme template of some form, but not always.

File

core/modules/rdf/rdf.module, line 109
Enables semantically enriched output for Drupal sites in the form of RDFa.

Code

function rdf_get_namespaces() {
  $namespaces = array();

  // In order to resolve duplicate namespaces by using the earliest defined
  // namespace, do not use \Drupal::moduleHandler()->invokeAll().
  foreach (\Drupal::moduleHandler()
    ->getImplementations('rdf_namespaces') as $module) {
    $function = $module . '_rdf_namespaces';
    foreach ($function() as $prefix => $namespace) {
      if (array_key_exists($prefix, $namespaces) && $namespace !== $namespaces[$prefix]) {
        throw new Exception(t('Tried to map @prefix to @namespace, but @prefix is already mapped to @orig_namespace.', array(
          '@prefix' => $prefix,
          '@namespace' => $namespace,
          '@orig_namespace' => $namespaces[$prefix],
        )));
      }
      else {
        $namespaces[$prefix] = $namespace;
      }
    }
  }
  return $namespaces;
}