ProjectInfo::filterProjectInfo

ProjectInfo::filterProjectInfo($info, $additional_whitelist = array())

Filters the project .info.yml data to only save attributes we need.

Parameters

array $info: Array of .info.yml file data as returned by \Drupal\Core\Extension\InfoParser.

$additional_whitelist: (optional) Array of additional elements to be collected from the .info.yml file. Defaults to array().

Return value

Array of .info.yml file data we need for the update manager.

See also

\Drupal\Core\Utility\ProjectInfo::processInfoList()

File

core/lib/Drupal/Core/Utility/ProjectInfo.php, line 177

Class

ProjectInfo
Performs operations on drupal.org project data.

Namespace

Drupal\Core\Utility

Code

function filterProjectInfo($info, $additional_whitelist = array()) {
  $whitelist = array(
    '_info_file_ctime',
    'datestamp',
    'major',
    'name',
    'package',
    'project',
    'project status url',
    'version',
  );
  $whitelist = array_merge($whitelist, $additional_whitelist);
  return array_intersect_key($info, array_combine($whitelist, $whitelist));
}
doc_Drupal
2016-10-29 09:35:07
Comments
Leave a Comment

Please login to continue.