1

When I try to make a new Basic Page, I get the error below:

Recoverable fatal error: Object of class Drupal\node\Entity\NodeType could not be converted to string in Drupal\Component\Utility\Html::getClass() (line 72 of core/lib/Drupal/Component/Utility/Html.php).

I am currently on 8.3.7, but I get the same error when upgrading to 8.4.2 as well. This happens for creating all content types. Has anyone else come across this? I am a little worried since it is a core issue, but I assume it is some kind of configuration issues. Any help is greatly appreciated.

  • 1
    Someone's passing $node_type instead of $node_type->id(). Look for calls to Html::getClass in custom code and you'll probably find it – Clive Dec 2 '17 at 0:39
  • ... if not, then enable full error messages with backtrace and you'll see. – 4k4 Dec 2 '17 at 9:09
  • No calls to Html::getClass in custom code at all. The template being rendered is core/themes/classy/templates/layout/html.html.twig. So it doesn't seem to be my code, but then again, it has to be lol. – Matthew Downie Dec 3 '17 at 5:43
  • Look also for the Twig filter |clean_class, this is an alias for the php method. Do you have an error message with a backtrace? This should show you what to look for. – 4k4 Dec 3 '17 at 16:08
  • Ya looks like that is all over. I will look into it deeper. Thanks, I really appreciate it. – Matthew Downie Dec 4 '17 at 21:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.