You are here

function _localize_fields_list_files in Localize Fields 7

Finds names and paths (path/filename) of all relevant Features files in a directory, recursively.

Details:

  • skip .features.inc (content type file): Features automatically insert t()s directly around the sentences, and core translation works.
  • (.features)?.field_group.inc: Find label and description, and add them t()'d (without context) to bottom of file (not translated by FLF; core translation works).
  • .features.field_base.inc: Find list_ type options, and add them t()'d to bottom of file.
  • .features.field_instance.inc: Find number_ type prefix/suffix, and add them t()'d to bottom of file.

Parameters

array &$list:

string $dir:

integer $depth_max:

  • default: 5

integer $depth:

  • default: zero

Return value

void

1 call to _localize_fields_list_files()
drush_localize_fields in ./localize_fields.drush.inc

File

./localize_fields.drush.inc, line 634
Drupal Localize Fields module

Code

function _localize_fields_list_files(&$list, $dir, $depth_max = 5, $depth = 0) {
  if (++$depth > $depth_max) {
    return;
  }
  $le = count($sub_list = scandir($dir));
  for ($i = 0; $i < $le; $i++) {
    $item = $sub_list[$i];
    if ($item != '.' && $item != '..') {
      if (is_dir($dir . '/' . $item)) {
        _localize_fields_list_files($list, $dir . '/' . $item, $depth_max, $depth);
      }
      elseif (preg_match('/^.+\\.(features\\.field_base|features\\.field_instance|field_group|features\\.field_group)\\.inc$/', $item)) {
        $list[$item] = $dir . '/' . $item;
      }
    }
  }
}