function rdf_get_namespaces

Same name in other branches
  1. 9 core/modules/rdf/rdf.module \rdf_get_namespaces()
  2. 8.9.x core/modules/rdf/rdf.module \rdf_get_namespaces()

Returns an array of RDF namespaces defined in modules that implement hook_rdf_namespaces().

Related topics

2 calls to rdf_get_namespaces()
drupal_get_rdf_namespaces in includes/common.inc
Returns a string containing RDF namespace declarations for use in XML and XHTML output.
RdfGetRdfNamespacesTestCase::testGetRdfNamespaces in modules/rdf/rdf.test
Test getting RDF namesapces.
1 string reference to 'rdf_get_namespaces'
drupal_get_rdf_namespaces in includes/common.inc
Returns a string containing RDF namespace declarations for use in XML and XHTML output.

File

modules/rdf/rdf.module, line 97

Code

function rdf_get_namespaces() {
    $rdf_namespaces = module_invoke_all('rdf_namespaces');
    // module_invoke_all() uses array_merge_recursive() which might return nested
    // arrays if several modules redefine the same prefix multiple times. We need
    // to ensure the array of namespaces is flat and only contains strings as
    // URIs.
    foreach ($rdf_namespaces as $prefix => $uri) {
        if (is_array($uri)) {
            if (count(array_unique($uri)) == 1) {
                // All namespaces declared for this prefix are the same, merge them all
                // into a single namespace.
                $rdf_namespaces[$prefix] = $uri[0];
            }
            else {
                // There are conflicting namespaces for this prefix, do not include
                // duplicates in order to avoid asserting any inaccurate RDF
                // statements.
                unset($rdf_namespaces[$prefix]);
            }
        }
    }
    return $rdf_namespaces;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.