|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Contains islandora.module.
|
|
|
|
*
|
|
|
|
* This file is part of the Islandora Project.
|
|
|
|
*
|
|
|
|
* (c) Islandora Foundation
|
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*
|
|
|
|
* @author Diego Pino Navarro <dpino@metro.org> https://github.com/diegopino
|
|
|
|
*/
|
|
|
|
|
|
|
|
use Drupal\Core\Routing\RouteMatchInterface;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements hook_help().
|
|
|
|
*/
|
|
|
|
function islandora_help($route_name, RouteMatchInterface $route_match) {
|
|
|
|
switch ($route_name) {
|
|
|
|
// Main module help for the islandora module.
|
|
|
|
case 'help.page.islandora':
|
|
|
|
$output = '';
|
|
|
|
$output .= '<h3>' . t('About') . '</h3>';
|
|
|
|
$output .= '<p>' . t('') . '</p>';
|
|
|
|
return $output;
|
|
|
|
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements hook_theme().
|
|
|
|
*/
|
|
|
|
function islandora_theme() {
|
|
|
|
$theme = [];
|
|
|
|
$theme['fedora_resource'] = [
|
|
|
|
'render element' => 'elements',
|
|
|
|
'file' => 'fedora_resource.page.inc',
|
|
|
|
'template' => 'fedora_resource',
|
|
|
|
];
|
|
|
|
$theme['fedora_resource_content_add_list'] = [
|
|
|
|
'render element' => 'content',
|
|
|
|
'variables' => ['content' => NULL],
|
|
|
|
'file' => 'fedora_resource.page.inc',
|
|
|
|
];
|
|
|
|
return $theme;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements hook_theme_suggestions_HOOK().
|
|
|
|
*/
|
|
|
|
function islandora_theme_suggestions_fedora_resource(array $variables) {
|
|
|
|
$suggestions = array();
|
|
|
|
$entity = $variables['elements']['#fedora_resource'];
|
|
|
|
$sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_');
|
|
|
|
|
|
|
|
$suggestions[] = 'fedora_resource__' . $sanitized_view_mode;
|
|
|
|
$suggestions[] = 'fedora_resource__' . $entity->bundle();
|
|
|
|
$suggestions[] = 'fedora_resource__' . $entity->bundle() . '__' . $sanitized_view_mode;
|
|
|
|
$suggestions[] = 'fedora_resource__' . $entity->id();
|
|
|
|
$suggestions[] = 'fedora_resource__' . $entity->id() . '__' . $sanitized_view_mode;
|
|
|
|
return $suggestions;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements hook_rdf_namespaces().
|
|
|
|
*/
|
|
|
|
function islandora_rdf_namespaces() {
|
|
|
|
// Yes, it's amazing, rdf is not registered by default!
|
|
|
|
return array(
|
|
|
|
'ldp' => 'http://www.w3.org/ns/ldp#',
|
|
|
|
'dc11' => 'http://purl.org/dc/elements/1.1/',
|
|
|
|
'nfo' => 'http://www.semanticdesktop.org/ontologies/2007/03/22/nfo/v1.1/',
|
|
|
|
'ebucore' => 'http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#',
|
|
|
|
'fedora' => 'http://fedora.info/definitions/v4/repository#',
|
|
|
|
'owl' => 'http://www.w3.org/2002/07/owl#',
|
|
|
|
'ore' => 'http://www.openarchives.org/ore/terms/',
|
|
|
|
'rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
|
|
|
|
);
|
|
|
|
}
|