Skip to content

Fix warning when no widget pass#1733

Merged
obiPlabon merged 3 commits intoalphafrom
fix/widget-template
Apr 25, 2024
Merged

Fix warning when no widget pass#1733
obiPlabon merged 3 commits intoalphafrom
fix/widget-template

Conversation

@vairafiq
Copy link
Copy Markdown
Contributor

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Security fix
  • Improvement
  • New Feature
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Text changes
  • Other... Please describe:

Description

How to reproduce the issue or how to test the changes

Any linked issues

Fixes #

Checklist

@vairafiq vairafiq requested a review from obiPlabon April 23, 2024 06:17
Copy link
Copy Markdown
Contributor

@obiPlabon obiPlabon left a comment

Choose a reason for hiding this comment

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

Best practice: First handle the false cases.

public static function is_widget_template( $template ) {
	if ( empty( $template ) ) {
		return false;
	}

	return str_starts_with( $template, 'widgets/' );
}

Copy link
Copy Markdown
Contributor

@obiPlabon obiPlabon left a comment

Choose a reason for hiding this comment

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

Looks good

@obiPlabon obiPlabon merged commit db69a41 into alpha Apr 25, 2024
@obiPlabon obiPlabon deleted the fix/widget-template branch April 25, 2024 05:00
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.

2 participants