You are here

function loft_data_grids_exporter in Loft Data Grids 7

Same name and namespace in other branches
  1. 6.2 loft_data_grids.module \loft_data_grids_exporter()
  2. 7.2 loft_data_grids.module \loft_data_grids_exporter()

Instantiate a new ExportData object

This wrapper should be used for compatability issues with multiple library locations such as PHPExcel

Parameters

ExportDataInterface $data:

string $class: The name of any of the various Exporter classes

string $filename: (Optional) Defaults to ''.

Related topics

1 call to loft_data_grids_exporter()
loft_data_grids_export_info in ./loft_data_grids.module
Return info about the export formats available

File

./loft_data_grids.module, line 299
Base module file for loft_data_grids

Code

function loft_data_grids_exporter(ExportDataInterface $data, $class, $filename = '') {
  libraries_load('loft_data_grids');
  if (class_exists($class)) {
    $object = new $class($data, $filename);

    // Support for PHPExcel through the drupal module rather than
    // loft_data_grids vendor directory
    if (!$object->dependencies && $class === 'XLSXExporter' && module_exists('phpexcel')) {
      libraries_load('PHPExcel');
    }
    return $object;
  }
  return FALSE;
}