Account created on 7 July 2022, almost 2 years ago
#

Recent comments

#2 after digging a bit into other implementations I see a light at the end of the tunnel.

My class looks like this

<?php

namespace Drupal\metatag_csp\Plugin\metatag\Tag;

use Drupal\Core\Form\FormStateInterface;
use Drupal\metatag\Plugin\metatag\Tag\MetaNameBase;
use Drupal\Core\StringTranslation\StringTranslationTrait;


/**
 * Provides the Content Security Policy (CSP) meta tag.
 *
 * @MetatagTag(
 *   id = "csp",
 *   label = @Translation("Content Security Policy"),
 *   description = @Translation("Specifies the Content Security Policy directives for this page."),
 *   name = "csp",
 *   group = "advanced",
 *   weight = 10,
 *   type = "http-equiv",
 *   secure = TRUE,
 *   multiple = FALSE
 * )
 */
class ContentSecurityPolicy extends MetaNameBase {

  use StringTranslationTrait;

  /**
   * {@inheritdoc}
   */
  public function form(array $element = []): array {
    $form = [];
    $form['csp_default_src'] = [
      '#type' => 'details',
      '#title' => $this->t('default-src Directive'),
      '#open' => TRUE,
    ];

    $form['csp_default_src']['default-src'] = [
      '#type' => 'radios',
      '#default_value' => "",
      '#options' => [
        'self' => $this->t('Self'),
        'none' => $this->t('None'),
        'any' => $this->t('Any'),
        'n/a' => $this->t('n/a')
      ],
    ];

    $form['csp_default_src']['additional_resources'] = [
      '#type' => 'textarea',
      '#title' => $this->t('Additional Resources'),
      '#default_value' => "",
      '#description' => $this->t('Specify additional resources for default-src.'),
    ];

    return $form;
  }
}

When I go to a page and save my changes, I notice that the values are not saving and I am struggling to understand how this config can be saved and retrieved if exists.

The solution to my problem was to remove all the composer packages except the Drupal core ones.

After that I re-ran

composer require drupal/core:^10 drupal/core-composer-scaffold:^10 drupal/core-project-message:^10 drupal/core-recommended:^10 --no-install --no-update

composer update -W

From here on, I re-introduced all the dependencies.

Installing composer installers worked for me

I spent some time debugging, here is what happens.

#3 I ran composer why-not drupal/core 10 -t and below is the result:

