You are here

function hook_hosting_feature in Hosting 7.3

Same name and namespace in other branches
  1. 6.2 hosting.api.php \hook_hosting_feature()
  2. 7.4 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

array 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

26 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
Implements hook_hosting_feature().
hosting_client_hosting_feature in client/hosting.feature.client.inc
Implements hook_hosting_feature().
hosting_clone_hosting_feature in clone/hosting.feature.clone.inc
Implements hook_hosting_feature().
hosting_cron_hosting_feature in cron/hosting.feature.cron.inc
Implements hook_hosting_feature().
hosting_db_server_hosting_feature in db_server/hosting.feature.db_server.inc
Implements hook_hosting_feature().

... See full list

File

./hosting.api.php, line 110
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;
}