You are here

function farm_import_farm_ui_actions in farmOS 7

Implements hook_farm_ui_actions().

File

modules/farm/farm_import/farm_import.module, line 61
Farm import module.

Code

function farm_import_farm_ui_actions() {
  $actions = array();

  // Load entity UI information.
  $ui_info = farm_ui_entities();

  // Add action links to asset and log importers on listing pages.
  $types = array(
    'farm_asset',
    'log',
  );
  foreach ($types as $type) {
    if (!empty($ui_info[$type])) {
      foreach ($ui_info[$type] as $bundle => $info) {
        if (!empty($info['view'])) {
          $actions[$bundle . '_import'] = array(
            'title' => t('Import') . ' ' . strtolower($info['label_plural']),
            'href' => 'import/' . $type . '_' . $bundle,
            'views' => array(
              $info['view'],
            ),
            'weight' => 100,
          );
        }
      }
    }
  }
  return $actions;
}