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

Empty headings throw error : Undefined property: stdClass::$content #12

Open
kristiana-s opened this issue Feb 29, 2024 · 0 comments
Open
Assignees

Comments

@kristiana-s
Copy link
Contributor

kristiana-s commented Feb 29, 2024

Hi,
Spotted an issue where an empty heading node would throw an error for no content. This was for entries with linked content , and the content had empty headings.
Undefined property: stdClass::$content

fix was to add an extra check on line 22 of src/Nodes/Heading.php to check that content node exists

if (property_exists($node, 'content') && property_exists($node->content[0], 'text') && !is_null($node->content[0]->text)) {
     $HTMLAttributes['id'] = Str::slug($node->content[0]->text);
}

Happy to create a PR if needed, Thanks for this addon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants