Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add_core_asset(): $in_footer should default to array #12

Merged
merged 1 commit into from May 27, 2020

Conversation

montchr
Copy link
Contributor

@montchr montchr commented May 27, 2020

I have a unit test in my theme which is failing because of an unexpected type:

in_array() expects parameter 2 to be array, bool given
/var/www/coolwebsite/wp-content/plugins/wp-asset-manager/php/class-asset-manager.php:437

It looks like $in_footer should default to an empty array.


Caused by the following:

I'm registering a style with wp_register_style() in my theme:

	wp_register_style(
		'coolwebsite-google-fonts',
		'https://fonts.googleapis.com/css?family=Lora:400,400i,700,700i|Roboto+Condensed:400,700',
		[],
		'1.0'
	);

and specifying it as a dependency of another style which I'm loading with Asset Manager:

	$styles = [
		[
			'condition'   => 'global',
			'deps'        => [ 'coolwebsite-google-fonts' ],
			'handle'      => 'coolwebsite-global-css',
			'load_hook'   => 'wp_head',
			'load_method' => 'sync',
			'src'         => '/path/to/src.css',
			'version'     => '1.0',
		],
	];
	array_map( [ \Asset_Manager_Styles::instance(), 'add_asset' ], $styles );

Copy link
Member

@dlh01 dlh01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🌳

@dlh01 dlh01 merged commit d86b5f3 into production May 27, 2020
@montchr montchr deleted the hotfix/add-core-asset-in-footer-default-type branch May 27, 2020 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants