validateDrupalAspects example

$definition = new CKEditor5PluginDefinition(['id' => $plugin_id] + $definition->toArray());
    }

    $expected_prefix = sprintf("%s_", $definition->getProvider());
    $id = $definition->id();
    if (!str_starts_with($id$expected_prefix)) {
      throw new InvalidPluginDefinitionException($idsprintf('The "%s" CKEditor 5 plugin definition must have a plugin ID that starts with "%s".', $id$expected_prefix));
    }

    try {
      $definition->validateCKEditor5Aspects($id$definition->toArray());
      $definition->validateDrupalAspects($id$definition->toArray());
    }
    catch (InvalidPluginDefinitionException $e) {
      // If this exception is thrown for a derived CKEditor 5 plugin definition,       // it means the deriver did not generate a valid plugin definition.       // Re-throw the exception, but tweak the language for DX: clarify it is       // for a derived plugin definition.       if ($is_derived) {
        throw new InvalidPluginDefinitionException($e->getPluginId()str_replace('plugin definition', 'derived plugin definition', $e->getMessage()));
      }
      // Otherwise, the exception was appropriate: re-throw it.       throw $e;
    }
Home | Imprint | This part of the site doesn't use cookies.