├──acquia/blt-project dev-main (requires drupal/core ^9.5)
├──acquia/drupal-spec-tool v5.0.0 (requires drupal/core ^9.0)
│  └──acquia/blt-project dev-main (requires acquia/drupal-spec-tool *)
├──drupal/admin_toolbar_tools 2.5.0 (requires drupal/core ^8.8.0 || ^9.0)
│  └──acquia/blt-project dev-main (requires drupal/admin_toolbar_tools ^2.0)
├──drupal/core-recommended 9.5.11 (requires drupal/core 9.5.11)
│  └──acquia/blt-project dev-main (requires drupal/core-recommended ^9.5)
├──drupal/field_css 2.0.0-rc4 (requires drupal/core ^8.8.4 || ^9)
│  └──acquia/blt-project dev-main (requires drupal/field_css ^2.0@RC)
├──drupal/core 10.0.0 (requires symfony/console ^6.2) (circular dependency aborted here)
├──acquia/blt-project dev-main (does not require symfony/console but v4.4.49 is installed) (circular dependency aborted here)
├──drupal/core 10.0.0 (requires symfony/dependency-injection ^6.2) (circular dependency aborted here)
├──acquia/blt-project dev-main (does not require symfony/dependency-injection but v4.4.49 is installed) (circular dependency aborted here)
├──drupal/core 10.0.0 (requires symfony/event-dispatcher ^6.2) (circular dependency aborted here)
├──acquia/blt-project dev-main (does not require symfony/event-dispatcher but v4.4.44 is installed) (circular dependency aborted here)
├──drupal/core 10.0.0 (requires symfony/http-foundation ^6.2) (circular dependency aborted here)
├──acquia/blt-project dev-main (does not require symfony/http-foundation but v4.4.49 is installed) (circular dependency aborted here)
├──drupal/core 10.0.0 (requires symfony/http-kernel ^6.2) (circular dependency aborted here)
├──acquia/blt-project dev-main (does not require symfony/http-kernel but v4.4.50 is installed) (circular dependency aborted here)
├──drupal/core 10.0.0 (requires symfony/mime ^6.2) (circular dependency aborted here)
├──acquia/blt-project dev-main (does not require symfony/mime but v5.4.13 is installed) (circular dependency aborted here)
├──drupal/core 10.0.0 (requires symfony/routing ^6.2) (circular dependency aborted here)
├──acquia/blt-project dev-main (does not require symfony/routing but v4.4.44 is installed) (circular dependency aborted here)
├──drupal/core 10.0.0 (requires symfony/serializer ^6.2) (circular dependency aborted here)
├──acquia/blt-project dev-main (does not require symfony/serializer but v4.4.47 is installed) (circular dependency aborted here)
├──drupal/core 10.0.0 (requires symfony/validator ^6.2) (circular dependency aborted here)
├──acquia/blt-project dev-main (does not require symfony/validator but v4.4.48 is installed) (circular dependency aborted here)
├──drupal/core 10.0.0 (requires symfony/process ^6.2) (circular dependency aborted here)
├──acquia/blt-project dev-main (does not require symfony/process but v4.4.44 is installed) (circular dependency aborted here)
├──drupal/core 10.0.0 (requires symfony/yaml ^6.2) (circular dependency aborted here)
├──acquia/blt-project dev-main (does not require symfony/yaml but v4.4.45 is installed) (circular dependency aborted here)
├──drupal/core 10.0.0 (requires twig/twig ^3.4.3) (circular dependency aborted here)
├──acquia/blt-project dev-main (does not require twig/twig but v2.15.5 is installed) (circular dependency aborted here)
├──drupal/core 10.0.0 (requires guzzlehttp/guzzle ^7.5) (circular dependency aborted here)
├──acquia/blt-project dev-main (does not require guzzlehttp/guzzle but 6.5.8 is installed) (circular dependency aborted here)
├──drupal/core 10.0.0 (requires guzzlehttp/psr7 ^2.4) (circular dependency aborted here)
├──acquia/blt-project dev-main (does not require guzzlehttp/psr7 but 1.9.1 is installed) (circular dependency aborted here)
├──drupal/core 10.0.0 (requires asm89/stack-cors ^2.1) (circular dependency aborted here)
├──acquia/blt-project dev-main (does not require asm89/stack-cors but 1.3.0 is installed) (circular dependency aborted here)
├──drupal/core 10.0.0 (requires psr/log ^3.0) (circular dependency aborted here)
└──acquia/blt-project dev-main (does not require psr/log but 1.1.4 is installed) (circular dependency aborted here)

The very first line is tricky

acquia/blt-project dev-main (requires drupal/core ^9.5)

This is not a dependency, but the project itself if I understand correctly.

Then I tried resolving each dependency:

The drupal/admin_toolbar_tools does not seem to be a contributed module listed on drupal.org, and it requires Drupal 9 in its dependencies list when I look at the composer.lock file.

Am not sure about the drupal/core-recommended one

For the field_css module, I already applied a patch which handles the compatibility issue, but for some reason it still gives a problem to move to Drupal 10. See patch below:

https://www.drupal.org/files/issues/2022-12-24/field_css.2.0.x-dev.rector.patch

#3 - This patch creates a conflict because the module already imports the RenderArray class

use Drupal\rat\v1\RenderArray;

Which I don't seem to find anywhere though.

Production build 0.69.0 2024