Account created on 25 October 2008, almost 16 years ago
#

Recent comments

🇫🇷France jabberwooki

@linhnm In order to fix the same error, obtained in same condition as you (core update from 10.2.6 to 10.3.1) :
- I first added patch #47 AND patch #48 declarations into my composer.json file.
- Then I launched composer install.
As a result, I noticed that patch #48 could not apply and the mapping definition bug (WSOD) still occurred.

So, I did the following :
- I came back to my original /config/schema/ckeditor5_font.schema.yml version.
- I removed the #48 patch declaration from the composer.json file.
- I launched composer install again.
Using this second procedure, the bug disappeared and I could edit nodes containing ckeditor fields again.

I don't clearly understand what #48 patch does (I'm far from being a patching guru). I just can tell that it can't be applied in my environment. I suppose that lines 3 et 4 correspond to a target file renaming (from ckeditor5.schema.yml to ckeditor5_font.schema.yml) but the error message I got (in /var/log/apache2/mysite_error.log says the ckeditor5_font.schema.yml file cannot be found.
Hope this helps.

🇫🇷France jabberwooki

Thank you @mably.

I updated my site from 10.1.6 to 10.2.2 (for security updates) and I installed the module's dev branch using Composer :
composer require 'drupal/ckeditor5_font:1.x-dev@dev'

Then, I modified the composer.json file as follows :

    "extra": {

        [...]
        
        "enable-patching": true,
        "patches": {
            "drupal/ckeditor5_font": {
                "'no config schema' Error": "https://www.drupal.org/files/issues/2024-01-11/ckeditor5_font-schema-fix-10.2.1-3368736-37.patch"
            }
        }
    }

and ran :
composer install

After enabling module
drush en ckeditor5_font
and adding Color button and Background button to the CKEditor toolbar for the Full HTML text format (/admin/config/content/formats/manage/full_html), I could get theses buttons working as expected in the rich text editor.

🇫🇷France jabberwooki

Thanks a lot @mmjvb.
Separating requirement and update works perfectly.

🇫🇷France jabberwooki

I got this error too when I tried to set up a computed field programmatically (no use of the Compute Field contrib module) in one of my content types.

Here is a simplified way to reproduce the fatal error in a similar context.
You'll just have to create a very simple custom computed field for the Basic page content type.
You can use any of your custom modules or create one for testing purpose.

1- Custom computed field declaration in the .module file

function my_custom_module_entity_bundle_field_info(EntityTypeInterface $entity_type, $bundle, array $base_field_definitions) {
  $fields = [];
  if ($entity_type->id() == 'node') {
    if ($bundle == 'page') {
      $fields['resources'] = BaseFieldDefinition::create('link')
        ->setLabel(t('Resources'))
        ->setComputed(TRUE)
        ->setClass('\Drupal\my_custom_module\ResourcesLinksComputed')
        ->setDisplayConfigurable('view', TRUE)
        ->setReadOnly(true);
    }
  }
  return $fields;
}

2- Creation of the custom class to handle the field value calculation
In the file web/modules/custom/my_custom_module/src/ResourcesLinksComputed.php, add the following lines :

class ResourcesLinksComputed extends EntityReferenceFieldItemList
{
  use ComputedItemListTrait;

  protected function computeValue() {
    $entity = $this->getEntity();

    if ($entity->isNew()) {
      return;
    }

      $link = array(
        'uri' => 'https://www.drupal.org',
        'title' => "Drupal web site",
        'options' => array(),
      );

    $this->list[0] = $this->createItem(0, $link);
  }
}

3- Testing your new computed field
Go to Manage display admin page of the Basic page content type (.../admin/structure/types/manage/page/display).
You will see the new field "Resources links" in the "Disabled" fields list.
Drag and drop this field right after the enabled field(s) and save settings.
Visit any of your basic pages and you will see the Drupal web site link a the bottom of the page.

4- Visualizing the fatal error
Still on your basic page, click on the Edit tab.
No need to modify any content, you just have save the page and ... Pow !
White screen with the same error message as mentionned by @lmncn :

Error: Call to a member function isNew() on null in Drupal\Core\Entity\Plugin\Validation\Constraint\ValidReferenceConstraintValidator->validate() (line 74 of core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/ValidReferenceConstraintValidator.php). 

Now, if you pass Null instead of $link in the createItem() fonction (line 27 of ResourcesLinksComputed.php), the bug disappears.
And, as proposed by @lmncn, replacing

if (!$item->entity->isNew()) {

by

if (!$item->getEntity()->isNew()) {

in the core web/core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/ValidReferenceConstraintValidator.php file solves the problem as well.

Production build 0.71.5 2024