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

Fieldcheck #1

Merged
merged 3 commits into from
Jan 17, 2024
Merged

Fieldcheck #1

merged 3 commits into from
Jan 17, 2024

Conversation

kmurphychi247
Copy link
Collaborator

Add checks for if node and if field

@@ -13,8 +13,9 @@
function saplings_custom_preprocess_html(array &$variables) {
// Load the node entity from current route.
$node = \Drupal::routeMatch()->getParameter('node');
if ($node){

Choose a reason for hiding this comment

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

I would check for $node instanceof NodeInterface here because otherwise the hasField will also fail

Copy link
Contributor

Choose a reason for hiding this comment

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

if ($node instanceof NodeInterface) {

@kmurphychi247 kmurphychi247 merged commit 41776c6 into main Jan 17, 2024
@thejimbirch thejimbirch deleted the fieldcheck branch January 17, 2024 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants