You are here

function pmpapi_pull_pmpapi_profile_info_alter in Public Media Platform API Integration 7

Implements hook_pmpapi_profile_info_alter().

File

pmpapi_pull/pmpapi_pull.module, line 321
Allows admins to pull content from the PMP API, and turn PMP docs into (locally-stored, independent) drupal entities.

Code

function pmpapi_pull_pmpapi_profile_info_alter(&$info) {
  $profile_info = module_invoke_all('pmpapi_profile_info');
  $profiles = array_keys($profile_info);
  $items = array();
  foreach ($profiles as $profile) {
    $items['item-' . $profile] = array(
      'type' => 'item',
      'accepted_types' => array(
        'image',
        'file',
        'entityreference',
      ),
      'multiple' => TRUE,
    );
  }
  foreach ($info as $profile_name => $profile) {
    if (!empty($profile['item'])) {
      unset($info[$profile_name]['item']);
    }
    foreach ($items as $item_name => $item) {
      $info[$profile_name][$item_name] = $item;
    }
  }
}