Sources and collectionseasy_svg_pro_parse_manifest

easy_svg_pro_parse_manifest

Filters a source folder's manifest.json after it is parsed and validated, before the folder is scanned.

Filter · Easy SVG Pro · Status: Internal · Defined in includes/sources/sources.php

Internal: not part of the promised public surface. It may change without notice.

Usage

apply_filters( 'easy_svg_pro_parse_manifest', array $manifest, string $dir )

Example

add_filter( 'easy_svg_pro_parse_manifest', function ( $manifest, $dir ) {
	if ( null === $manifest['license'] ) {
		$manifest['license'] = 'CC0-1.0';
	}
	return $manifest;
}, 10, 2 );

Description

Fires only for folders that have a valid manifest; a broken or too new manifest fails before this point. You get the canonical shape, so you can rename icons, add keywords or set license, author and source. The result feeds the folder scan, which is cached in a transient keyed by the folder signature, so a change to your callback shows after the folder changes or the transient expires.

Parameters

body
$manifestarray

The validated manifest: ok, slug, label, icons (list of file, name, label, keywords), license, author, source, error.

body
$dirstring

The folder the manifest.json was read from.

Return value

returnarray

The manifest the folder scan uses.

Default: The output of validate_manifest()

Keep the shape intact: a missing key or a wrong type breaks the scan of that folder.