function 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));
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Utility!ProjectInfo.php/function/ProjectInfo::filterProjectInfo/8.1.x