You are here

hosting_deploy.module in Aegir Deploy 7.3

Drupal hooks for the hosting_deploy module.

File

hosting_deploy.module
View source
<?php

/**
 * @file
 * Drupal hooks for the hosting_deploy module.
 */

/**
 * Implements hook_form_alter().
 */
function hosting_deploy_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'platform_node_form') {
    $platform_node_form = new HostingDeployForm($form, $form_state);
    $platform_node_form
      ->alter();
  }
}

/**
 * Implements hook_module_implements_alter().
 */
function hosting_deploy_module_implements_alter(&$implementations, $hook) {
  if ($hook == 'form_alter') {

    // Ensure that hosting_deploy_form_alter() runs last.
    $group = $implementations['hosting_deploy'];
    unset($implementations['hosting_deploy']);
    $implementations['hosting_deploy'] = $group;
  }
}

/**
 * Implements hook_node_view().
 */
function hosting_deploy_node_view($node, $view_mode, $langcode) {
  if ($node->type == 'platform') {
    $platform = new HostingDeployNode($node);
    $platform
      ->nodeView();
  }
}

/**
 * Implements hook_platform_deploy_strategies().
 */
function hosting_deploy_platform_deploy_strategies() {
  return [
    'none' => [
      'label' => t('Classic (managed by you on SSH command line or SFTP)'),
      'required_fields' => [],
    ],
  ];
}

/**
 * Implements hook_platform_deploy_strategies_alter().
 */
function hosting_deploy_platform_deploy_strategies_alter(&$strategies) {
  $strategies['frommakefile'] = [
    'label' => t('Deploy from Drush makefile'),
    'required_fields' => [
      'makefile',
    ],
  ];
  if (module_exists('hosting_git')) {
    $strategies['git'] = [
      'label' => t('Manage with Git'),
      'required_fields' => [
        'git_repo',
      ],
    ];
  }
}

/**
 * Callback to populate the list of valid options for deployment strategies.
 */
function hosting_deploy_get_strategies_options_list() {
  return HostingDeployForm::getStrategyLabels();
}

Functions

Namesort descending Description
hosting_deploy_form_alter Implements hook_form_alter().
hosting_deploy_get_strategies_options_list Callback to populate the list of valid options for deployment strategies.
hosting_deploy_module_implements_alter Implements hook_module_implements_alter().
hosting_deploy_node_view Implements hook_node_view().
hosting_deploy_platform_deploy_strategies Implements hook_platform_deploy_strategies().
hosting_deploy_platform_deploy_strategies_alter Implements hook_platform_deploy_strategies_alter().