You are here

function hosting_platform_composer_git_hosting_platform_context_options in Aegir Deploy 7.3

Implements hook_hosting_TASK_OBJECT_context_options().

File

modules/platform_composer_git/hosting_platform_composer_git.drush.inc, line 10
Provision hooks to store data in the platform context/alias.

Code

function hosting_platform_composer_git_hosting_platform_context_options(&$task) {
  if ($task->ref->type == 'platform') {
    foreach ([
      'composer_git_path',
      'composer_git_project_url',
      'composer_git_version',
    ] as $option) {
      $field = 'field_' . $option;
      if (isset($task->ref->{$field}) && !empty($task->ref->{$field})) {
        $task->context_options[$option] = $task->ref->{$field}[$task->ref->language][0]['value'];
      }
      if ($option == 'composer_git_version' && empty($task->context_options[$option])) {
        $task->context_options[$option] = 'master';
      }
    }
  }
}