You are here

function hook_hosting_feature in Hosting 6.2

Same name and namespace in other branches
  1. 7.4 hosting.api.php \hook_hosting_feature()
  2. 7.3 hosting.api.php \hook_hosting_feature()

Register a hosting feature with Aegir.

The frontend provides a UI for enabling and disabling features, which usually corresponds to enabling and disabling a module providing the feature.

This hook can be implemented in a file named: hosting.feature.FEATURE_KEY.inc

Note that the module providing this hook does not need to be enabled for it to be called. The frontend will use details in this hook to enable a module if the feature is enabled.

Return value

An array of hosting features, keyed by the machine name of the feature. Inner arrays may contain the following keys:

  • 'title': The localised title of the feature.
  • 'description': The localised description of the feature.
  • 'status': The inital status of the feature, either HOSTING_FEATURE_DISABLED, HOSTING_FEATURE_ENABLED or HOSTING_FEATURE_REQUIRED.
  • 'module': A module to enable or disable whenever the feature is enabled or disabled.
  • 'node': A node type that is associated with this feature.
  • 'enable': A function name to call when this feature is enabled.
  • 'disable': A function name to call when this feature is disabled.
  • 'group': The group that this feature belongs to, should be either NULL or 'experimental' (or 'required' for core features).

See also

hosting_get_features()

Related topics

25 functions implement hook_hosting_feature()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

hosting_alias_hosting_feature in alias/hosting.feature.alias.inc
Implementation of hook_hosting_feature().
hosting_client_hosting_feature in client/hosting.feature.client.inc
Implementation of hook_hosting_feature().
hosting_clone_hosting_feature in clone/hosting.feature.clone.inc
Implementation of hook_hosting_feature().
hosting_cron_hosting_feature in cron/hosting.feature.cron.inc
Implementation of hook_hosting_feature().
hosting_db_server_hosting_feature in db_server/hosting.feature.db_server.inc
Implementation of hook_hosting_feature().

... See full list

File

./hosting.api.php, line 109
Hooks provided by the hosting module, and some other random ones.

Code

function hook_hosting_feature() {

  // From hosting_example_hosting_feature().
  $features['example'] = array(
    // title to display in form
    'title' => t('Example feature'),
    // description
    'description' => t('Example feature documenting how to create your own extensions.'),
    // initial status ( HOSTING_FEATURE_DISABLED, HOSTING_FEATURE_ENABLED, HOSTING_FEATURE_REQUIRED )
    'status' => HOSTING_FEATURE_DISABLED,
    // module to enable/disable alongside feature
    'module' => 'hosting_example',
    // Callback functions to execute on enabling or disabling this feature
    'enable' => 'hosting_example_feature_enable_callback',
    'disable' => 'hosting_example_feature_disable_callback',
    // associate with a specific node type.
    //  'node' => 'nodetype',
    // which group to display in ( null , experimental , required )
    'group' => 'experimental',
  );
  return $features;
}