summaryrefslogtreecommitdiffstats
path: root/ldt.hooks.php
blob: ee2762e2fbb456c16995035012812e107c52bdd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/**
 * @file
 * Hook definitions for Linked Data Tools
 *
 * @copyright Copyright(c) 2012 Christopher Skne
 * @license GPL v2 http://www.fsf.org/licensing/licenses/gpl.html
 * @author Chris Skene chris at xtfer dot com
 */

/**
 * Provide information about library plugins for working with Linked Data.
 *
 * Defines hook_ldt_library_wrapper().
 *
 * This hook only needs to be implemented by providers of linked data libraries
 * for use with LDT.
 *
 * @return array
 *   An array of library configurations. Each library should provide two
 *   keys:
 *    'name' - The human readable name of the library. May be wrapped in t() if
 *      appropriate.
 *    'class' - The class to load for working with data.
 */
function hook_ldt_library_wrappers() {
  $wrappers = array();

  $wrappers['easyrdf'] = array(
    'name' => 'EasyRdf',
    'class' => '\Drupal\ldt\Plugins\EasyRdf',
  );

  return $wrappers;
}

/**
 * Define data formats accepted by LDT.
 *
 * Linked Data comes in different formats. This function returns an array
 * of supported formats. Some formats may not be compatible with some plugins,
 * it is up to the implementer to know which, currently.
 *
 * Defines hook_ldt_data_formats().
 *
 * @return array
 *   An array of format definitions. Each definition includes:
 *    'name' - Human readable name.
 *    'accept' - an array of mime type accept headers to set for requests
 *    'uri' - a URI for the format definition
 *    'extensions' - an array of possible file extensiosn
 *   The 'uri' and 'extensions' keys are not used by the default EasyRDF plugin
 *   however it provides its own data here, and the information is provided for
 *   use by other plugins.
 */
function hook_ldt_data_formats() {
  $formats = array();

  $formats['rdf+xml'] = array(
    'name' => 'RDF/XML',
    'accept' => 'application/rdf+xml',
  );

  return $formats;
}