Provide a hook that allows modules to declare Field Modules they provide.
This commit is contained in:
parent
a0ca94bd6e
commit
1102f26ae9
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Hooks provided by farm_client.
|
||||
*
|
||||
* This file contains no working PHP code; it exists to provide additional
|
||||
* documentation for doxygen as well as to document hooks in the standard
|
||||
* Drupal manner.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup farm_client Farm client module integrations.
|
||||
*
|
||||
* Module integrations with the farm_client module.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup farm_client_hooks Farm client's hooks
|
||||
* @{
|
||||
* Hooks that can be implemented by other modules in order to extend farm_client.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Provide information about client modules that this module provides.
|
||||
*
|
||||
* @return array
|
||||
* Returns an array of client module information.
|
||||
*/
|
||||
function hook_farm_client_modules() {
|
||||
return array(
|
||||
array(
|
||||
'name' => 'weather',
|
||||
'label' => t('Weather'),
|
||||
'js' => drupal_get_path('module', 'farm_weather') . '/src/FieldModule/Weather/weather.js',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
|
@ -19,3 +19,21 @@ function farm_client_farm_api_oauth2_client() {
|
|||
|
||||
return $clients;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_farm_info().
|
||||
*/
|
||||
function farm_client_farm_info() {
|
||||
|
||||
// Ask modules for client module info.
|
||||
$client_modules = module_invoke_all('farm_client_modules');
|
||||
|
||||
// Add the client module info to /farm.json.
|
||||
$info = array();
|
||||
if (!empty($client_modules)) {
|
||||
$info['client'] = array(
|
||||
'modules' => $client_modules,
|
||||
);
|
||||
}
|
||||
return $info;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue