function _ctools_drush_export_info

Return array of CTools exportable info based on available tables returned from ctools_export_get_schemas().

Parameters

$table_names: Array of table names to return.

$load: (bool) should ctools exportable objects be loaded for each type. The default behaviour will load just a list of exportable names.

Return value

Nested arrays of available exportables, keyed by table name.

6 calls to _ctools_drush_export_info()
ctools_drush_export in drush/ctools.drush.inc
Drush callback: export.
ctools_drush_export_info in drush/ctools.drush.inc
Drush callback: Export info.
ctools_drush_export_op_command in drush/ctools.drush.inc
Drush callback: Acts as the hub for all op commands to keep all arg handling etc in one place.
_ctools_drush_export_op_command_logic in drush/ctools.drush.inc
Helper function to abstract logic for selecting exportable types/objects from individual commands as they will all share this same error handling/arguments for returning list of exportables.
_ctools_drush_get_export_name in drush/ctools.drush.inc
Gets the key for an exportable type.

... See full list

File

drush/ctools.drush.inc, line 610

Code

function _ctools_drush_export_info(array $table_names = array(), $load = FALSE) {
    ctools_include('export');
    // Get available schemas that declare exports.
    $schemas = ctools_export_get_schemas(TRUE);
    $exportables = array();
    if (!empty($schemas)) {
        // Remove types we don't want, if any.
        if (!empty($table_names)) {
            foreach (array_keys($schemas) as $table_name) {
                if (!in_array($table_name, $table_names)) {
                    unset($schemas[$table_name]);
                }
            }
        }
        // Load array of available exportables for each schema.
        foreach ($schemas as $table_name => $schema) {
            // Load all objects.
            if ($load) {
                $exportables[$table_name] = ctools_export_crud_load_all($table_name);
            }
            else {
                if (!empty($schema['export']['list callback']) && function_exists($schema['export']['list callback'])) {
                    $exportables[$table_name] = $schema['export']['list callback']();
                }
                else {
                    $exportables[$table_name] = ctools_export_default_list($table_name, $schema);
                }
            }
        }
    }
    if ($load) {
        $filter = drush_get_option('filter', FALSE);
        $exportables = _ctools_drush_filter_exportables($exportables, $filter);
    }
    return array(
        'exportables' => $exportables,
        'schemas' => $schemas,
    );
}