I find that when I click on 'Add Template' on the wysiwyg template's config screen Administer > Configuration > Content Authoring > WYSIWYG templates, I get the following PHP error:
TypeError: Return value of Drupal\wysiwyg_template\Entity\Template::getDescription() must be of the type string, null returned in Drupal\wysiwyg_template\Entity\Template->getDescription() (line 88 of C:\Users\Rory Downes\projects\action\web\modules\contrib\wysiwyg_template\src\Entity\Template.php)

My environment is:
PC Laptop Windows 10
XAMPP 3.2.4
PHP 7.3.9
Drupal 8.7.8

I wonder why this method is called when adding a new template!

Comments

Rory Downes created an issue. See original summary.

rory downes’s picture

StatusFileSize
new912 bytes

I managed to make my installation work by the attached patch, changing the definition of the getDescription method to not be type specific in both the Template.php and the TemplateInterface.php files. I am sure that this is not the final solution though and I wonder why this method is being called when creating a new template!

jurgenhaas’s picture

Oh, that's interesting in a case where an entity gets initialized. However, we should keep the return type hints and I suggest you give this code snippet a try:

  public function getDescription(): string {
    return $this->description ?: '';
  }

Let me know if that works for you.

rory downes’s picture

StatusFileSize
new399 bytes

Good thinking. That works. I attach a new patch.

  • jurgenhaas committed 3bc3b09 on 8.x-2.x
    Issue #3099306 by Rory Downes, jurgenhaas: Can not add a new template
    
jurgenhaas’s picture

Status: Active » Fixed

Thanks for your feedback @Rory Downes, I've published new release 2.3

rory downes’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.