You are here

function filefield_paths_load in File (Field) Paths 6

Return the required path settings for the named filefield instance.

A CRUD utility for filefield_paths

Parameters

a unique identifier for the given field instance - {$type-$field}: This identifier pattern is the same that features.content.inc uses

Return value

a row array from the filefield_paths DB table - with the 'serialized' blobs unpacked.

4 calls to filefield_paths_load()
filefield_paths_features_export in modules/features.inc
Implements hook_features_export().
filefield_paths_features_export_render in modules/features.inc
Implements hook_features_export_render()
filefield_paths_features_pipe_content_alter in modules/features.inc
Attach our own export routine as a piped export that happens below any cck filefield path that is getting exported.
filefield_paths_features_rebuild in modules/features.inc
Create/recreate the items based on the data array. Data should contain a number of filefield_paths definitions.

File

modules/features.inc, line 124
Features module integration.

Code

function filefield_paths_load($identifier) {
  list($type_name, $field_name) = explode('-', $identifier);
  $row = db_fetch_array(db_query("SELECT * FROM {filefield_paths} WHERE type = '%s' AND field = '%s'", $type_name, $field_name));
  if (!empty($row)) {
    $ffp = array();

    // Each cell in the row gets exposed, retrieve the schema to figure this out.
    $schema = drupal_get_schema('filefield_paths');
    foreach ($schema['fields'] as $field => $field_def) {
      $ffp[$field] = empty($field_def['serialize']) ? $row[$field] : unserialize($row[$field]);
    }
    return $ffp;
  }
  return NULL;
}