You are here

function hosting_get_profiles in Hosting 6.2

Same name and namespace in other branches
  1. 5 package/hosting_package.module \hosting_get_profiles()
  2. 7.4 package/hosting_package.module \hosting_get_profiles()
  3. 7.3 package/hosting_package.module \hosting_get_profiles()
4 calls to hosting_get_profiles()
hosting_platform_load in platform/hosting_platform.module
Implementation of hook_load().
hosting_settings in ./hosting.module
General settings form.
hosting_site_available_options in site/hosting_site.form.inc
Pass in a site node and return an array of valid options for it's fields.
hosting_site_form in site/hosting_site.form.inc
Implements hook_form().

File

package/hosting_package.module, line 76

Code

function hosting_get_profiles($platform = NULL, $field = 'title') {
  $profiles = array();
  if (!is_null($platform)) {
    $instances = hosting_package_instances_load(array(
      'i.rid' => $platform,
      'p.package_type' => 'profile',
      'n.status' => 1,
    ));
    foreach ($instances as $iid => $instance) {
      $profiles[$instance->package_id] = $instance->{$field};
    }
  }
  else {
    $instances = hosting_package_instances_load(array(
      'p.package_type' => 'profile',
      'n.status' => 1,
      'r.type' => 'platform',
    ));
    foreach ($instances as $iid => $instance) {
      $profiles[$instance->package_id] = $instance->{$field};
    }
  }
  return $profiles;
}