function ProjectInfo::filterProjectInfo

Same name in other branches
  1. 9 core/lib/Drupal/Core/Utility/ProjectInfo.php \Drupal\Core\Utility\ProjectInfo::filterProjectInfo()
  2. 10 core/lib/Drupal/Core/Utility/ProjectInfo.php \Drupal\Core\Utility\ProjectInfo::filterProjectInfo()
  3. 11.x core/lib/Drupal/Core/Utility/ProjectInfo.php \Drupal\Core\Utility\ProjectInfo::filterProjectInfo()

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_elements: (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()

1 call to ProjectInfo::filterProjectInfo()
ProjectInfo::processInfoList in core/lib/Drupal/Core/Utility/ProjectInfo.php
Populates an array of project data.

File

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

Class

ProjectInfo
Performs operations on drupal.org project data.

Namespace

Drupal\Core\Utility

Code

public function filterProjectInfo($info, $additional_elements = []) {
    $elements = [
        '_info_file_ctime',
        'datestamp',
        'major',
        'name',
        'package',
        'project',
        'project status url',
        'version',
    ];
    $elements = array_merge($elements, $additional_elements);
    return array_intersect_key($info, array_combine($elements, $elements));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.