{% trans %}This is a test. It should link to the URL test topic {{ help_topic_link }}. Also there should be a related topic link below to the Help module topic page and the linked topic.{% endtrans %}
-
{% trans %}Nonworditem totranslate.{% endtrans %}
+
{% trans %}Non-word-item to translate.{% endtrans %}
{% trans %}Test translation.{% endtrans %}
diff --git a/frontend/drupal9/web/core/modules/help_topics/tests/modules/help_topics_test/src/Plugin/HelpSection/TestHelpSection.php b/frontend/drupal9/web/core/modules/help_topics/tests/modules/help_topics_test/src/Plugin/HelpSection/TestHelpSection.php
index f4d2a741e..2dc366bc9 100644
--- a/frontend/drupal9/web/core/modules/help_topics/tests/modules/help_topics_test/src/Plugin/HelpSection/TestHelpSection.php
+++ b/frontend/drupal9/web/core/modules/help_topics/tests/modules/help_topics_test/src/Plugin/HelpSection/TestHelpSection.php
@@ -8,6 +8,8 @@ use Drupal\Core\Url;
use Drupal\Core\Link;
use Drupal\help\Plugin\HelpSection\HelpSectionPluginBase;
+// cspell:ignore asdrsad barmm foomm sqruct wcsrefsdf sdeeeee
+
/**
* Provides a searchable help section for testing.
*
@@ -47,13 +49,13 @@ class TestHelpSection extends HelpSectionPluginBase implements SearchableHelpInt
if ($language->getId() == 'en') {
return [
'title' => 'Foo in English title wcsrefsdf',
- 'text' => 'Something about foo body notawordenglish sqruct',
+ 'text' => 'Something about foo body not-a-word-english sqruct',
'url' => Url::fromUri('https://foo.com'),
];
}
return [
'title' => 'Foomm Foreign heading',
- 'text' => 'Fake foreign foo text notawordgerman asdrsad',
+ 'text' => 'Fake foreign foo text not-a-word-german asdrsad',
'url' => Url::fromUri('https://mm.foo.com'),
];
@@ -61,13 +63,13 @@ class TestHelpSection extends HelpSectionPluginBase implements SearchableHelpInt
if ($language->getId() == 'en') {
return [
'title' => 'Bar in English',
- 'text' => 'Something about bar anotherwordenglish asdrsad',
+ 'text' => 'Something about bar another-word-english asdrsad',
'url' => Url::fromUri('https://bar.com'),
];
}
return [
'title' => \Drupal::state()->get('help_topics_test:translated_title', 'Barmm Foreign sdeeeee'),
- 'text' => 'Fake foreign barmm anotherwordgerman sqruct',
+ 'text' => 'Fake foreign barmm another-word-german sqruct',
'url' => Url::fromUri('https://mm.bar.com'),
];
diff --git a/frontend/drupal9/web/core/modules/help_topics/tests/src/Functional/HelpTopicSearchTest.php b/frontend/drupal9/web/core/modules/help_topics/tests/src/Functional/HelpTopicSearchTest.php
index 83a0c875c..013841aa1 100644
--- a/frontend/drupal9/web/core/modules/help_topics/tests/src/Functional/HelpTopicSearchTest.php
+++ b/frontend/drupal9/web/core/modules/help_topics/tests/src/Functional/HelpTopicSearchTest.php
@@ -5,6 +5,9 @@ namespace Drupal\Tests\help_topics\Functional;
use Drupal\Tests\Traits\Core\CronRunTrait;
use Drupal\help_topics\Plugin\Search\HelpSearch;
+// cspell:ignore asdrsad barmm foomm hilfetestmodul sdeeeee sqruct
+// cspell:ignore wcsrefsdf übersetzung
+
/**
* Verifies help topic search.
*
@@ -63,7 +66,7 @@ class HelpTopicSearchTest extends HelpTopicTranslatedTestBase {
// Before running cron, verify that a search returns no results and shows
// warning.
$this->drupalGet('search/help');
- $this->submitForm(['keys' => 'notawordenglish'], 'Search');
+ $this->submitForm(['keys' => 'not-a-word-english'], 'Search');
$this->assertSearchResultsCount(0);
$this->assertSession()->statusMessageContains('Help search is not fully indexed', 'warning');
@@ -83,7 +86,7 @@ class HelpTopicSearchTest extends HelpTopicTranslatedTestBase {
$this->assertSession()->pageTextContains('100% of the site has been indexed');
// Search and verify there is no warning.
$this->drupalGet('search/help');
- $this->submitForm(['keys' => 'notawordenglish'], 'Search');
+ $this->submitForm(['keys' => 'not-a-word-english'], 'Search');
$this->assertSearchResultsCount(1);
$this->assertSession()->statusMessageNotContains('Help search is not fully indexed');
}
@@ -100,26 +103,26 @@ class HelpTopicSearchTest extends HelpTopicTranslatedTestBase {
// by the topics that come from
// \Drupal\help_topics_test\Plugin\HelpSection\TestHelpSection.
$this->drupalGet('search/help');
- $this->submitForm(['keys' => 'notawordenglish'], 'Search');
+ $this->submitForm(['keys' => 'not-a-word-english'], 'Search');
$this->assertSearchResultsCount(1);
$session->linkExists('Foo in English title wcsrefsdf');
// Same for German.
$this->drupalGet('search/help', ['language' => $german]);
- $this->submitForm(['keys' => 'notawordgerman'], 'Search');
+ $this->submitForm(['keys' => 'not-a-word-german'], 'Search');
$this->assertSearchResultsCount(1);
$session->linkExists('Foomm Foreign heading');
// Verify when we search in English for a word that only exists in German,
// we get no results.
$this->drupalGet('search/help');
- $this->submitForm(['keys' => 'notawordgerman'], 'Search');
+ $this->submitForm(['keys' => 'not-a-word-german'], 'Search');
$this->assertSearchResultsCount(0);
$session->pageTextContains('no results');
// Same for German.
$this->drupalGet('search/help', ['language' => $german]);
- $this->submitForm(['keys' => 'notawordenglish'], 'Search');
+ $this->submitForm(['keys' => 'not-a-word-english'], 'Search');
$this->assertSearchResultsCount(0);
$session->pageTextContains('no results');
@@ -141,7 +144,7 @@ class HelpTopicSearchTest extends HelpTopicTranslatedTestBase {
// that we can search for translated regular help topics, in both English
// and German.
$this->drupalGet('search/help');
- $this->submitForm(['keys' => 'nonworditem'], 'Search');
+ $this->submitForm(['keys' => 'non-word-item'], 'Search');
$this->assertSearchResultsCount(1);
$session->linkExists('ABC Help Test module');
// Click the link and verify we ended up on the topic page.
@@ -149,7 +152,7 @@ class HelpTopicSearchTest extends HelpTopicTranslatedTestBase {
$session->pageTextContains('This is a test');
$this->drupalGet('search/help', ['language' => $german]);
- $this->submitForm(['keys' => 'nonwordgerman'], 'Search');
+ $this->submitForm(['keys' => 'non-word-german'], 'Search');
$this->assertSearchResultsCount(1);
$session->linkExists('ABC-Hilfetestmodul');
$this->clickLink('ABC-Hilfetestmodul');
@@ -158,13 +161,13 @@ class HelpTopicSearchTest extends HelpTopicTranslatedTestBase {
// Verify that we can search from the admin/help page.
$this->drupalGet('admin/help');
$session->pageTextContains('Search help');
- $this->submitForm(['keys' => 'nonworditem'], 'Search');
+ $this->submitForm(['keys' => 'non-word-item'], 'Search');
$this->assertSearchResultsCount(1);
$session->linkExists('ABC Help Test module');
// Same for German.
$this->drupalGet('admin/help', ['language' => $german]);
- $this->submitForm(['keys' => 'nonwordgerman'], 'Search');
+ $this->submitForm(['keys' => 'non-word-german'], 'Search');
$this->assertSearchResultsCount(1);
$session->linkExists('ABC-Hilfetestmodul');
@@ -228,12 +231,12 @@ class HelpTopicSearchTest extends HelpTopicTranslatedTestBase {
$session->pageTextContains('Search help');
$this->drupalGet('search/help');
- $this->submitForm(['keys' => 'nonworditem'], 'Search');
+ $this->submitForm(['keys' => 'non-word-item'], 'Search');
$this->assertSearchResultsCount(1);
$session->linkExists('ABC Help Test module');
$this->drupalGet('search/help');
- $this->submitForm(['keys' => 'notawordenglish'], 'Search');
+ $this->submitForm(['keys' => 'not-a-word-english'], 'Search');
$this->assertSearchResultsCount(0);
$session->pageTextContains('no results');
@@ -241,7 +244,7 @@ class HelpTopicSearchTest extends HelpTopicTranslatedTestBase {
// searchable.
\Drupal::service('module_installer')->uninstall(['help_topics_test']);
$this->drupalGet('search/help');
- $this->submitForm(['keys' => 'nonworditem'], 'Search');
+ $this->submitForm(['keys' => 'non-word-item'], 'Search');
$this->assertSearchResultsCount(0);
}
diff --git a/frontend/drupal9/web/core/modules/help_topics/tests/src/Functional/HelpTopicTranslatedTestBase.php b/frontend/drupal9/web/core/modules/help_topics/tests/src/Functional/HelpTopicTranslatedTestBase.php
index c2f1158aa..ec5ffce50 100644
--- a/frontend/drupal9/web/core/modules/help_topics/tests/src/Functional/HelpTopicTranslatedTestBase.php
+++ b/frontend/drupal9/web/core/modules/help_topics/tests/src/Functional/HelpTopicTranslatedTestBase.php
@@ -4,6 +4,8 @@ namespace Drupal\Tests\help_topics\Functional;
use Drupal\Tests\BrowserTestBase;
+// cspell:ignore hilfetestmodul übersetzung
+
/**
* Provides a base class for functional help topic tests that use translation.
*
@@ -73,8 +75,8 @@ msgstr "ABC-Hilfetestmodul"
msgid "Test translation."
msgstr "Übersetzung testen."
-msgid "Nonworditem totranslate."
-msgstr "Nonwordgerman sdfwedrsdf."
+msgid "Non-word-item to translate."
+msgstr "Non-word-german sdfwedrsdf."
ENDPO;
include_once $this->root . '/core/includes/install.core.inc';
diff --git a/frontend/drupal9/web/core/modules/help_topics/tests/src/Functional/HelpTopicTranslationTest.php b/frontend/drupal9/web/core/modules/help_topics/tests/src/Functional/HelpTopicTranslationTest.php
index 86e45d7a3..261fcb0ba 100644
--- a/frontend/drupal9/web/core/modules/help_topics/tests/src/Functional/HelpTopicTranslationTest.php
+++ b/frontend/drupal9/web/core/modules/help_topics/tests/src/Functional/HelpTopicTranslationTest.php
@@ -2,6 +2,8 @@
namespace Drupal\Tests\help_topics\Functional;
+// cspell:ignore hilfetestmodul übersetzung
+
/**
* Verifies help topic translations.
*
diff --git a/frontend/drupal9/web/core/modules/image/tests/src/Functional/Rest/ImageStyleResourceTestBase.php b/frontend/drupal9/web/core/modules/image/tests/src/Functional/Rest/ImageStyleResourceTestBase.php
index ec348d0a8..fdad4a2e9 100644
--- a/frontend/drupal9/web/core/modules/image/tests/src/Functional/Rest/ImageStyleResourceTestBase.php
+++ b/frontend/drupal9/web/core/modules/image/tests/src/Functional/Rest/ImageStyleResourceTestBase.php
@@ -99,6 +99,7 @@ abstract class ImageStyleResourceTestBase extends ConfigEntityResourceTestBase {
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ActionTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ActionTest.php
index 1495e9aac..ba0b527c4 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ActionTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ActionTest.php
@@ -112,6 +112,7 @@ class ActionTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
}
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/BaseFieldOverrideTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/BaseFieldOverrideTest.php
index 756db1254..083603090 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/BaseFieldOverrideTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/BaseFieldOverrideTest.php
@@ -123,6 +123,7 @@ class BaseFieldOverrideTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/BlockContentTypeTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/BlockContentTypeTest.php
index 8db306933..77aa86470 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/BlockContentTypeTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/BlockContentTypeTest.php
@@ -103,6 +103,7 @@ class BlockContentTypeTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
}
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/BlockTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/BlockTest.php
index 16c5213f3..41911a900 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/BlockTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/BlockTest.php
@@ -136,6 +136,7 @@ class BlockTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update once https://www.drupal.org/node/2300677 is fixed.
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/CommentTypeTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/CommentTypeTest.php
index 1179c8112..e3654b49e 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/CommentTypeTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/CommentTypeTest.php
@@ -104,6 +104,7 @@ class CommentTypeTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
}
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ConfigTestTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ConfigTestTest.php
index c4dc049ee..df19a11b8 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ConfigTestTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ConfigTestTest.php
@@ -116,6 +116,7 @@ class ConfigTestTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
}
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ConfigurableLanguageTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ConfigurableLanguageTest.php
index 97dd34593..ad2c26177 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ConfigurableLanguageTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ConfigurableLanguageTest.php
@@ -105,6 +105,7 @@ class ConfigurableLanguageTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ContactFormTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ContactFormTest.php
index 1e90a94fc..b91d4b7d5 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ContactFormTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ContactFormTest.php
@@ -112,6 +112,7 @@ class ContactFormTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ContentLanguageSettingsTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ContentLanguageSettingsTest.php
index e80d50fc5..608254907 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ContentLanguageSettingsTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ContentLanguageSettingsTest.php
@@ -116,6 +116,7 @@ class ContentLanguageSettingsTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/DateFormatTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/DateFormatTest.php
index 4381a24ff..42e673c52 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/DateFormatTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/DateFormatTest.php
@@ -108,6 +108,7 @@ class DateFormatTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
}
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/EditorTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/EditorTest.php
index b1c4a8aff..8dc45e7e7 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/EditorTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/EditorTest.php
@@ -156,6 +156,7 @@ class EditorTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/EntityFormDisplayTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/EntityFormDisplayTest.php
index 2cbe0d412..b4162427f 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/EntityFormDisplayTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/EntityFormDisplayTest.php
@@ -173,6 +173,7 @@ class EntityFormDisplayTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/EntityFormModeTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/EntityFormModeTest.php
index 5e012df62..91804ab36 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/EntityFormModeTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/EntityFormModeTest.php
@@ -106,6 +106,7 @@ class EntityFormModeTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
}
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/EntityViewDisplayTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/EntityViewDisplayTest.php
index 89aade958..6a96388a8 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/EntityViewDisplayTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/EntityViewDisplayTest.php
@@ -127,6 +127,7 @@ class EntityViewDisplayTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/EntityViewModeTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/EntityViewModeTest.php
index e33fc3a9d..27bf64d45 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/EntityViewModeTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/EntityViewModeTest.php
@@ -106,6 +106,7 @@ class EntityViewModeTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
}
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/FieldConfigTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/FieldConfigTest.php
index 88a78698b..eb81f5091 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/FieldConfigTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/FieldConfigTest.php
@@ -133,6 +133,7 @@ class FieldConfigTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/FieldStorageConfigTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/FieldStorageConfigTest.php
index 0a7884104..d7f770803 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/FieldStorageConfigTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/FieldStorageConfigTest.php
@@ -112,6 +112,7 @@ class FieldStorageConfigTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php
index 16ed1621a..0dcfb3e68 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/FileUploadTest.php
@@ -5,6 +5,7 @@ namespace Drupal\Tests\jsonapi\Functional;
use Drupal\Component\Render\PlainTextOutput;
use Drupal\Component\Serialization\Json;
use Drupal\Component\Utility\NestedArray;
+use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\Url;
use Drupal\entity_test\Entity\EntityTest;
@@ -775,6 +776,7 @@ class FileUploadTest extends ResourceTestBase {
case 'PATCH':
return "The current user is not permitted to upload a file for this field. The 'administer entity_test content' permission is required.";
}
+ return '';
}
/**
@@ -927,6 +929,7 @@ class FileUploadTest extends ResourceTestBase {
protected function getExpectedUnauthorizedAccessCacheability() {
// There is cacheability metadata to check as file uploads only allows POST
// requests, which will not return cacheable responses.
+ return new CacheableMetadata();
}
}
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/FilterFormatTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/FilterFormatTest.php
index 66cb157c3..c40e249d6 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/FilterFormatTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/FilterFormatTest.php
@@ -120,6 +120,7 @@ class FilterFormatTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
}
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ImageStyleTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ImageStyleTest.php
index 4180a6ef2..1bafcf55b 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ImageStyleTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ImageStyleTest.php
@@ -130,6 +130,7 @@ class ImageStyleTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
}
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/MediaTypeTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/MediaTypeTest.php
index 5e02fa47f..cd26f4af3 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/MediaTypeTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/MediaTypeTest.php
@@ -110,6 +110,7 @@ class MediaTypeTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
}
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/MenuTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/MenuTest.php
index fb22eecee..c367ab617 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/MenuTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/MenuTest.php
@@ -106,6 +106,7 @@ class MenuTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
}
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/NodeTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/NodeTest.php
index 6e3d99a76..ec45b2d0b 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/NodeTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/NodeTest.php
@@ -265,6 +265,7 @@ class NodeTest extends ResourceTestBase {
case 'DELETE':
return "The 'access content' permission is required.";
}
+ return '';
}
/**
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/NodeTypeTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/NodeTypeTest.php
index 42890aa20..ea93316bb 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/NodeTypeTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/NodeTypeTest.php
@@ -106,6 +106,7 @@ class NodeTypeTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/RdfMappingTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/RdfMappingTest.php
index f820095ff..61e0f378e 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/RdfMappingTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/RdfMappingTest.php
@@ -148,6 +148,7 @@ class RdfMappingTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
}
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ResponsiveImageStyleTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ResponsiveImageStyleTest.php
index 86e4c3848..32b14bd96 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ResponsiveImageStyleTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ResponsiveImageStyleTest.php
@@ -142,6 +142,7 @@ class ResponsiveImageStyleTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
}
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/RestJsonApiUnsupported.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/RestJsonApiUnsupported.php
index d58bc02b2..afabfeefb 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/RestJsonApiUnsupported.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/RestJsonApiUnsupported.php
@@ -2,6 +2,7 @@
namespace Drupal\Tests\jsonapi\Functional;
+use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Url;
use Drupal\node\Entity\Node;
use Drupal\node\Entity\NodeType;
@@ -117,11 +118,15 @@ class RestJsonApiUnsupported extends ResourceTestBase {
/**
* {@inheritdoc}
*/
- protected function getExpectedUnauthorizedAccessMessage($method) {}
+ protected function getExpectedUnauthorizedAccessMessage($method) {
+ return '';
+ }
/**
* {@inheritdoc}
*/
- protected function getExpectedUnauthorizedAccessCacheability() {}
+ protected function getExpectedUnauthorizedAccessCacheability() {
+ return (new CacheableMetadata());
+ }
}
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/RestResourceConfigTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/RestResourceConfigTest.php
index c900db5a9..5dbeeff93 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/RestResourceConfigTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/RestResourceConfigTest.php
@@ -126,6 +126,7 @@ class RestResourceConfigTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
}
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/RoleTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/RoleTest.php
index e82b53e9f..a51161322 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/RoleTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/RoleTest.php
@@ -101,6 +101,7 @@ class RoleTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
}
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/SearchPageTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/SearchPageTest.php
index fc4ffaa49..ea1e4a008 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/SearchPageTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/SearchPageTest.php
@@ -119,6 +119,7 @@ class SearchPageTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ShortcutSetTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ShortcutSetTest.php
index a5e080b8d..657cd1c3c 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ShortcutSetTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ShortcutSetTest.php
@@ -123,6 +123,7 @@ class ShortcutSetTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
}
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/TourTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/TourTest.php
index 9a3a1d242..138616099 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/TourTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/TourTest.php
@@ -131,6 +131,7 @@ class TourTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ViewTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ViewTest.php
index a94c3c719..a4c105aae 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ViewTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/ViewTest.php
@@ -121,6 +121,7 @@ class ViewTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
}
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/VocabularyTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/VocabularyTest.php
index 49e548dcf..cf86bb3e7 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/VocabularyTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/VocabularyTest.php
@@ -100,6 +100,7 @@ class VocabularyTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/WorkflowTest.php b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/WorkflowTest.php
index 94cda92d2..7a2a00a8e 100644
--- a/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/WorkflowTest.php
+++ b/frontend/drupal9/web/core/modules/jsonapi/tests/src/Functional/WorkflowTest.php
@@ -126,6 +126,7 @@ class WorkflowTest extends ConfigEntityResourceTestBase {
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
}
diff --git a/frontend/drupal9/web/core/modules/language/tests/src/Functional/LanguageNegotiationSessionTest.php b/frontend/drupal9/web/core/modules/language/tests/src/Functional/LanguageNegotiationSessionTest.php
new file mode 100644
index 000000000..ca3626a67
--- /dev/null
+++ b/frontend/drupal9/web/core/modules/language/tests/src/Functional/LanguageNegotiationSessionTest.php
@@ -0,0 +1,94 @@
+adminUser = $this->drupalCreateUser(['administer languages']);
+ $this->drupalLogin($this->adminUser);
+
+ ConfigurableLanguage::createFromLangcode('fr')->save();
+ }
+
+ /**
+ * Tests language negotiation via query/session parameters.
+ */
+ public function testSessionLanguageNegotiationMethod() {
+ $this->drupalGet('admin/config/regional/language/detection');
+
+ // Enable Session and Selected language for interface language detection.
+ $config = $this->config('language.types');
+ $config->set('configurable', [LanguageInterface::TYPE_INTERFACE]);
+ $config->set('negotiation.language_interface.enabled', [
+ LanguageNegotiationSession::METHOD_ID => -6,
+ LanguageNegotiationSelected::METHOD_ID => 12,
+ ]);
+ $config->set('negotiation.language_interface.method_weights', [
+ 'language-user-admin' => -10,
+ LanguageNegotiationUrl::METHOD_ID => -8,
+ LanguageNegotiationSession::METHOD_ID => -6,
+ 'language-user' => -4,
+ LanguageNegotiationBrowser::METHOD_ID => -2,
+ LanguageNegotiationSelected::METHOD_ID => 12,
+ ]);
+ $config->save();
+
+ // Set language via query parameter.
+ $this->drupalGet('user/' . $this->adminUser->id(), ['query' => ['language' => 'fr']]);
+ $this->assertSession()->statusCodeEquals(200);
+ $this->assertSession()->responseHeaderEquals('Content-language', 'fr');
+
+ // Verify that the language is persisted in the session.
+ $this->drupalGet('user/' . $this->adminUser->id());
+ $this->assertSession()->statusCodeEquals(200);
+ $this->assertSession()->responseHeaderEquals('Content-language', 'fr');
+
+ // Set language via query parameter.
+ $this->drupalGet('user/' . $this->adminUser->id(), ['query' => ['language' => 'en']]);
+ $this->assertSession()->statusCodeEquals(200);
+ $this->assertSession()->responseHeaderEquals('Content-language', 'en');
+
+ // Verify that the language is persisted in the session.
+ $this->drupalGet('admin/config/regional/language');
+ $this->assertSession()->statusCodeEquals(200);
+ $this->assertSession()->responseHeaderEquals('Content-language', 'en');
+ }
+
+}
diff --git a/frontend/drupal9/web/core/modules/language/tests/src/Functional/Rest/ConfigurableLanguageResourceTestBase.php b/frontend/drupal9/web/core/modules/language/tests/src/Functional/Rest/ConfigurableLanguageResourceTestBase.php
index 933202a12..02a976c74 100644
--- a/frontend/drupal9/web/core/modules/language/tests/src/Functional/Rest/ConfigurableLanguageResourceTestBase.php
+++ b/frontend/drupal9/web/core/modules/language/tests/src/Functional/Rest/ConfigurableLanguageResourceTestBase.php
@@ -73,6 +73,7 @@ abstract class ConfigurableLanguageResourceTestBase extends ConfigEntityResource
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/modules/language/tests/src/Functional/Rest/ContentLanguageSettingsResourceTestBase.php b/frontend/drupal9/web/core/modules/language/tests/src/Functional/Rest/ContentLanguageSettingsResourceTestBase.php
index 3eafb0be0..30683f0a1 100644
--- a/frontend/drupal9/web/core/modules/language/tests/src/Functional/Rest/ContentLanguageSettingsResourceTestBase.php
+++ b/frontend/drupal9/web/core/modules/language/tests/src/Functional/Rest/ContentLanguageSettingsResourceTestBase.php
@@ -77,6 +77,7 @@ abstract class ContentLanguageSettingsResourceTestBase extends ConfigEntityResou
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/TestStateBasedSectionStorage.php b/frontend/drupal9/web/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/TestStateBasedSectionStorage.php
index d51cdc72c..378975db6 100644
--- a/frontend/drupal9/web/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/TestStateBasedSectionStorage.php
+++ b/frontend/drupal9/web/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/TestStateBasedSectionStorage.php
@@ -43,56 +43,77 @@ class TestStateBasedSectionStorage extends SectionStorageBase {
/**
* {@inheritdoc}
*/
- public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE) {}
+ public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE) {
+ throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
+ }
/**
* {@inheritdoc}
*/
- protected function getSectionList() {}
+ protected function getSectionList() {
+ throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
+ }
/**
* {@inheritdoc}
*/
- public function getStorageId() {}
+ public function getStorageId() {
+ throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
+ }
/**
* {@inheritdoc}
*/
- public function getSectionListFromId($id) {}
+ public function getSectionListFromId($id) {
+ throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
+ }
/**
* {@inheritdoc}
*/
- public function buildRoutes(RouteCollection $collection) {}
+ public function buildRoutes(RouteCollection $collection) {
+ }
/**
* {@inheritdoc}
*/
- public function getRedirectUrl() {}
+ public function getRedirectUrl() {
+ throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
+ }
/**
* {@inheritdoc}
*/
- public function getLayoutBuilderUrl($rel = 'view') {}
+ public function getLayoutBuilderUrl($rel = 'view') {
+ throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
+ }
/**
* {@inheritdoc}
*/
- public function extractIdFromRoute($value, $definition, $name, array $defaults) {}
+ public function extractIdFromRoute($value, $definition, $name, array $defaults) {
+ throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
+ }
/**
* {@inheritdoc}
*/
- public function deriveContextsFromRoute($value, $definition, $name, array $defaults) {}
+ public function deriveContextsFromRoute($value, $definition, $name, array $defaults) {
+ throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
+ }
/**
* {@inheritdoc}
*/
- public function label() {}
+ public function label() {
+ throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
+ }
/**
* {@inheritdoc}
*/
- public function save() {}
+ public function save() {
+ throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
+ }
}
diff --git a/frontend/drupal9/web/core/modules/layout_builder/tests/src/Functional/Rest/LayoutRestTestBase.php b/frontend/drupal9/web/core/modules/layout_builder/tests/src/Functional/Rest/LayoutRestTestBase.php
index 377084483..071dc0506 100644
--- a/frontend/drupal9/web/core/modules/layout_builder/tests/src/Functional/Rest/LayoutRestTestBase.php
+++ b/frontend/drupal9/web/core/modules/layout_builder/tests/src/Functional/Rest/LayoutRestTestBase.php
@@ -3,6 +3,7 @@
namespace Drupal\Tests\layout_builder\Functional\Rest;
use Drupal\Component\Utility\NestedArray;
+use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Url;
use Drupal\Tests\rest\Functional\BasicAuthResourceTestTrait;
use Drupal\Tests\rest\Functional\ResourceTestBase;
@@ -131,7 +132,9 @@ abstract class LayoutRestTestBase extends ResourceTestBase {
/**
* {@inheritdoc}
*/
- protected function getExpectedUnauthorizedAccessCacheability() {}
+ protected function getExpectedUnauthorizedAccessCacheability() {
+ return (new CacheableMetadata());
+ }
/**
* Gets the decoded contents.
diff --git a/frontend/drupal9/web/core/modules/media/tests/src/Functional/Rest/MediaTypeResourceTestBase.php b/frontend/drupal9/web/core/modules/media/tests/src/Functional/Rest/MediaTypeResourceTestBase.php
index c935962fb..c74909e6f 100644
--- a/frontend/drupal9/web/core/modules/media/tests/src/Functional/Rest/MediaTypeResourceTestBase.php
+++ b/frontend/drupal9/web/core/modules/media/tests/src/Functional/Rest/MediaTypeResourceTestBase.php
@@ -73,6 +73,7 @@ abstract class MediaTypeResourceTestBase extends ConfigEntityResourceTestBase {
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
}
diff --git a/frontend/drupal9/web/core/modules/migrate/tests/src/Kernel/SqlBaseTest.php b/frontend/drupal9/web/core/modules/migrate/tests/src/Kernel/SqlBaseTest.php
index 71eaef1a4..1661aece7 100644
--- a/frontend/drupal9/web/core/modules/migrate/tests/src/Kernel/SqlBaseTest.php
+++ b/frontend/drupal9/web/core/modules/migrate/tests/src/Kernel/SqlBaseTest.php
@@ -225,12 +225,16 @@ class TestSqlBase extends SqlBase {
/**
* {@inheritdoc}
*/
- public function getIds() {}
+ public function getIds() {
+ return [];
+ }
/**
* {@inheritdoc}
*/
- public function fields() {}
+ public function fields() {
+ throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
+ }
/**
* {@inheritdoc}
diff --git a/frontend/drupal9/web/core/modules/migrate/tests/src/Unit/SqlBaseTest.php b/frontend/drupal9/web/core/modules/migrate/tests/src/Unit/SqlBaseTest.php
index aa843c4ea..749d9937f 100644
--- a/frontend/drupal9/web/core/modules/migrate/tests/src/Unit/SqlBaseTest.php
+++ b/frontend/drupal9/web/core/modules/migrate/tests/src/Unit/SqlBaseTest.php
@@ -220,12 +220,16 @@ class TestSqlBase extends SqlBase {
/**
* {@inheritdoc}
*/
- public function fields() {}
+ public function fields() {
+ throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
+ }
/**
* {@inheritdoc}
*/
- public function query() {}
+ public function query() {
+ throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
+ }
/**
* {@inheritdoc}
diff --git a/frontend/drupal9/web/core/modules/migrate/tests/src/Unit/TestMigrateExecutable.php b/frontend/drupal9/web/core/modules/migrate/tests/src/Unit/TestMigrateExecutable.php
index 312472d73..ecd56ca9c 100644
--- a/frontend/drupal9/web/core/modules/migrate/tests/src/Unit/TestMigrateExecutable.php
+++ b/frontend/drupal9/web/core/modules/migrate/tests/src/Unit/TestMigrateExecutable.php
@@ -32,6 +32,7 @@ class TestMigrateExecutable extends MigrateExecutable {
*/
public function setStringTranslation(TranslationInterface $string_translation) {
$this->stringTranslation = $string_translation;
+ return $this;
}
/**
diff --git a/frontend/drupal9/web/core/modules/migrate_drupal/tests/src/Unit/source/DrupalSqlBaseTest.php b/frontend/drupal9/web/core/modules/migrate_drupal/tests/src/Unit/source/DrupalSqlBaseTest.php
index 8792b1022..a4ed2628e 100644
--- a/frontend/drupal9/web/core/modules/migrate_drupal/tests/src/Unit/source/DrupalSqlBaseTest.php
+++ b/frontend/drupal9/web/core/modules/migrate_drupal/tests/src/Unit/source/DrupalSqlBaseTest.php
@@ -184,6 +184,7 @@ class TestDrupalSqlBase extends DrupalSqlBase {
* {@inheritdoc}
*/
public function query() {
+ throw new \RuntimeException(__METHOD__ . " not implemented for " . __CLASS__);
}
/**
diff --git a/frontend/drupal9/web/core/modules/migrate_drupal_ui/tests/src/Functional/d6/IdConflictTest.php b/frontend/drupal9/web/core/modules/migrate_drupal_ui/tests/src/Functional/d6/IdConflictTest.php
index 7e9412f25..e03d0f7f3 100644
--- a/frontend/drupal9/web/core/modules/migrate_drupal_ui/tests/src/Functional/d6/IdConflictTest.php
+++ b/frontend/drupal9/web/core/modules/migrate_drupal_ui/tests/src/Functional/d6/IdConflictTest.php
@@ -44,24 +44,28 @@ class IdConflictTest extends MigrateUpgradeExecuteTestBase {
* {@inheritdoc}
*/
protected function getEntityCounts() {
+ return [];
}
/**
* {@inheritdoc}
*/
protected function getEntityCountsIncremental() {
+ return [];
}
/**
* {@inheritdoc}
*/
protected function getAvailablePaths() {
+ return [];
}
/**
* {@inheritdoc}
*/
protected function getMissingPaths() {
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/modules/migrate_drupal_ui/tests/src/Functional/d6/NodeClassicTest.php b/frontend/drupal9/web/core/modules/migrate_drupal_ui/tests/src/Functional/d6/NodeClassicTest.php
index 6cea7ef5a..723659894 100644
--- a/frontend/drupal9/web/core/modules/migrate_drupal_ui/tests/src/Functional/d6/NodeClassicTest.php
+++ b/frontend/drupal9/web/core/modules/migrate_drupal_ui/tests/src/Functional/d6/NodeClassicTest.php
@@ -51,24 +51,28 @@ class NodeClassicTest extends MigrateUpgradeExecuteTestBase {
* {@inheritdoc}
*/
protected function getEntityCounts() {
+ return [];
}
/**
* {@inheritdoc}
*/
protected function getEntityCountsIncremental() {
+ return [];
}
/**
* {@inheritdoc}
*/
protected function getAvailablePaths() {
+ return [];
}
/**
* {@inheritdoc}
*/
protected function getMissingPaths() {
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/modules/migrate_drupal_ui/tests/src/Functional/d7/FilePathTest.php b/frontend/drupal9/web/core/modules/migrate_drupal_ui/tests/src/Functional/d7/FilePathTest.php
index 5f8652e8d..6ccb1f97f 100644
--- a/frontend/drupal9/web/core/modules/migrate_drupal_ui/tests/src/Functional/d7/FilePathTest.php
+++ b/frontend/drupal9/web/core/modules/migrate_drupal_ui/tests/src/Functional/d7/FilePathTest.php
@@ -287,30 +287,35 @@ class FilePathTest extends MigrateUpgradeTestBase {
* {@inheritdoc}
*/
protected function getEntityCounts() {
+ return [];
}
/**
* {@inheritdoc}
*/
protected function getEntityCountsIncremental() {
+ return [];
}
/**
* {@inheritdoc}
*/
protected function getAvailablePaths() {
+ return [];
}
/**
* {@inheritdoc}
*/
protected function getMissingPaths() {
+ return [];
}
/**
* {@inheritdoc}
*/
protected function getSourceBasePath() {
+ return '';
}
}
diff --git a/frontend/drupal9/web/core/modules/migrate_drupal_ui/tests/src/Functional/d7/IdConflictTest.php b/frontend/drupal9/web/core/modules/migrate_drupal_ui/tests/src/Functional/d7/IdConflictTest.php
index 961e24dcf..892e4df6c 100644
--- a/frontend/drupal9/web/core/modules/migrate_drupal_ui/tests/src/Functional/d7/IdConflictTest.php
+++ b/frontend/drupal9/web/core/modules/migrate_drupal_ui/tests/src/Functional/d7/IdConflictTest.php
@@ -44,24 +44,28 @@ class IdConflictTest extends MigrateUpgradeExecuteTestBase {
* {@inheritdoc}
*/
protected function getEntityCounts() {
+ return [];
}
/**
* {@inheritdoc}
*/
protected function getEntityCountsIncremental() {
+ return [];
}
/**
* {@inheritdoc}
*/
protected function getAvailablePaths() {
+ return [];
}
/**
* {@inheritdoc}
*/
protected function getMissingPaths() {
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/modules/node/tests/src/Functional/Rest/NodeTypeResourceTestBase.php b/frontend/drupal9/web/core/modules/node/tests/src/Functional/Rest/NodeTypeResourceTestBase.php
index b65a2b043..9b3e21cc8 100644
--- a/frontend/drupal9/web/core/modules/node/tests/src/Functional/Rest/NodeTypeResourceTestBase.php
+++ b/frontend/drupal9/web/core/modules/node/tests/src/Functional/Rest/NodeTypeResourceTestBase.php
@@ -74,6 +74,7 @@ abstract class NodeTypeResourceTestBase extends ConfigEntityResourceTestBase {
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditIntegrationTest.php b/frontend/drupal9/web/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditIntegrationTest.php
index a15bb9ac5..c78ec364e 100644
--- a/frontend/drupal9/web/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditIntegrationTest.php
+++ b/frontend/drupal9/web/core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditIntegrationTest.php
@@ -119,7 +119,6 @@ class QuickEditIntegrationTest extends QuickEditJavascriptTestBase {
* Tests if an article node can be in-place edited with Quick Edit.
*/
public function testArticleNode() {
- $this->markTestSkipped();
$term = Term::create([
'name' => 'foo',
'vid' => 'tags',
@@ -138,6 +137,17 @@ class QuickEditIntegrationTest extends QuickEditJavascriptTestBase {
],
]);
+ // Move "tags" field to the top of all fields, so its Quick Edit Toolbar
+ // won't overlap any Quick Edit-able fields, which causes (semi-)random test
+ // failures.
+ \Drupal::entityTypeManager()
+ ->getStorage('entity_view_display')
+ ->load('node.article.default')
+ ->setComponent('field_tags', [
+ 'type' => 'entity_reference_label',
+ 'weight' => 0,
+ ])->save();
+
$this->drupalGet('node/' . $node->id());
// Initial state.
diff --git a/frontend/drupal9/web/core/modules/rdf/tests/src/Functional/Rest/RdfMappingResourceTestBase.php b/frontend/drupal9/web/core/modules/rdf/tests/src/Functional/Rest/RdfMappingResourceTestBase.php
index 45d3b3ef4..3a7e26bd3 100644
--- a/frontend/drupal9/web/core/modules/rdf/tests/src/Functional/Rest/RdfMappingResourceTestBase.php
+++ b/frontend/drupal9/web/core/modules/rdf/tests/src/Functional/Rest/RdfMappingResourceTestBase.php
@@ -111,6 +111,7 @@ abstract class RdfMappingResourceTestBase extends ConfigEntityResourceTestBase {
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/modules/responsive_image/tests/src/Functional/Rest/ResponsiveImageStyleResourceTestBase.php b/frontend/drupal9/web/core/modules/responsive_image/tests/src/Functional/Rest/ResponsiveImageStyleResourceTestBase.php
index 1e115fd8b..7b0c7f075 100644
--- a/frontend/drupal9/web/core/modules/responsive_image/tests/src/Functional/Rest/ResponsiveImageStyleResourceTestBase.php
+++ b/frontend/drupal9/web/core/modules/responsive_image/tests/src/Functional/Rest/ResponsiveImageStyleResourceTestBase.php
@@ -117,6 +117,7 @@ abstract class ResponsiveImageStyleResourceTestBase extends ConfigEntityResource
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/modules/rest/tests/src/Functional/FileUploadResourceTestBase.php b/frontend/drupal9/web/core/modules/rest/tests/src/Functional/FileUploadResourceTestBase.php
index c5381d5cd..d95f4cd97 100644
--- a/frontend/drupal9/web/core/modules/rest/tests/src/Functional/FileUploadResourceTestBase.php
+++ b/frontend/drupal9/web/core/modules/rest/tests/src/Functional/FileUploadResourceTestBase.php
@@ -4,6 +4,7 @@ namespace Drupal\Tests\rest\Functional;
use Drupal\Component\Render\PlainTextOutput;
use Drupal\Component\Utility\NestedArray;
+use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\Url;
use Drupal\entity_test\Entity\EntityTest;
@@ -819,6 +820,7 @@ abstract class FileUploadResourceTestBase extends ResourceTestBase {
protected function getExpectedUnauthorizedAccessCacheability() {
// There is cacheability metadata to check as file uploads only allows POST
// requests, which will not return cacheable responses.
+ return new CacheableMetadata();
}
}
diff --git a/frontend/drupal9/web/core/modules/rest/tests/src/Functional/ResourceTestBase.php b/frontend/drupal9/web/core/modules/rest/tests/src/Functional/ResourceTestBase.php
index ce509970d..575bf976d 100644
--- a/frontend/drupal9/web/core/modules/rest/tests/src/Functional/ResourceTestBase.php
+++ b/frontend/drupal9/web/core/modules/rest/tests/src/Functional/ResourceTestBase.php
@@ -501,6 +501,8 @@ abstract class ResourceTestBase extends BrowserTestBase {
static::recursiveKSort($value);
}
}
+
+ return $array;
}
}
diff --git a/frontend/drupal9/web/core/modules/rest/tests/src/Functional/Rest/RestResourceConfigResourceTestBase.php b/frontend/drupal9/web/core/modules/rest/tests/src/Functional/Rest/RestResourceConfigResourceTestBase.php
index 45e947395..f63cd257d 100644
--- a/frontend/drupal9/web/core/modules/rest/tests/src/Functional/Rest/RestResourceConfigResourceTestBase.php
+++ b/frontend/drupal9/web/core/modules/rest/tests/src/Functional/Rest/RestResourceConfigResourceTestBase.php
@@ -89,6 +89,7 @@ abstract class RestResourceConfigResourceTestBase extends ConfigEntityResourceTe
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/modules/search/tests/src/Functional/Rest/SearchPageResourceTestBase.php b/frontend/drupal9/web/core/modules/search/tests/src/Functional/Rest/SearchPageResourceTestBase.php
index b9f00855a..5555e0211 100644
--- a/frontend/drupal9/web/core/modules/search/tests/src/Functional/Rest/SearchPageResourceTestBase.php
+++ b/frontend/drupal9/web/core/modules/search/tests/src/Functional/Rest/SearchPageResourceTestBase.php
@@ -80,6 +80,7 @@ abstract class SearchPageResourceTestBase extends ConfigEntityResourceTestBase {
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php b/frontend/drupal9/web/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php
index 7a3c6a4a6..97dc2febc 100644
--- a/frontend/drupal9/web/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php
+++ b/frontend/drupal9/web/core/modules/settings_tray/tests/src/FunctionalJavascript/SettingsTrayBlockFormTest.php
@@ -284,15 +284,4 @@ class SettingsTrayBlockFormTest extends SettingsTrayTestBase {
}
}
- /**
- * {@inheritdoc}
- */
- protected function getTestThemes() {
- // Remove 'seven' theme. Setting Tray "Edit Mode" will not work with 'seven'
- // because it removes all contextual links the off-canvas dialog should.
- return array_filter(parent::getTestThemes(), function ($theme) {
- return $theme !== 'seven';
- });
- }
-
}
diff --git a/frontend/drupal9/web/core/modules/shortcut/tests/src/Functional/Rest/ShortcutSetResourceTestBase.php b/frontend/drupal9/web/core/modules/shortcut/tests/src/Functional/Rest/ShortcutSetResourceTestBase.php
index e019984eb..5efce2740 100644
--- a/frontend/drupal9/web/core/modules/shortcut/tests/src/Functional/Rest/ShortcutSetResourceTestBase.php
+++ b/frontend/drupal9/web/core/modules/shortcut/tests/src/Functional/Rest/ShortcutSetResourceTestBase.php
@@ -83,6 +83,7 @@ abstract class ShortcutSetResourceTestBase extends ConfigEntityResourceTestBase
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestBundleResourceTestBase.php b/frontend/drupal9/web/core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestBundleResourceTestBase.php
index 26ed92245..87ff25899 100644
--- a/frontend/drupal9/web/core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestBundleResourceTestBase.php
+++ b/frontend/drupal9/web/core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestBundleResourceTestBase.php
@@ -68,6 +68,7 @@ abstract class EntityTestBundleResourceTestBase extends ConfigEntityResourceTest
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
}
diff --git a/frontend/drupal9/web/core/modules/system/tests/modules/form_test/src/Form/FormTestGroupFieldsetForm.php b/frontend/drupal9/web/core/modules/system/tests/modules/form_test/src/Form/FormTestGroupFieldsetForm.php
index b37d6bba4..5d7d79b05 100644
--- a/frontend/drupal9/web/core/modules/system/tests/modules/form_test/src/Form/FormTestGroupFieldsetForm.php
+++ b/frontend/drupal9/web/core/modules/system/tests/modules/form_test/src/Form/FormTestGroupFieldsetForm.php
@@ -37,6 +37,10 @@ class FormTestGroupFieldsetForm extends FormBase {
'#type' => 'textfield',
'#title' => 'Nest in container element',
];
+ $form['fieldset_zero'] = [
+ '#type' => 'fieldset',
+ '#title' => 0,
+ ];
return $form;
}
diff --git a/frontend/drupal9/web/core/modules/system/tests/src/Functional/Form/ElementTest.php b/frontend/drupal9/web/core/modules/system/tests/src/Functional/Form/ElementTest.php
index dc11b2609..afd264577 100644
--- a/frontend/drupal9/web/core/modules/system/tests/src/Functional/Form/ElementTest.php
+++ b/frontend/drupal9/web/core/modules/system/tests/src/Functional/Form/ElementTest.php
@@ -144,6 +144,7 @@ class ElementTest extends BrowserTestBase {
$this->assertSession()->elementsCount('xpath', '//div[@id="edit-container"]//div[@class="details-wrapper"]//label', 1);
$this->drupalGet('form-test/group-fieldset');
$this->assertSession()->elementsCount('xpath', '//fieldset[@id="edit-fieldset"]//div[@id="edit-meta"]//label', 1);
+ $this->assertSession()->elementTextEquals('xpath', '//fieldset[@id="edit-fieldset-zero"]//legend', '0');
$this->drupalGet('form-test/group-vertical-tabs');
$this->assertSession()->elementsCount('xpath', '//div[@data-vertical-tabs-panes]//details[@id="edit-meta"]//label', 1);
$this->assertSession()->elementsCount('xpath', '//div[@data-vertical-tabs-panes]//details[@id="edit-meta-2"]//label', 1);
diff --git a/frontend/drupal9/web/core/modules/system/tests/src/Functional/Form/StubForm.php b/frontend/drupal9/web/core/modules/system/tests/src/Functional/Form/StubForm.php
index 9e20c365b..4c30673d8 100644
--- a/frontend/drupal9/web/core/modules/system/tests/src/Functional/Form/StubForm.php
+++ b/frontend/drupal9/web/core/modules/system/tests/src/Functional/Form/StubForm.php
@@ -43,7 +43,7 @@ class StubForm extends FormBase {
* {@inheritdoc}
*/
public function getFormId() {
- $this->formId;
+ return $this->formId;
}
/**
diff --git a/frontend/drupal9/web/core/modules/system/tests/src/Functional/Rest/ActionResourceTestBase.php b/frontend/drupal9/web/core/modules/system/tests/src/Functional/Rest/ActionResourceTestBase.php
index 36a3222a9..b53be1b7b 100644
--- a/frontend/drupal9/web/core/modules/system/tests/src/Functional/Rest/ActionResourceTestBase.php
+++ b/frontend/drupal9/web/core/modules/system/tests/src/Functional/Rest/ActionResourceTestBase.php
@@ -75,6 +75,7 @@ abstract class ActionResourceTestBase extends ConfigEntityResourceTestBase {
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
}
diff --git a/frontend/drupal9/web/core/modules/system/tests/src/Functional/Rest/MenuResourceTestBase.php b/frontend/drupal9/web/core/modules/system/tests/src/Functional/Rest/MenuResourceTestBase.php
index d378086e8..a30f44264 100644
--- a/frontend/drupal9/web/core/modules/system/tests/src/Functional/Rest/MenuResourceTestBase.php
+++ b/frontend/drupal9/web/core/modules/system/tests/src/Functional/Rest/MenuResourceTestBase.php
@@ -64,6 +64,7 @@ abstract class MenuResourceTestBase extends ConfigEntityResourceTestBase {
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php b/frontend/drupal9/web/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php
index 6a6081f94..d80787e5d 100644
--- a/frontend/drupal9/web/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php
+++ b/frontend/drupal9/web/core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php
@@ -415,6 +415,7 @@ class TestPathBasedBreadcrumbBuilder extends PathBasedBreadcrumbBuilder {
public function setStringTranslation(TranslationInterface $string_translation) {
$this->stringTranslation = $string_translation;
+ return $this;
}
public function setLinkGenerator(LinkGeneratorInterface $link_generator) {
diff --git a/frontend/drupal9/web/core/modules/taxonomy/tests/src/Functional/Rest/VocabularyResourceTestBase.php b/frontend/drupal9/web/core/modules/taxonomy/tests/src/Functional/Rest/VocabularyResourceTestBase.php
index 0693daf16..de8e7a580 100644
--- a/frontend/drupal9/web/core/modules/taxonomy/tests/src/Functional/Rest/VocabularyResourceTestBase.php
+++ b/frontend/drupal9/web/core/modules/taxonomy/tests/src/Functional/Rest/VocabularyResourceTestBase.php
@@ -63,6 +63,7 @@ abstract class VocabularyResourceTestBase extends ConfigEntityResourceTestBase {
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/modules/tour/tests/src/Functional/Rest/TourResourceTestBase.php b/frontend/drupal9/web/core/modules/tour/tests/src/Functional/Rest/TourResourceTestBase.php
index 40bfced3d..813505a30 100644
--- a/frontend/drupal9/web/core/modules/tour/tests/src/Functional/Rest/TourResourceTestBase.php
+++ b/frontend/drupal9/web/core/modules/tour/tests/src/Functional/Rest/TourResourceTestBase.php
@@ -94,6 +94,7 @@ abstract class TourResourceTestBase extends ConfigEntityResourceTestBase {
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/modules/user/tests/src/Functional/Rest/RoleResourceTestBase.php b/frontend/drupal9/web/core/modules/user/tests/src/Functional/Rest/RoleResourceTestBase.php
index bb090a103..0c12f123c 100644
--- a/frontend/drupal9/web/core/modules/user/tests/src/Functional/Rest/RoleResourceTestBase.php
+++ b/frontend/drupal9/web/core/modules/user/tests/src/Functional/Rest/RoleResourceTestBase.php
@@ -64,6 +64,7 @@ abstract class RoleResourceTestBase extends ConfigEntityResourceTestBase {
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
}
diff --git a/frontend/drupal9/web/core/modules/user/tests/src/Functional/UserRegistrationRestTest.php b/frontend/drupal9/web/core/modules/user/tests/src/Functional/UserRegistrationRestTest.php
index c09aa289e..401afc3a3 100644
--- a/frontend/drupal9/web/core/modules/user/tests/src/Functional/UserRegistrationRestTest.php
+++ b/frontend/drupal9/web/core/modules/user/tests/src/Functional/UserRegistrationRestTest.php
@@ -2,6 +2,7 @@
namespace Drupal\Tests\user\Functional;
+use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Test\AssertMailTrait;
use Drupal\Core\Url;
use Drupal\Tests\rest\Functional\CookieResourceTestTrait;
@@ -248,11 +249,15 @@ class UserRegistrationRestTest extends ResourceTestBase {
/**
* {@inheritdoc}
*/
- protected function getExpectedUnauthorizedAccessMessage($method) {}
+ protected function getExpectedUnauthorizedAccessMessage($method) {
+ return '';
+ }
/**
* {@inheritdoc}
*/
- protected function getExpectedUnauthorizedAccessCacheability() {}
+ protected function getExpectedUnauthorizedAccessCacheability() {
+ return new CacheableMetadata();
+ }
}
diff --git a/frontend/drupal9/web/core/modules/views/src/Tests/ViewResultAssertionTrait.php b/frontend/drupal9/web/core/modules/views/src/Tests/ViewResultAssertionTrait.php
index 09a373d40..a98c18e64 100644
--- a/frontend/drupal9/web/core/modules/views/src/Tests/ViewResultAssertionTrait.php
+++ b/frontend/drupal9/web/core/modules/views/src/Tests/ViewResultAssertionTrait.php
@@ -27,12 +27,9 @@ trait ViewResultAssertionTrait {
* @param string $message
* (optional) A custom message to display with the assertion. Defaults to
* 'Identical result set.'
- *
- * @return bool
- * TRUE if the assertion succeeded, or FALSE otherwise.
*/
- protected function assertIdenticalResultset($view, $expected_result, $column_map = [], $message = NULL) {
- return $this->assertIdenticalResultsetHelper($view, $expected_result, $column_map, 'assertIdentical', $message);
+ protected function assertIdenticalResultset($view, $expected_result, $column_map = [], $message = NULL): void {
+ $this->assertIdenticalResultsetHelper($view, $expected_result, $column_map, 'assertIdentical', $message);
}
/**
@@ -50,12 +47,9 @@ trait ViewResultAssertionTrait {
* @param string $message
* (optional) A custom message to display with the assertion. Defaults to
* 'Non-identical result set.'
- *
- * @return bool
- * TRUE if the assertion succeeded, or FALSE otherwise.
*/
- protected function assertNotIdenticalResultset($view, $expected_result, $column_map = [], $message = NULL) {
- return $this->assertIdenticalResultsetHelper($view, $expected_result, $column_map, 'assertNotIdentical', $message);
+ protected function assertNotIdenticalResultset($view, $expected_result, $column_map = [], $message = NULL): void {
+ $this->assertIdenticalResultsetHelper($view, $expected_result, $column_map, 'assertNotIdentical', $message);
}
/**
@@ -76,11 +70,8 @@ trait ViewResultAssertionTrait {
* 'assertNotIdentical').
* @param string $message
* (optional) The message to display with the assertion.
- *
- * @return bool
- * TRUE if the assertion succeeded.
*/
- protected function assertIdenticalResultsetHelper($view, $expected_result, $column_map, $assert_method, $message = NULL) {
+ protected function assertIdenticalResultsetHelper($view, $expected_result, $column_map, $assert_method, $message = NULL): void {
// Convert $view->result to an array of arrays.
$result = [];
foreach ($view->result as $key => $value) {
@@ -142,11 +133,11 @@ trait ViewResultAssertionTrait {
switch ($assert_method) {
case 'assertIdentical':
$this->assertSame($expected_result, $result, $message);
- return TRUE;
+ break;
case 'assertNotIdentical':
$this->assertNotSame($expected_result, $result, $message);
- return TRUE;
+ break;
}
}
diff --git a/frontend/drupal9/web/core/modules/views/tests/src/Functional/Rest/ViewResourceTestBase.php b/frontend/drupal9/web/core/modules/views/tests/src/Functional/Rest/ViewResourceTestBase.php
index 6c5c5d937..27ae62269 100644
--- a/frontend/drupal9/web/core/modules/views/tests/src/Functional/Rest/ViewResourceTestBase.php
+++ b/frontend/drupal9/web/core/modules/views/tests/src/Functional/Rest/ViewResourceTestBase.php
@@ -84,6 +84,7 @@ abstract class ViewResourceTestBase extends ConfigEntityResourceTestBase {
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
}
diff --git a/frontend/drupal9/web/core/modules/workflows/tests/src/Functional/Rest/WorkflowResourceTestBase.php b/frontend/drupal9/web/core/modules/workflows/tests/src/Functional/Rest/WorkflowResourceTestBase.php
index a9317f1e1..a192a419d 100644
--- a/frontend/drupal9/web/core/modules/workflows/tests/src/Functional/Rest/WorkflowResourceTestBase.php
+++ b/frontend/drupal9/web/core/modules/workflows/tests/src/Functional/Rest/WorkflowResourceTestBase.php
@@ -102,6 +102,7 @@ abstract class WorkflowResourceTestBase extends ConfigEntityResourceTestBase {
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
}
diff --git a/frontend/drupal9/web/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php b/frontend/drupal9/web/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php
index 126f8f34c..901050e22 100644
--- a/frontend/drupal9/web/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php
+++ b/frontend/drupal9/web/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php
@@ -266,7 +266,7 @@ class UncaughtExceptionTest extends BrowserTestBase {
$expected_path = \Drupal::root() . '/core/modules/system/tests/modules/error_service_test/src/MonkeysInTheControlRoom.php';
$expected_line = 62;
- $expected_entry = "Failed to log error: Exception: Deforestation in Drupal\\error_service_test\\MonkeysInTheControlRoom->handle() (line ${expected_line} of ${expected_path})";
+ $expected_entry = "Failed to log error: Exception: Deforestation in Drupal\\error_service_test\\MonkeysInTheControlRoom->handle() (line {$expected_line} of {$expected_path})";
$this->assertStringContainsString($expected_entry, $errors[0], 'Original error logged to the PHP error log when an exception is thrown by a logger');
// The exception is expected. Do not interpret it as a test failure. Not
diff --git a/frontend/drupal9/web/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideResourceTestBase.php b/frontend/drupal9/web/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideResourceTestBase.php
index 8e729b90f..4bd2f5aa1 100644
--- a/frontend/drupal9/web/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideResourceTestBase.php
+++ b/frontend/drupal9/web/core/tests/Drupal/FunctionalTests/Rest/BaseFieldOverrideResourceTestBase.php
@@ -86,6 +86,7 @@ abstract class BaseFieldOverrideResourceTestBase extends ConfigEntityResourceTes
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/tests/Drupal/FunctionalTests/Rest/DateFormatResourceTestBase.php b/frontend/drupal9/web/core/tests/Drupal/FunctionalTests/Rest/DateFormatResourceTestBase.php
index 73fb238d2..0ae1c2fb3 100644
--- a/frontend/drupal9/web/core/tests/Drupal/FunctionalTests/Rest/DateFormatResourceTestBase.php
+++ b/frontend/drupal9/web/core/tests/Drupal/FunctionalTests/Rest/DateFormatResourceTestBase.php
@@ -71,6 +71,7 @@ abstract class DateFormatResourceTestBase extends ConfigEntityResourceTestBase {
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
}
diff --git a/frontend/drupal9/web/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayResourceTestBase.php b/frontend/drupal9/web/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayResourceTestBase.php
index 44f2e6ab2..65c925320 100644
--- a/frontend/drupal9/web/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayResourceTestBase.php
+++ b/frontend/drupal9/web/core/tests/Drupal/FunctionalTests/Rest/EntityFormDisplayResourceTestBase.php
@@ -137,6 +137,7 @@ abstract class EntityFormDisplayResourceTestBase extends ConfigEntityResourceTes
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeResourceTestBase.php b/frontend/drupal9/web/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeResourceTestBase.php
index cb367bcde..93d734a7d 100644
--- a/frontend/drupal9/web/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeResourceTestBase.php
+++ b/frontend/drupal9/web/core/tests/Drupal/FunctionalTests/Rest/EntityFormModeResourceTestBase.php
@@ -69,6 +69,7 @@ abstract class EntityFormModeResourceTestBase extends ConfigEntityResourceTestBa
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
}
diff --git a/frontend/drupal9/web/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayResourceTestBase.php b/frontend/drupal9/web/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayResourceTestBase.php
index cea9928f5..51e1f2a8e 100644
--- a/frontend/drupal9/web/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayResourceTestBase.php
+++ b/frontend/drupal9/web/core/tests/Drupal/FunctionalTests/Rest/EntityViewDisplayResourceTestBase.php
@@ -95,6 +95,7 @@ abstract class EntityViewDisplayResourceTestBase extends ConfigEntityResourceTes
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeResourceTestBase.php b/frontend/drupal9/web/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeResourceTestBase.php
index 35777e02c..86876e5b6 100644
--- a/frontend/drupal9/web/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeResourceTestBase.php
+++ b/frontend/drupal9/web/core/tests/Drupal/FunctionalTests/Rest/EntityViewModeResourceTestBase.php
@@ -69,6 +69,7 @@ abstract class EntityViewModeResourceTestBase extends ConfigEntityResourceTestBa
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
+ return [];
}
}
diff --git a/frontend/drupal9/web/core/tests/Drupal/KernelTests/AssertContentTrait.php b/frontend/drupal9/web/core/tests/Drupal/KernelTests/AssertContentTrait.php
index f8a99a0ce..162704778 100644
--- a/frontend/drupal9/web/core/tests/Drupal/KernelTests/AssertContentTrait.php
+++ b/frontend/drupal9/web/core/tests/Drupal/KernelTests/AssertContentTrait.php
@@ -429,11 +429,8 @@ trait AssertContentTrait {
* in test output. Use 'Debug' to indicate this is debugging output. Do not
* translate this string. Defaults to 'Other'; most tests do not override
* this default.
- *
- * @return bool
- * TRUE on pass, FALSE on fail.
*/
- protected function assertRaw($raw, $message = '', $group = 'Other') {
+ protected function assertRaw($raw, $message = '', $group = 'Other'): void {
if (!$message) {
$message = 'Raw "' . Html::escape($raw) . '" found';
}
@@ -457,11 +454,8 @@ trait AssertContentTrait {
* in test output. Use 'Debug' to indicate this is debugging output. Do not
* translate this string. Defaults to 'Other'; most tests do not override
* this default.
- *
- * @return bool
- * TRUE on pass, FALSE on fail.
*/
- protected function assertNoRaw($raw, $message = '', $group = 'Other') {
+ protected function assertNoRaw($raw, $message = '', $group = 'Other'): void {
if (!$message) {
$message = 'Raw "' . Html::escape($raw) . '" not found';
}
@@ -485,11 +479,8 @@ trait AssertContentTrait {
* in test output. Use 'Debug' to indicate this is debugging output. Do not
* translate this string. Defaults to 'Other'; most tests do not override
* this default.
- *
- * @return bool
- * TRUE on pass, FALSE on fail.
*/
- protected function assertEscaped($raw, $message = '', $group = 'Other') {
+ protected function assertEscaped($raw, $message = '', $group = 'Other'): void {
if (!$message) {
$message = 'Escaped "' . Html::escape($raw) . '" found';
}
@@ -514,11 +505,8 @@ trait AssertContentTrait {
* in test output. Use 'Debug' to indicate this is debugging output. Do not
* translate this string. Defaults to 'Other'; most tests do not override
* this default.
- *
- * @return bool
- * TRUE on pass, FALSE on fail.
*/
- protected function assertNoEscaped($raw, $message = '', $group = 'Other') {
+ protected function assertNoEscaped($raw, $message = '', $group = 'Other'): void {
if (!$message) {
$message = 'Escaped "' . Html::escape($raw) . '" not found';
}
@@ -544,13 +532,10 @@ trait AssertContentTrait {
* translate this string. Defaults to 'Other'; most tests do not override
* this default.
*
- * @return bool
- * TRUE on pass, FALSE on fail.
- *
* @see \Drupal\simpletest\AssertContentTrait::assertRaw()
*/
- protected function assertText($text, $message = '', $group = 'Other') {
- return $this->assertTextHelper($text, $message, $group, FALSE);
+ protected function assertText($text, $message = '', $group = 'Other'): void {
+ $this->assertTextHelper($text, $message, $group, FALSE);
}
/**
@@ -572,13 +557,10 @@ trait AssertContentTrait {
* translate this string. Defaults to 'Other'; most tests do not override
* this default.
*
- * @return bool
- * TRUE on pass, FALSE on fail.
- *
* @see \Drupal\simpletest\AssertContentTrait::assertNoRaw()
*/
- protected function assertNoText($text, $message = '', $group = 'Other') {
- return $this->assertTextHelper($text, $message, $group, TRUE);
+ protected function assertNoText($text, $message = '', $group = 'Other'): void {
+ $this->assertTextHelper($text, $message, $group, TRUE);
}
/**
@@ -601,11 +583,8 @@ trait AssertContentTrait {
* @param bool $not_exists
* (optional) TRUE if this text should not exist, FALSE if it should.
* Defaults to TRUE.
- *
- * @return bool
- * TRUE on pass, FALSE on fail.
*/
- protected function assertTextHelper($text, $message = '', $group = 'Other', $not_exists = TRUE) {
+ protected function assertTextHelper($text, $message = '', $group = 'Other', $not_exists = TRUE): void {
if (!$message) {
$message = !$not_exists ? new FormattableMarkup('"@text" found', ['@text' => $text]) : new FormattableMarkup('"@text" not found', ['@text' => $text]);
}
diff --git a/frontend/drupal9/web/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/ReplaceOpTest.php b/frontend/drupal9/web/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/ReplaceOpTest.php
index 0d3ef35fd..7792034af 100644
--- a/frontend/drupal9/web/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/ReplaceOpTest.php
+++ b/frontend/drupal9/web/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Integration/ReplaceOpTest.php
@@ -39,4 +39,26 @@ class ReplaceOpTest extends TestCase {
$this->assertStringContainsString('Copy [web-root]/robots.txt from assets/robots.txt', $output);
}
+ /**
+ * @covers ::process
+ */
+ public function testEmptyFile() {
+ $fixtures = new Fixtures();
+ $destination = $fixtures->destinationPath('[web-root]/empty_file.txt');
+ $source = $fixtures->sourcePath('empty-file', 'empty_file.txt');
+ $options = ScaffoldOptions::create([]);
+ $sut = new ReplaceOp($source, TRUE);
+ // Assert that there is no target file before we run our test.
+ $this->assertFileDoesNotExist($destination->fullPath());
+ // Test the system under test.
+ $sut->process($destination, $fixtures->io(), $options);
+ // Assert that the target file was created.
+ $this->assertFileExists($destination->fullPath());
+ // Assert the target contained the contents from the correct scaffold file.
+ $this->assertSame('', file_get_contents($destination->fullPath()));
+ // Confirm that expected output was written to our io fixture.
+ $output = $fixtures->getOutput();
+ $this->assertStringContainsString('Copy [web-root]/empty_file.txt from assets/empty_file.txt', $output);
+ }
+
}
diff --git a/frontend/drupal9/web/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/fixtures/empty-file/assets/empty_file.txt b/frontend/drupal9/web/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/fixtures/empty-file/assets/empty_file.txt
new file mode 100644
index 000000000..e69de29bb
diff --git a/frontend/drupal9/web/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/fixtures/empty-file/composer.json b/frontend/drupal9/web/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/fixtures/empty-file/composer.json
new file mode 100644
index 000000000..4de438d5b
--- /dev/null
+++ b/frontend/drupal9/web/core/tests/Drupal/Tests/Composer/Plugin/Scaffold/fixtures/empty-file/composer.json
@@ -0,0 +1,10 @@
+{
+ "name": "fixtures/empty-file",
+ "extra": {
+ "drupal-scaffold": {
+ "file-mapping": {
+ "[web-root]/empty_file.txt": "assets/empty_file.txt"
+ }
+ }
+ }
+}
diff --git a/frontend/drupal9/web/core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php b/frontend/drupal9/web/core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php
index 4b66ca8c3..829d2dfa9 100644
--- a/frontend/drupal9/web/core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php
+++ b/frontend/drupal9/web/core/tests/Drupal/Tests/Core/Entity/EntityResolverManagerTest.php
@@ -515,12 +515,14 @@ class BasicForm extends FormBase {
* {@inheritdoc}
*/
public function getFormId() {
+ return '';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, EntityInterface $entity_test = NULL) {
+ return [];
}
/**
@@ -540,12 +542,14 @@ class BasicFormNoUpcasting extends FormBase {
* {@inheritdoc}
*/
public function getFormId() {
+ return '';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, $entity_test = NULL) {
+ return [];
}
/**
@@ -562,12 +566,14 @@ class BasicFormNoContainerInjectionInterface implements FormInterface {
* {@inheritdoc}
*/
public function getFormId() {
+ return '';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, EntityInterface $entity_test = NULL) {
+ return [];
}
/**
diff --git a/frontend/drupal9/web/core/tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php b/frontend/drupal9/web/core/tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php
index 7f1e27289..a857c6f25 100644
--- a/frontend/drupal9/web/core/tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php
+++ b/frontend/drupal9/web/core/tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php
@@ -385,6 +385,7 @@ class FieldDefinitionTest extends UnitTestCase {
$definition->setFieldStorageDefinition($this->storageDefinition);
return $definition;
}
+ throw new \InvalidArgumentException("Invalid factory name '$factory_name' passed to " . __METHOD__);
}
}
diff --git a/frontend/drupal9/web/core/tests/Drupal/Tests/Core/Form/FormStateTest.php b/frontend/drupal9/web/core/tests/Drupal/Tests/Core/Form/FormStateTest.php
index 9e8d552e0..e553d887c 100644
--- a/frontend/drupal9/web/core/tests/Drupal/Tests/Core/Form/FormStateTest.php
+++ b/frontend/drupal9/web/core/tests/Drupal/Tests/Core/Form/FormStateTest.php
@@ -441,7 +441,9 @@ class PrepareCallbackTestForm implements FormInterface {
return 'test_form';
}
- public function buildForm(array $form, FormStateInterface $form_state) {}
+ public function buildForm(array $form, FormStateInterface $form_state) {
+ return [];
+ }
public function validateForm(array &$form, FormStateInterface $form_state) {}
diff --git a/frontend/drupal9/web/core/tests/Drupal/Tests/Core/Image/ImageTest.php b/frontend/drupal9/web/core/tests/Drupal/Tests/Core/Image/ImageTest.php
index b2d963612..e0a15e2a8 100644
--- a/frontend/drupal9/web/core/tests/Drupal/Tests/Core/Image/ImageTest.php
+++ b/frontend/drupal9/web/core/tests/Drupal/Tests/Core/Image/ImageTest.php
@@ -116,6 +116,8 @@ class ImageTest extends UnitTestCase {
}
$this->image = new Image($this->toolkit, $this->source);
+
+ return $this->image;
}
/**
@@ -140,6 +142,8 @@ class ImageTest extends UnitTestCase {
->will($this->returnValue($this->toolkitOperation));
$this->image = new Image($this->toolkit, $this->source);
+
+ return $this->image;
}
/**
diff --git a/frontend/drupal9/web/core/tests/Drupal/Tests/Core/Plugin/LazyPluginCollectionTestBase.php b/frontend/drupal9/web/core/tests/Drupal/Tests/Core/Plugin/LazyPluginCollectionTestBase.php
index 45132288d..1cfdcd01e 100644
--- a/frontend/drupal9/web/core/tests/Drupal/Tests/Core/Plugin/LazyPluginCollectionTestBase.php
+++ b/frontend/drupal9/web/core/tests/Drupal/Tests/Core/Plugin/LazyPluginCollectionTestBase.php
@@ -86,9 +86,7 @@ abstract class LazyPluginCollectionTestBase extends UnitTestCase {
* The mock plugin object.
*/
public function returnPluginMap($plugin_id) {
- if (isset($this->pluginInstances[$plugin_id])) {
- return $this->pluginInstances[$plugin_id];
- }
+ return $this->pluginInstances[$plugin_id];
}
/**
diff --git a/frontend/drupal9/web/core/tests/TestSuites/TestSuiteBase.php b/frontend/drupal9/web/core/tests/TestSuites/TestSuiteBase.php
index 06cfc537e..bd68d3d98 100644
--- a/frontend/drupal9/web/core/tests/TestSuites/TestSuiteBase.php
+++ b/frontend/drupal9/web/core/tests/TestSuites/TestSuiteBase.php
@@ -37,8 +37,8 @@ abstract class TestSuiteBase extends TestSuite {
* SubNamespace used to separate test suite. Examples: Unit, Functional.
*/
protected function addTestsBySuiteNamespace($root, $suite_namespace) {
- // Core's tests are in the namespace Drupal\${suite_namespace}Tests\ and are
- // always inside of core/tests/Drupal/${suite_namespace}Tests. The exception
+ // Core's tests are in the namespace Drupal\{$suite_namespace}Tests\ and are
+ // always inside of core/tests/Drupal/{$suite_namespace}Tests. The exception
// to this is Unit tests for historical reasons.
if ($suite_namespace == 'Unit') {
$tests = TestDiscovery::scanDirectory("Drupal\\Tests\\", "$root/core/tests/Drupal/Tests");
@@ -50,7 +50,7 @@ abstract class TestSuiteBase extends TestSuite {
$this->addTestFiles($tests);
}
else {
- $this->addTestFiles(TestDiscovery::scanDirectory("Drupal\\${suite_namespace}Tests\\", "$root/core/tests/Drupal/${suite_namespace}Tests"));
+ $this->addTestFiles(TestDiscovery::scanDirectory("Drupal\\{$suite_namespace}Tests\\", "$root/core/tests/Drupal/{$suite_namespace}Tests"));
}
// Extensions' tests will always be in the namespace
diff --git a/frontend/drupal9/web/modules/contrib/examples/.eslintrc b/frontend/drupal9/web/modules/contrib/examples/.eslintrc
deleted file mode 100644
index 7e88b38d0..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/.eslintrc
+++ /dev/null
@@ -1,95 +0,0 @@
-{
- "extends": "eslint:recommended",
- "env": {
- "browser": true
- },
- "globals": {
- "Drupal": true,
- "drupalSettings": true,
- "drupalTranslations": true,
- "domready": true,
- "jQuery": true,
- "_": true,
- "matchMedia": true,
- "Backbone": true,
- "Modernizr": true,
- "CKEDITOR": true
- },
- "rules": {
- // Errors.
- "array-bracket-spacing": [2, "never"],
- "block-scoped-var": 2,
- "brace-style": [2, "stroustrup", {"allowSingleLine": true}],
- "comma-dangle": [2, "never"],
- "comma-spacing": 2,
- "comma-style": [2, "last"],
- "computed-property-spacing": [2, "never"],
- "curly": [2, "all"],
- "eol-last": 2,
- "eqeqeq": [2, "smart"],
- "guard-for-in": 2,
- "indent": [2, 2, {"SwitchCase": 1}],
- "key-spacing": [2, {"beforeColon": false, "afterColon": true}],
- "keyword-spacing": [2, {"before": true, "after": true}],
- "linebreak-style": [2, "unix"],
- "lines-around-comment": [2, {"beforeBlockComment": true, "afterBlockComment": false}],
- "new-parens": 2,
- "no-array-constructor": 2,
- "no-caller": 2,
- "no-catch-shadow": 2,
- "no-eval": 2,
- "no-extend-native": 2,
- "no-extra-bind": 2,
- "no-extra-parens": [2, "functions"],
- "no-implied-eval": 2,
- "no-iterator": 2,
- "no-label-var": 2,
- "no-labels": 2,
- "no-lone-blocks": 2,
- "no-loop-func": 2,
- "no-multi-spaces": 2,
- "no-multi-str": 2,
- "no-native-reassign": 2,
- "no-nested-ternary": 2,
- "no-new-func": 2,
- "no-new-object": 2,
- "no-new-wrappers": 2,
- "no-octal-escape": 2,
- "no-process-exit": 2,
- "no-proto": 2,
- "no-return-assign": 2,
- "no-script-url": 2,
- "no-sequences": 2,
- "no-shadow-restricted-names": 2,
- "no-spaced-func": 2,
- "no-trailing-spaces": 2,
- "no-undef-init": 2,
- "no-undefined": 2,
- "no-unused-expressions": 2,
- "no-unused-vars": [2, {"vars": "all", "args": "none"}],
- "no-with": 2,
- "object-curly-spacing": [2, "never"],
- "one-var": [2, "never"],
- "quote-props": [2, "consistent-as-needed"],
- "quotes": [2, "single", "avoid-escape"],
- "semi": [2, "always"],
- "semi-spacing": [2, {"before": false, "after": true}],
- "space-before-blocks": [2, "always"],
- "space-before-function-paren": [2, {"anonymous": "always", "named": "never"}],
- "space-in-parens": [2, "never"],
- "space-infix-ops": 2,
- "space-unary-ops": [2, { "words": true, "nonwords": false }],
- "spaced-comment": [2, "always"],
- "strict": 2,
- "yoda": [2, "never"],
- // Warnings.
- "max-nested-callbacks": [1, 3],
- "valid-jsdoc": [1, {
- "prefer": {
- "returns": "return",
- "property": "prop"
- },
- "requireReturn": false
- }]
- }
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/CONTRIBUTING.md b/frontend/drupal9/web/modules/contrib/examples/CONTRIBUTING.md
deleted file mode 100644
index c28f44cd1..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/CONTRIBUTING.md
+++ /dev/null
@@ -1,63 +0,0 @@
-Drupal Examples For Developers: Contributor's Guide
-===================================================
-
-Examples for Developers is a community project.
-
-If you'd like to participate in Examples development, thank you!
-
-If you are new to Drupal or open source in general, have no fear. Examples is
-an easy-going project where you can learn some things about how to work on a
-collaborative project in a friendly environment.
-
-
-Policies
---------
-
-Examples follows the Drupal core process as much as possible.
-
-Contributions thus need to be similar in quality to Drupal core patches.
-Contributions will need to meet the following minimum standards:
-
-### Normal Drupal issue process
-
-Drupal projects use patches related to issues. You should know how to make a
-patch and an interdiff using git. It's fine to develop on github or
-what-have-you, but eventually it has to be a patch that can be reviewed in the
-normal Drupal issue process. See the list of resources for some information on
-how to do this.
-
-Your patch will also need to be reviewed by someone other than yourself. Learn
-about the review process in the resources section.
-
-### DrupalCI
-
-Examples uses the Drupal automated testing system to verify the applicability of
-patches. See `TESTING.md` for details.
-
-### Drupal coding standards
-
-All code in Examples should adhere to the Drupal core coding standards. Examples
-uses the Drupal Coder project and PHP_CodeSniffer to enforce coding standards.
-Think of this as another test your code must pass. See `STANDARDS.md` for
-details.
-
-
-Resources
----------
-
-### Novice
-
-Drupal novice contribution guide: https://www.drupal.org/novice
-
-Drupal contribution guide: https://www.drupal.org/contribute
-
-What's a patch? https://www.drupal.org/patch
-
-How to make a patch with git: https://www.drupal.org/node/707484
-
-### Everyone
-
-How to review a patch: https://www.drupal.org/patch/review
-
-See `STANDARDS.md` and `TESTING.md` for information on how to run a coding
-standards test, and also how to run the tests themselves.
diff --git a/frontend/drupal9/web/modules/contrib/examples/LICENSE.txt b/frontend/drupal9/web/modules/contrib/examples/LICENSE.txt
deleted file mode 100644
index d159169d1..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/LICENSE.txt
+++ /dev/null
@@ -1,339 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- , 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.
diff --git a/frontend/drupal9/web/modules/contrib/examples/README.md b/frontend/drupal9/web/modules/contrib/examples/README.md
deleted file mode 100644
index 1e4c25b38..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/README.md
+++ /dev/null
@@ -1,79 +0,0 @@
-Examples for Developers
-=======================
-
-Project site: http://drupal.org/project/examples
-
-Code: https://drupal.org/project/examples/git-instructions
-
-Issues: https://drupal.org/project/issues/examples
-
-What Is This?
--------------
-
-This set of modules is intended to provide working examples of Drupal 8's
-features and APIs. The modules strive to be simple, well documented and
-modification friendly, in order to help developers quickly learn their inner
-workings.
-
-These examples are meant to teach you about code-level development for Drupal
-8. Some solutions might be better served using a contributed module, so that
-you don't end up having to re-invent the wheel in PHP. When in doubt, look for
-an existing contrib project that already does what you want, and contribute to
-that project.
-
-
-How To Use The Examples
------------------------
-
-There are three main ways to interact with the examples in this project:
-
-1. Enable the modules and use them within Drupal. Not all modules will have
-obvious things to see within your Drupal installation. For instance, while the
-Page and Form API examples will display forms, the Database API example does not
-have much that is visible within Drupal.
-
-2. Read the code. Much effort has gone into making the example code readable,
-not only in terms of the code itself, but also the extensive inline comments
-and documentation blocks.
-
-3. Browse the code and documentation on the web. There are two main places to
-do this:
-
-* https://api.drupal.org/api/examples is the main API site for all of Drupal.
-It has all manner of cross-linked references between the example code and the
-APIs being demonstrated. All of the Doxygen-based comments in the code are
-parsed and made browseable here.
-
-* http://drupalcode.org/project/examples.git allows you to browse the git
-repository for the Examples project.
-
-This project ships with a composer.json file. This is meant to illustrate how
-to provide a composer.json file for a Drupal contrib project. You can read more
-about how to use Composer with Drupal here: https://www.drupal.org/node/2718229
-
-How To Install The Modules
---------------------------
-
-1. The Examples project installs like any other Drupal module. There is extensive
-documentation on how to do this here:
-https://drupal.org/documentation/install/modules-themes/modules-8 But essentially:
-Download the tarball and expand it into the modules/ directory in your Drupal 8
-installation.
-
-2. Within Drupal, enable any Example sub-module you wish to explore in Admin
-menu > Extend.
-
-3. Rebuild access permissions if you are prompted to.
-
-4. Profit! The links for Examples material will appear in your Tools menu. This
-menu appears on the left sidebar by default. You'll need to reenable it if you
-removed it.
-
-Having seen the behavior of the various example modules, you can move on to
-reading the code, experimenting with it, and hopefully grasp how things work.
-
-If you find a problem, incorrect comment, obsolete or improper code or such,
-please search for an issue about it at http://drupal.org/project/issues/examples
-If there isn't already an issue for it, please create a new one.
-
-Thanks.
diff --git a/frontend/drupal9/web/modules/contrib/examples/STANDARDS.md b/frontend/drupal9/web/modules/contrib/examples/STANDARDS.md
deleted file mode 100644
index 387656a33..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/STANDARDS.md
+++ /dev/null
@@ -1,86 +0,0 @@
-Developing with Coding Standards for Examples for Developers
-============================================================
-
-Examples uses mostly the same coding standards as Drupal core.
-
-If you see a discrepancy between the coding standards tools used by core and
-those used by Examples, please file an issue so that Examples can follow core.
-
-Examples uses the `phpcs` tool to allow for checking PHP coding standards. We
-use the `drupal/coder` project for Drupal-specific coding standards.
-
-We also use `eslint` for JavaScript coding standards, and `csslint` for CSS.
-
-Examples has a `phpcs.xml.dist` file at the root of the project. phpcs uses this
-file to specify the current coding standards 'sniffs' which code in the project
-must pass.
-
-Contributors should install `phpcs` in their local Drupal installation, and then
-use that to run `phpcs` against Examples as part of their development and review
-process. (See details below on how to install and run this tool.)
-
-Contributors can also patch the `phpcs.xml.dist` file itself, in order to fix
-the codebase to pass a given rule or sniff. Patches which do this should be
-limited to a single rule or sniff, in order make the patch easier to review.
-
-Examples also uses the Coder project (`drupal/coder`), which adds additional
-Drupal-specific coding standards. We're currently locked to Coder version
-8.2.8, but this should change to reflect the state of core's coding standards.
-
-Installing phpcs
-----------------
-
-Current versions of Drupal 8 core require phpcs and Coder as dev dependencies.
-That means they're already probably installed in your core vendor/ directory.
-
-We need to tell `phpcs` to use the Drupal coding standard provided by Coder,
-because it isn't configured that way by default.
-
-Like this:
-
- $ cd my/drupal/root/
- $ ./vendor/bin/phpcs --config-set installed_paths /full/path/to/drupal/vendor/drupal/coder/coder_sniffer/
- // phpcs now knows how to find the Drupal standard. You can test it:
- $ cd core
- $ ../vendor/bin/phpcs -e --standard=Drupal
- // Shows you a bunch of Drupal-related sniffs.
-
-Running phpcs
--------------
-
-Now you can run phpcs:
-
- $ cd modules/examples
- $ ../../vendor/bin/phpcs -ps
- // phpcs uses Examples' phpcs.xml.dist to verify coding standards.
- // -p shows you progress dots.
- // -s shows you sniff errors in the report.
-
-If there are errors, they can sometimes be fixed with `phpcbf`, which is
-part of the `phpcs` package.
-
- $ ../../vendor/bin/phpcbf
- // phpcbf now performs automated fixes.
-
-Always look at the changes to see what `phpcbf` did.
-
-And always re-run `phpcs` in order to discover whether `phpcbf` handled all the
-errors.
-
-Installing eslint
------------------
-
-`eslint` is a node.js tool. You can and probably should install it globally,
-since installing it locally would add files to the examples project.
-Instructions available here: https://www.npmjs.com/package/eslint
-
-Examples has an `.eslintrc` file which defines the JavaScript coding standard.
-This file should be identical to the current Drupal core standard.
-
-Running eslint
---------------
-
-You can run eslint this way:
-
- $ cd /path/to/examples
- $ eslint .
diff --git a/frontend/drupal9/web/modules/contrib/examples/TESTING.md b/frontend/drupal9/web/modules/contrib/examples/TESTING.md
deleted file mode 100644
index d0de3b8f0..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/TESTING.md
+++ /dev/null
@@ -1,114 +0,0 @@
-Testing Drupal Examples for Developers
-======================================
-
-The Drupal Examples for Developers project uses DrupalCI testing on drupal.org.
-
-That means: It runs the testbot on every patch that is marked as 'Needs Review.'
-
-Your patch might not get reviewed, and certainly won't get committed unless it
-passes the testbot.
-
-The testbot runs a script that's in your Drupal installation called
-`core/scripts/run-tests.sh`. You can run `run-tests.sh` manually and approximate
-the testbot's behavior.
-
-You can find information on how to run `run-tests.sh` locally here:
-https://www.drupal.org/node/645286
-
-Examples is always targeted to the dev branch of Drupal core for the latest
-release. As of this writing, the latest release of Drupal core is 8.2.5, which
-means development for Examples should be against the Drupal 8.2.x development
-branch. When Drupal 8.3.0 is released, we'll start targeting Examples to 8.3.x,
-and so on.
-
-You should at least run `run-tests.sh` locally against all the changes in your
-patch before uploading it.
-
-Keep in mind that unless you know you're changing behavior that is being tested
-for, the tests are not at fault. :-)
-
-Note also that, currently, using the `phpunit` tool under Drupal 8 will not find
-PHPUnit-based tests in submodules, such as phpunit_example. There is no
-suggested workaround for this, since there is no best practice to demonstrate as
-an example. There is, however, this issue in core:
-https://www.drupal.org/node/2499239
-
-How To Run The Tests In The Drupal UI
--------------------------------------
-
-Generally, you should run tests from the command line. This is generally easier
-than using Drupal's testing UI. However, here's how you can do it that way:
-
-Enable the Testing module.
-
-Visit the test list page at `admin/config/development/testing`.
-
-Since the tests are organized by module, you can search for a module name and
-get all the tests for that module. For instance, type in 'node_type_example' for
-all the tests related to that module.
-
-Click the check boxes next to the tests you want to run. If you find this
-tedious, it's time to learn to use the command line. :-)
-
-Click 'Run Tests.' You're now running the tests.
-
-Step-by-step: How To Run The Tests.
------------------------------------
-
-Begin with an installed Drupal codebase. Make a codebase, set up the database,
-etc. Note that you can use an existing Drupal instance but the best practice is
-to start fresh. Something not working right? Try a new installation.
-
-Use the dev branch of core for the latest release of Drupal. As of this writing,
-it's 8.2.x. When Drupal 8.3.0 is released, we'll target 8.3.x.
-
-Open the terminal window and move to the root directory of the Drupal
-installation:
-
- $ cd path/to/drupal
-
-Put Examples into the `modules/` folder of the Drupal installation. If you are
-doing development on Examples, you should have already checked out the git
-repository into `modules/`, like this:
-
- $ git clone --branch 3.x https://git.drupalcode.org/project/examples.git modules/examples
-
-Now you can run `run-tests.sh`, which, despite having a `.sh` suffix is not a
-shell script. It's a PHP script.
-
-You'll use the `--directory` option to have the test runner scan the Examples
-module directory for tests.
-
-Also, importantly, if your test site has its own URL, you'll need to supply that
-with the `--url` option. For instance, under MAMP, you must specify
-`--url http://localhost:8888/`.
-
-You can also use `--concurrency` to speed up the test run, and `--browser` to
-see detailed test results in a web browser instead of just text output in the
-terminal.
-
- $ php ./core/scripts/run-tests.sh --browser --concurrency 10 --url http://localhost:8888/ --directory modules/examples
-
-This should run all the tests present in Examples. If you add a test and it
-doesn't appear in the list of tests to run, then you'll need to double-check
-that it's in the proper test namespace and that the class name (and thus the
-file name) ends in Test.
-
-What Tests Should An Example Module Have?
-------------------------------------------
-
-Examples has a checklist for each module:
-https://www.drupal.org/node/2209627
-
-The reason we care about these tests is that we want the documentation
-of these APIs to be correct. If Core changes APIs, we want our tests to
-fail so that we know our documentation is incorrect.
-
-Our list of required tests includes:
-* Functional tests which verifies a 200 result for each route/path defined by
- the module.
-* Functional tests of permission-based restrictions.
-* Functional tests which submit forms and verify that they behave as
- expected.
-* Unit tests of unit-testable code.
-* Other. More. Better.
diff --git a/frontend/drupal9/web/modules/contrib/examples/composer.json b/frontend/drupal9/web/modules/contrib/examples/composer.json
deleted file mode 100644
index 61b7434f5..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/composer.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "name": "drupal/examples",
- "description": "The Examples for Developers project aims to provide high-quality, well-documented API examples for a broad range of Drupal core functionality.",
- "type": "drupal-module",
- "homepage": "https://www.drupal.org/project/examples",
- "support": {
- "issues": "https://www.drupal.org/project/issues/examples",
- "documentation": "https://api.drupal.org/api/examples",
- "source": "https://git.drupalcode.org/project/examples"
- },
- "suggest": {
- "drupal/devel": "Some modules will be able to pretty-print PHP with this module."
- },
- "license": "GPL-2.0-or-later"
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/css/examples.icons.css b/frontend/drupal9/web/modules/contrib/examples/css/examples.icons.css
deleted file mode 100644
index da9645465..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/css/examples.icons.css
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * @file
- * Styling for the user module icons.
- */
-
-/**
- * Toolbar tab icon.
- */
-.toolbar-bar .toolbar-icon-examples:before,
-.toolbar-bar .toolbar-icon-examples:active:before,
-.toolbar-bar .toolbar-icon-examples.active:before {
- background-image: url(../images/examples.svg);
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/drupalci.yml b/frontend/drupal9/web/modules/contrib/examples/drupalci.yml
deleted file mode 100644
index 77ac4b3a3..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/drupalci.yml
+++ /dev/null
@@ -1,24 +0,0 @@
-# This is the drupalci.yml file for the Examples project.
-
-# Learn how to make your own:
-# https://www.drupal.org/drupalorg/docs/drupal-ci/customizing-drupalci-testing-for-projects
-
-# This drupalci.yml build file should almost exactly mirror the default contrib
-# build used by the testbot. We are only adding the
-# 'suppress-deprecations: false' config to the run_tests tasks. This is so we
-# can catch Drupal core deprecations early.
-build:
- assessment:
- validate_codebase:
- phplint:
- csslint:
- eslint:
- phpcs:
- testing:
- run_tests.standard:
- types: 'Simpletest,PHPUnit-Unit,PHPUnit-Kernel,PHPUnit-Functional'
- suppress-deprecations: false
- run_tests.js:
- concurrency: 1
- types: 'PHPUnit-FunctionalJavascript'
- suppress-deprecations: false
diff --git a/frontend/drupal9/web/modules/contrib/examples/examples.info.yml b/frontend/drupal9/web/modules/contrib/examples/examples.info.yml
deleted file mode 100644
index d6463bb18..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/examples.info.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-name: Examples for Developers
-type: module
-description: 'Provides example code for you to learn from.'
-package: Example modules
-core_version_requirement: ^8.7.7 || ^9
-dependencies:
- - drupal:toolbar
-
-# Information added by Drupal.org packaging script on 2021-10-07
-version: '3.0.3'
-project: 'examples'
-datestamp: 1633612832
diff --git a/frontend/drupal9/web/modules/contrib/examples/examples.libraries.yml b/frontend/drupal9/web/modules/contrib/examples/examples.libraries.yml
deleted file mode 100644
index e63351a57..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/examples.libraries.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-examples.icons:
- version: VERSION
- css:
- theme:
- css/examples.icons.css: {}
diff --git a/frontend/drupal9/web/modules/contrib/examples/examples.module b/frontend/drupal9/web/modules/contrib/examples/examples.module
deleted file mode 100644
index 9e6439e95..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/examples.module
+++ /dev/null
@@ -1,156 +0,0 @@
- $route) {
-
- // Check if module is installed or not.
- if (\Drupal::moduleHandler()->moduleExists($module)) {
-
- // Get the module info (title, description) from Drupal.
- $info = \Drupal::service('extension.list.module')->getExtensionInfo($module);
-
- // If there's no info, the example isn't enabled, so don't display it.
- if (!empty($info)) {
- $links[$module] = [
- 'title' => Html::escape($info['name']),
- 'url' => Url::fromRoute($route),
- 'attributes' => [
- 'class' => [Html::getClass($module)],
- 'title' => Html::escape($info['description']),
- ],
- ];
- }
- }
- }
-
- // Add a link to enable all examples.
- $links['enable_examples'] = [
- 'title' => t('Enable Examples'),
- 'url' => Url::fromRoute('system.modules_list'),
- 'options' => [
- 'title' => t('Enable more examples in on the Extend page.'),
- ],
- 'fragment' => 'edit-modules-example-modules',
- ];
-
- // Create the examples toolbar render array.
- $items['examples'] = [
- '#type' => 'toolbar_item',
- 'tab' => [
- '#type' => 'link',
- '#title' => t('Examples'),
- '#url' => Url::fromRoute(''),
- '#attributes' => [
- 'title' => t('Developer Examples'),
- 'class' => ['toolbar-icon', 'toolbar-icon-examples'],
- ],
- ],
- 'tray' => [
- '#heading' => t('Developer Examples'),
- 'shortcuts' => [
- '#theme' => 'links__toolbar_example',
- '#links' => $links,
- '#attributes' => [
- 'class' => ['toolbar-menu'],
- ],
- ],
- ],
- '#weight' => 99,
- '#attached' => [
- 'library' => [
- 'examples/examples.icons',
- ],
- ],
- ];
-
- return $items;
-}
-
-/**
- * Get a list of toolbar links to provide.
- *
- * We've factored this list into a function so that we can use it to test
- * toolbar routes.
- *
- * This function is for internal use.
- *
- * @return string[]
- * Keyed array of toolbar routes. Keys are the module name which supplies the
- * route.
- */
-function _examples_toolbar_routes() {
- return [
- 'ajax_example' => 'ajax_example.description',
- 'batch_example' => 'batch_example.form',
- 'block_example' => 'block_example.description',
- 'cache_example' => 'cache_example.description',
- 'config_entity_example' => 'entity.robot.list',
- 'content_entity_example' => 'entity.content_entity_example_contact.collection',
- 'cron_example' => 'cron_example.description',
- 'dbtng_example' => 'dbtng_example.generate_entry_list',
- 'email_example' => 'email_example.description',
- 'events_example' => 'events_example.description',
- 'field_example' => 'field_example.description',
- 'field_permission_example' => 'field_permission_example.description',
- //'file_example' => 'file_example.fileapi',
- 'form_api_example' => 'form_api_example.description',
- 'hooks_example' => 'hooks_example.description',
- 'js_example' => 'js_example.info',
- 'menu_example' => 'examples.menu_example',
- 'node_type_example' => 'config_node_type_example.description',
- 'page_example' => 'page_example.description',
- 'pager_example' => 'pager_example.page',
- 'phpunit_example' => 'phpunit_example.description',
- 'plugin_type_example' => 'plugin_type_example.description',
- 'queue_example' => 'queue_example.form',
- 'render_example' => 'render_example.description',
- 'session_example' => 'session_example.form',
- 'stream_wrapper_example' => 'stream_wrapper_example.description',
- 'tabledrag_example' => 'tabledrag_example.description',
- 'tablesort_example' => 'tablesort_example.description',
- 'testing_example' => 'testing_example.description',
- 'tour_example' => 'tour_example.description',
- ];
-}
-
-/**
- * @} End of 'defgroup examples'.
- */
diff --git a/frontend/drupal9/web/modules/contrib/examples/images/100x30.svg b/frontend/drupal9/web/modules/contrib/examples/images/100x30.svg
deleted file mode 100644
index 3c1b33e17..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/images/100x30.svg
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
diff --git a/frontend/drupal9/web/modules/contrib/examples/images/examples.svg b/frontend/drupal9/web/modules/contrib/examples/images/examples.svg
deleted file mode 100644
index 49e778305..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/images/examples.svg
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/action_example/action_example.info.yml b/frontend/drupal9/web/modules/contrib/examples/modules/action_example/action_example.info.yml
deleted file mode 100644
index b2fa8a4b9..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/action_example/action_example.info.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-name: 'Action example'
-type: module
-description: 'Demonstrates providing actions that can be associated to triggers.'
-package: Example modules
-core_version_requirement: ^8.7.7 || ^9
-dependencies:
- - drupal:action
- - examples:examples
-
-# Information added by Drupal.org packaging script on 2021-10-07
-version: '3.0.3'
-project: 'examples'
-datestamp: 1633612832
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/action_example/config/install/system.action.action_example_basic_action.yml b/frontend/drupal9/web/modules/contrib/examples/modules/action_example/config/install/system.action.action_example_basic_action.yml
deleted file mode 100644
index d22169b19..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/action_example/config/install/system.action.action_example_basic_action.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-id: action_example_basic_action
-label: 'An action that does nothing'
-status: true
-langcode: en
-type: system
-plugin: action_example_basic_action
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/action_example/config/schema/action_example.schema.yml b/frontend/drupal9/web/modules/contrib/examples/modules/action_example/config/schema/action_example.schema.yml
deleted file mode 100644
index a9a237b62..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/action_example/config/schema/action_example.schema.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-action.configuration.action_example_basic_action:
- type: mapping
- label: 'An action that does nothing'
- mapping:
- status:
- type: bool
- label: 'Status'
- message:
- type: text
- label: 'Message'
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/action_example/src/Plugin/Action/BasicExample.php b/frontend/drupal9/web/modules/contrib/examples/modules/action_example/src/Plugin/Action/BasicExample.php
deleted file mode 100644
index 06b7aa6c0..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/action_example/src/Plugin/Action/BasicExample.php
+++ /dev/null
@@ -1,67 +0,0 @@
-setMessenger($messenger);
- }
-
- /**
- * {@inheritDoc}
- */
- public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
- return new static(
- $configuration,
- $plugin_id,
- $plugin_definition,
- $container->get('messenger')
- );
- }
-
- /**
- * {@inheritdoc}
- */
- public function execute($object = NULL) {
- $this->messenger()->addMessage($this->t('action_example_basic_action fired'));
- }
-
- /**
- * {@inheritDoc}
- */
- public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) {
- $result = AccessResult::allowed();
- return $return_as_object ? $result : $result->isAllowed();
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/action_example/tests/src/Functional/ActionExampleTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/action_example/tests/src/Functional/ActionExampleTest.php
deleted file mode 100644
index 6a14ce8d1..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/action_example/tests/src/Functional/ActionExampleTest.php
+++ /dev/null
@@ -1,57 +0,0 @@
-drupalCreateUser(['administer actions']);
- $this->drupalLogin($admin_user);
-
- $this->drupalGet('/admin/config/system/actions');
- $this->assertSession()->pageTextContains('An action that does nothing');
-
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/ajax_example.info.yml b/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/ajax_example.info.yml
deleted file mode 100644
index 0a185159d..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/ajax_example.info.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-name: 'AJAX Example'
-type: module
-description: 'An example module showing how to use Drupal AJAX forms.'
-package: 'Example modules'
-core_version_requirement: ^8.7.7 || ^9
-dependencies:
- - drupal:node
- - examples:examples
-
-# Information added by Drupal.org packaging script on 2021-10-07
-version: '3.0.3'
-project: 'examples'
-datestamp: 1633612832
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/ajax_example.libraries.yml b/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/ajax_example.libraries.yml
deleted file mode 100644
index 4df89d8c1..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/ajax_example.libraries.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-ajax_example.library:
- version: 1.x
- css:
- base:
- css/ajax-example-base.css: {}
- js:
- js/ajax-example.js: {}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/ajax_example.links.menu.yml b/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/ajax_example.links.menu.yml
deleted file mode 100644
index b0c31d4ba..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/ajax_example.links.menu.yml
+++ /dev/null
@@ -1,72 +0,0 @@
-ajax_example.description:
- title: 'AJAX Example'
- route_name: 'ajax_example.description'
- expanded: TRUE
-
-ajax_example.simplest:
- title: 'Simplest AJAX example'
- route_name: 'ajax_example.simplest'
- parent: ajax_example.description
- weight: 0
-
-ajax_example.submit-driven:
- title: 'Submit-driven AJAX'
- route_name: 'ajax_example.submit_driven_ajax'
- parent: ajax_example.description
- weight: 1
-
-ajax_example.render-link:
- title: 'AJAX link in a render array'
- route_name: 'ajax_example.ajax_link_render'
- parent: ajax_example.description
- weight: 2
-
-ajax_example.wizard-example:
- title: 'Wizard example'
- route_name: 'ajax_example.wizard'
- parent: ajax_example.description
- weight: 2
-
-ajax_example.wizard-examplenojs:
- title: 'Wizard example w/JS turned off'
- route_name: 'ajax_example.wizardnojs'
- parent: ajax_example.description
- weight: 3
-
-ajax_example.autocomplete-user:
- title: 'Autocomplete user with entity_autocomplete'
- route_name: 'ajax_example.autocomplete_user'
- parent: ajax_example.description
- weight: 4
-
-ajax_example.autotextfields:
- title: 'Generate textfields'
- route_name: 'ajax_example.autotextfields'
- parent: ajax_example.description
- weight: 5
-
-ajax_example.dependent-dropdown:
- title: 'Dependent dropdown'
- route_name: 'ajax_example.dependent_dropdown'
- parent: ajax_example.description
- weight: 6
-ajax_example.dependent-dropdown-nojs:
- title: 'Dependent dropdown w/ no JS'
- route_name: 'ajax_example.dependent_dropdown'
- route_parameters:
- nojs: nojs
- parent: ajax_example.description
- weight: 6
-
-ajax_example.dynamic-form-sections:
- title: 'Dynamic form sections'
- route_name: 'ajax_example.dynamic_form_sections'
- parent: ajax_example.description
- weight: 10
-ajax_example.dynamic-form-sections-nojs:
- title: 'Dynamic form sections w/ no JS'
- route_name: 'ajax_example.dynamic_form_sections'
- route_parameters:
- nojs: nojs
- parent: ajax_example.description
- weight: 10
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/ajax_example.module b/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/ajax_example.module
deleted file mode 100644
index 1c2a6de0f..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/ajax_example.module
+++ /dev/null
@@ -1,23 +0,0 @@
- $this->t('
-The link below has been rendered as an element with the #ajax property, so if
-javascript is enabled, ajax.js will try to submit it via an AJAX call instead
-of a normal page load. The URL also contains the "/nojs/" magic string, which
-is stripped if javascript is enabled, allowing the server code to tell by the
-URL whether JS was enabled or not, letting it do different things based on that.'),
- ];
- // We'll add a nice border element for our demo.
- $build['ajax_link'] = [
- '#type' => 'details',
- '#title' => $this->t('This is the AJAX link'),
- '#open' => TRUE,
- ];
- // We build the AJAX link.
- $build['ajax_link']['link'] = [
- '#type' => 'link',
- '#title' => $this->t('Click me'),
- // We have to ensure that Drupal's Ajax system is loaded.
- '#attached' => ['library' => ['core/drupal.ajax']],
- // We add the 'use-ajax' class so that Drupal's AJAX system can spring
- // into action.
- '#attributes' => ['class' => ['use-ajax']],
- // The URL for this link element is the callback. In our case, it's route
- // ajax_example.ajax_link_callback, which maps to ajaxLinkCallback()
- // below. The route has a /{nojs} section, which is how the callback can
- // know whether the request was made by AJAX or some other means where
- // JavaScript won't be able to handle the result. If the {nojs} part of
- // the path is replaced with 'ajax', then the request was made by AJAX.
- '#url' => Url::fromRoute('ajax_example.ajax_link_callback', ['nojs' => 'nojs']),
- ];
- // We provide a DIV that AJAX can append some text into.
- $build['ajax_link']['destination'] = [
- '#type' => 'container',
- '#attributes' => ['id' => ['ajax-example-destination-div']],
- ];
- return $build;
- }
-
- /**
- * Callback for link example.
- *
- * Takes different logic paths based on whether Javascript was enabled.
- * If $type == 'ajax', it tells this function that ajax.js has rewritten
- * the URL and thus we are doing an AJAX and can return an array of commands.
- *
- * @param string $nojs
- * Either 'ajax' or 'nojs. Type is simply the normal URL argument to this
- * URL.
- *
- * @return string|array
- * If $type == 'ajax', returns an array of AJAX Commands.
- * Otherwise, just returns the content, which will end up being a page.
- */
- public function ajaxLinkCallback($nojs = 'nojs') {
- // Determine whether the request is coming from AJAX or not.
- if ($nojs == 'ajax') {
- $output = $this->t("This is some content delivered via AJAX");
- $response = new AjaxResponse();
- $response->addCommand(new AppendCommand('#ajax-example-destination-div', $output));
-
- // See ajax_example_advanced.inc for more details on the available
- // commands and how to use them.
- // $page = array('#type' => 'ajax', '#commands' => $commands);
- // ajax_deliver($response);
- return $response;
- }
- $response = new Response($this->t("This is some content delivered via a page load."));
- return $response;
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/src/Form/Autotextfields.php b/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/src/Form/Autotextfields.php
deleted file mode 100644
index 0c4740e3b..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/src/Form/Autotextfields.php
+++ /dev/null
@@ -1,124 +0,0 @@
- 'item',
- '#markup' => $this->t('This form demonstrates changing the status of form elements through AJAX requests.'),
- ];
- $form['ask_first_name'] = [
- '#type' => 'checkbox',
- '#title' => $this->t('Ask me my first name'),
- '#ajax' => [
- 'callback' => '::textfieldsCallback',
- 'wrapper' => 'textfields-container',
- 'effect' => 'fade',
- ],
- ];
- $form['ask_last_name'] = [
- '#type' => 'checkbox',
- '#title' => $this->t('Ask me my last name'),
- '#ajax' => [
- 'callback' => '::textfieldsCallback',
- 'wrapper' => 'textfields-container',
- 'effect' => 'fade',
- ],
- ];
-
- // Wrap textfields in a container. This container will be replaced through
- // AJAX.
- $form['textfields_container'] = [
- '#type' => 'container',
- '#attributes' => ['id' => 'textfields-container'],
- ];
- $form['textfields_container']['textfields'] = [
- '#type' => 'fieldset',
- '#title' => $this->t("Generated text fields for first and last name"),
- '#description' => $this->t('This is where we put automatically generated textfields'),
- ];
-
- // This form is rebuilt on all requests, so whether or not the request comes
- // from AJAX, we should rebuild everything based on the form state.
- // Checkbox values are expressed as 1 or 0, so we have to be sure to compare
- // type as well as value.
- if ($form_state->getValue('ask_first_name', NULL) === 1) {
- $form['textfields_container']['textfields']['first_name'] = [
- '#type' => 'textfield',
- '#title' => $this->t('First Name'),
- '#required' => TRUE,
- ];
- }
- if ($form_state->getValue('ask_last_name', NULL) === 1) {
- $form['textfields_container']['textfields']['last_name'] = [
- '#type' => 'textfield',
- '#title' => $this->t('Last Name'),
- '#required' => TRUE,
- ];
- }
-
- $form['textfields_container']['submit'] = [
- '#type' => 'submit',
- '#value' => $this->t('Click Me'),
- ];
-
- return $form;
- }
-
- /**
- * {@inheritdoc}
- */
- public function submitForm(array &$form, FormStateInterface $form_state) {
- $this->messenger()->addMessage(
- $this->t('Submit handler: First name: @first_name Last name: @last_name',
- [
- '@first_name' => $form_state->getValue('first_name', 'n/a'),
- '@last_name' => $form_state->getValue('last_name', 'n/a'),
- ]
- )
- );
- }
-
- /**
- * Callback for ajax_example_autotextfields.
- *
- * Selects the piece of the form we want to use as replacement markup and
- * returns it as a form (renderable array).
- */
- public function textfieldsCallback($form, FormStateInterface $form_state) {
- return $form['textfields_container'];
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/src/Form/DependentDropdown.php b/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/src/Form/DependentDropdown.php
deleted file mode 100644
index 3fe6cdd44..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/src/Form/DependentDropdown.php
+++ /dev/null
@@ -1,269 +0,0 @@
-
- $this->t('
Like other examples in this module, this form has a path that
- can be modified with /nojs to simulate its behavior without JavaScript.
-
-
@try_it_without_ajax
-
@try_it_with_ajax
-
',
- [
- '@try_it_without_ajax' => Link::createFromRoute(
- $this->t('Try it without AJAX'),
- 'ajax_example.dependent_dropdown', ['nojs' => 'nojs'])
- ->toString(),
- '@try_it_with_ajax' => Link::createFromRoute(
- $this->t('Try it with AJAX'),
- 'ajax_example.dependent_dropdown')
- ->toString(),
- ]
- ),
- ];
-
- // Our first dropdown lets us select a family of instruments: String,
- // Woodwind, Brass, or Percussion.
- $instrument_family_options = static::getFirstDropdownOptions();
- // When the AJAX request occurs, this form will be build in order to process
- // form state before the AJAX callback is called. We can use this
- // opportunity to populate the form as we wish based on the changes to the
- // form that caused the AJAX request. If the user caused the AJAX request,
- // then it would have been setting a value for instrument_family_options.
- // So if there's a value in that dropdown before we build it here, we grab
- // it's value to help us build the specific instrument dropdown. Otherwise
- // we can just use the value of the first item as the default value.
- if (empty($form_state->getValue('instrument_family_dropdown'))) {
- // Use a default value.
- $selected_family = key($instrument_family_options);
- }
- else {
- // Get the value if it already exists.
- $selected_family = $form_state->getValue('instrument_family_dropdown');
- }
-
- $form['instrument_family_fieldset'] = [
- '#type' => 'fieldset',
- '#title' => $this->t('Choose an instrument family'),
- ];
- $form['instrument_family_fieldset']['instrument_family_dropdown'] = [
- '#type' => 'select',
- '#title' => $this->t('Instrument Type'),
- '#options' => $instrument_family_options,
- '#default_value' => $selected_family,
- // Bind an ajax callback to the change event (which is the default for the
- // select form type) of the first dropdown. It will replace the second
- // dropdown when rebuilt.
- '#ajax' => [
- // When 'event' occurs, Drupal will perform an ajax request in the
- // background. Usually the default value is sufficient (eg. change for
- // select elements), but valid values include any jQuery event,
- // most notably 'mousedown', 'blur', and 'submit'.
- 'callback' => '::instrumentDropdownCallback',
- 'wrapper' => 'instrument-fieldset-container',
- ],
- ];
- // Since we don't know if the user has js or not, we always need to output
- // this element, then hide it with with css if javascript is enabled.
- $form['instrument_family_fieldset']['choose_family'] = [
- '#type' => 'submit',
- '#value' => $this->t('Choose'),
- '#attributes' => ['class' => ['ajax-example-hide', 'ajax-example-inline']],
- ];
- // We are using the path parameter $nojs to signal when to simulate the
- // the user turning off JavaScript. We'll remove all the AJAX elements. This
- // is not required, and is here so that we can demonstrate a graceful
- // fallback without having to turn off JavaScript.
- if ($nojs == 'nojs') {
- // Removing the #ajax element tells the system not to use AJAX.
- unset($form['instrument_family_fieldset']['instrument_family_dropdown']['#ajax']);
- // Removing the ajax-example-hide class from the Choose button ensures
- // that our JavaScript won't hide it.
- unset($form['instrument_family_fieldset']['choose_family']['#attributes']);
- }
-
- // Since we're managing state for this whole fieldset (both the dropdown
- // and enabling the Submit button), we want to replace the whole thing
- // on AJAX requests. That's why we put it in this container.
- $form['instrument_fieldset_container'] = [
- '#type' => 'container',
- '#attributes' => ['id' => 'instrument-fieldset-container'],
- ];
- // Build the instrument field set.
- $form['instrument_fieldset_container']['instrument_fieldset'] = [
- '#type' => 'fieldset',
- '#title' => $this->t('Choose an instrument'),
- ];
- $form['instrument_fieldset_container']['instrument_fieldset']['instrument_dropdown'] = [
- '#type' => 'select',
- '#title' => $instrument_family_options[$selected_family] . ' ' . $this->t('Instruments'),
- // When the form is rebuilt during ajax processing, the $selected_family
- // variable will now have the new value and so the options will change.
- '#options' => static::getSecondDropdownOptions($selected_family),
- '#default_value' => !empty($form_state->getValue('instrument_dropdown')) ? $form_state->getValue('instrument_dropdown') : '',
- ];
- $form['instrument_fieldset_container']['instrument_fieldset']['submit'] = [
- '#type' => 'submit',
- '#value' => $this->t('Submit'),
- ];
- // We might normally use #state to disable the instrument fields based on
- // the instrument family fields. But since the premise is that we don't have
- // JavaScript running, #state won't work either. We have to set up the state
- // of the instrument fieldset here, based on the selected instrument family.
- if ($selected_family == 'none') {
- $form['instrument_fieldset_container']['instrument_fieldset']['instrument_dropdown']['#title'] =
- $this->t('You must choose an instrument family.');
- $form['instrument_fieldset_container']['instrument_fieldset']['instrument_dropdown']['#disabled'] = TRUE;
- $form['instrument_fieldset_container']['instrument_fieldset']['submit']['#disabled'] = TRUE;
- }
- else {
- $form['instrument_fieldset_container']['instrument_fieldset']['instrument_dropdown']['#disabled'] = FALSE;
- $form['instrument_fieldset_container']['instrument_fieldset']['submit']['#disabled'] = FALSE;
- }
-
- return $form;
- }
-
- /**
- * {@inheritdoc}
- */
- public function submitForm(array &$form, FormStateInterface $form_state) {
- $trigger = (string) $form_state->getTriggeringElement()['#value'];
- switch ($trigger) {
- case 'Submit':
- // Submit: We're done.
- $this->messenger()->addMessage($this->t('Your values have been submitted. Instrument family: @family, Instrument: @instrument', [
- '@family' => $form_state->getValue('instrument_family_dropdown'),
- '@instrument' => $form_state->getValue('instrument_dropdown'),
- ]));
- return;
- }
- // 'Choose' or anything else will cause rebuild of the form and present
- // it again.
- $form_state->setRebuild();
- }
-
- /**
- * Provide a new dropdown based on the AJAX call.
- *
- * This callback will occur *after* the form has been rebuilt by buildForm().
- * Since that's the case, the form should contain the right values for
- * instrument_dropdown.
- *
- * @param array $form
- * An associative array containing the structure of the form.
- * @param \Drupal\Core\Form\FormStateInterface $form_state
- * The current state of the form.
- *
- * @return array
- * The portion of the render structure that will replace the
- * instrument-dropdown-replace form element.
- */
- public function instrumentDropdownCallback(array $form, FormStateInterface $form_state) {
- return $form['instrument_fieldset_container'];
- }
-
- /**
- * Helper function to populate the first dropdown.
- *
- * This would normally be pulling data from the database.
- *
- * @return array
- * Dropdown options.
- */
- public static function getFirstDropdownOptions() {
- return [
- 'none' => 'none',
- 'String' => 'String',
- 'Woodwind' => 'Woodwind',
- 'Brass' => 'Brass',
- 'Percussion' => 'Percussion',
- ];
- }
-
- /**
- * Helper function to populate the second dropdown.
- *
- * This would normally be pulling data from the database.
- *
- * @param string $key
- * This will determine which set of options is returned.
- *
- * @return array
- * Dropdown options
- */
- public static function getSecondDropdownOptions($key = '') {
- switch ($key) {
- case 'String':
- $options = [
- 'Violin' => 'Violin',
- 'Viola' => 'Viola',
- 'Cello' => 'Cello',
- 'Double Bass' => 'Double Bass',
- ];
- break;
-
- case 'Woodwind':
- $options = [
- 'Flute' => 'Flute',
- 'Clarinet' => 'Clarinet',
- 'Oboe' => 'Oboe',
- 'Bassoon' => 'Bassoon',
- ];
- break;
-
- case 'Brass':
- $options = [
- 'Trumpet' => 'Trumpet',
- 'Trombone' => 'Trombone',
- 'French Horn' => 'French Horn',
- 'Euphonium' => 'Euphonium',
- ];
- break;
-
- case 'Percussion':
- $options = [
- 'Bass Drum' => 'Bass Drum',
- 'Timpani' => 'Timpani',
- 'Snare Drum' => 'Snare Drum',
- 'Tambourine' => 'Tambourine',
- ];
- break;
-
- default:
- $options = ['none' => 'none'];
- break;
- }
- return $options;
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/src/Form/DynamicFormSections.php b/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/src/Form/DynamicFormSections.php
deleted file mode 100644
index c6d41ee16..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/src/Form/DynamicFormSections.php
+++ /dev/null
@@ -1,223 +0,0 @@
-
- $this->t('
Like other examples in this module, this form has a path that
- can be modified with /nojs to simulate its behavior without JavaScript.
-
-
@try_it_without_ajax
-
@try_it_with_ajax
-
',
- [
- '@try_it_without_ajax' => Link::createFromRoute(
- $this->t('Try it without AJAX'),
- 'ajax_example.dynamic_form_sections', ['nojs' => 'nojs'])
- ->toString(),
- '@try_it_with_ajax' => Link::createFromRoute(
- $this->t('Try it with AJAX'),
- 'ajax_example.dynamic_form_sections')
- ->toString(),
- ]
- ),
- ];
-
- $form['question_type_select'] = [
- // This is our select dropdown.
- '#type' => 'select',
- '#title' => $this->t('Question style'),
- // We have a variety of form items you can use to get input from the user.
- '#options' => [
- 'Choose question style' => 'Choose question style',
- 'Multiple Choice' => 'Multiple Choice',
- 'True/False' => 'True/False',
- 'Fill-in-the-blanks' => 'Fill-in-the-blanks',
- ],
- // The #ajax section tells the AJAX system that whenever this dropdown
- // emits an event, it should call the callback and put the resulting
- // content into the wrapper we specify. The questions-fieldset-wrapper is
- // defined below.
- '#ajax' => [
- 'wrapper' => 'questions-fieldset-wrapper',
- 'callback' => '::promptCallback',
- ],
- ];
- // The CSS for this module hides this next button if JS is enabled.
- $form['question_type_submit'] = [
- '#type' => 'submit',
- '#value' => $this->t('Choose'),
- '#attributes' => ['class' => ['ajax-example-inline']],
- // No need to validate when submitting this.
- '#limit_validation_errors' => [],
- '#validate' => [],
- ];
-
- // This section allows us to demonstrate no-AJAX use without turning off
- // javascript in the browser.
- if ($nojs != 'nojs') {
- // Allow JavaScript to hide the choose button if we're using AJAX.
- $form['question_type_submit']['#attributes']['class'][] = 'ajax-example-hide';
- }
- else {
- // Remove #ajax from the above, so it won't perform AJAX behaviors.
- unset($form['question_type_select']['#ajax']);
- }
-
- // This fieldset just serves as a container for the part of the form
- // that gets rebuilt. It has a nice line around it so you can see it.
- $form['questions_fieldset'] = [
- '#type' => 'details',
- '#title' => $this->t('Stuff will appear here'),
- '#open' => TRUE,
- // We set the ID of this fieldset to questions-fieldset-wrapper so the
- // AJAX command can replace it.
- '#attributes' => ['id' => 'questions-fieldset-wrapper'],
- ];
-
- // When the AJAX request comes in, or when the user hit 'Submit' if there is
- // no JavaScript, the form state will tell us what the user has selected
- // from the dropdown. We can look at the value of the dropdown to determine
- // which secondary form to display.
- $question_type = $form_state->getValue('question_type_select');
- if (!empty($question_type) && $question_type !== 'Choose question style') {
-
- $form['questions_fieldset']['question'] = [
- '#markup' => $this->t('Who was the first president of the U.S.?'),
- ];
-
- // Build up a secondary form, based on the type of question the user
- // chose.
- switch ($question_type) {
- case 'Multiple Choice':
- $form['questions_fieldset']['question'] = [
- '#type' => 'radios',
- '#title' => $this->t('Who was the first president of the United States'),
- '#options' => [
- 'George Bush' => 'George Bush',
- 'Adam McGuire' => 'Adam McGuire',
- 'Abraham Lincoln' => 'Abraham Lincoln',
- 'George Washington' => 'George Washington',
- ],
-
- ];
- break;
-
- case 'True/False':
- $form['questions_fieldset']['question'] = [
- '#type' => 'radios',
- '#title' => $this->t('Was George Washington the first president of the United States?'),
- '#options' => [
- 'George Washington' => 'True',
- 0 => 'False',
- ],
- '#description' => $this->t('Click "True" if you think George Washington was the first president of the United States.'),
- ];
- break;
-
- case 'Fill-in-the-blanks':
- $form['questions_fieldset']['question'] = [
- '#type' => 'textfield',
- '#title' => $this->t('Who was the first president of the United States'),
- '#description' => $this->t('Please type the correct answer to the question.'),
- ];
- break;
- }
-
- $form['questions_fieldset']['submit'] = [
- '#type' => 'submit',
- '#value' => $this->t('Submit your answer'),
- ];
- }
- return $form;
- }
-
- /**
- * Final submit handler.
- *
- * Reports what values were finally set.
- */
- public function submitForm(array &$form, FormStateInterface $form_state) {
- $messenger = $this->messenger();
- // This is only executed when a button is pressed, not when the AJAXfield
- // select is changed.
- // Now handle the case of the next, previous, and submit buttons.
- // Only submit will result in actual submission, all others rebuild.
- if ($form_state->getValue('question_type_submit') == 'Choose') {
- $form_state->setValue('question_type_select', $form_state->getUserInput()['question_type_select']);
- $form_state->setRebuild();
- }
-
- if ($form_state->getValue('submit') == 'Submit your answer') {
- $form_state->setRebuild(FALSE);
- $answer = $form_state->getValue('question');
- // Special handling for the checkbox.
- if ($answer == 1 && $form['questions_fieldset']['question']['#type'] == 'checkbox') {
- $answer = $form['questions_fieldset']['question']['#title'];
- }
- if ($answer == $this->t('George Washington')) {
- $messenger->addMessage($this->t('You got the right answer: @answer', ['@answer' => $answer]));
- }
- else {
- $messenger->addMessage($this->t('Sorry, your answer (@answer) is wrong', ['@answer' => $answer]));
- }
- return;
- }
- // Sets the form to be rebuilt after processing.
- $form_state->setRebuild();
- }
-
- /**
- * Callback for the select element.
- *
- * Since the questions_fieldset part of the form has already been built during
- * the AJAX request, we can return only that part of the form to the AJAX
- * request, and it will insert that part into questions-fieldset-wrapper.
- *
- * @param array $form
- * An associative array containing the structure of the form.
- * @param \Drupal\Core\Form\FormStateInterface $form_state
- * The current state of the form.
- *
- * @return array
- * The form structure.
- */
- public function promptCallback(array $form, FormStateInterface $form_state) {
- return $form['questions_fieldset'];
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/src/Form/EntityAutocomplete.php b/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/src/Form/EntityAutocomplete.php
deleted file mode 100644
index 5ba801d9c..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/src/Form/EntityAutocomplete.php
+++ /dev/null
@@ -1,127 +0,0 @@
-get('entity_type.manager')
- );
- $form->setStringTranslation($container->get('string_translation'));
- $form->setMessenger($container->get('messenger'));
- return $form;
- }
-
- /**
- * Constructor.
- *
- * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
- * The entity type manager service.
- */
- public function __construct(EntityTypeManagerInterface $entity_type_manager) {
- $this->entityTypeManager = $entity_type_manager;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getFormId() {
- return 'ajax_example_autocomplete_user';
- }
-
- /**
- * {@inheritdoc}
- */
- public function buildForm(array $form, FormStateInterface $form_state) {
- $form['info'] = [
- '#markup' => '
' . $this->t("This example uses the entity_autocomplete form element to select users. You'll need a few users on your system for it to make sense.") . '
',
- ];
-
- // Here we use the delightful entity_autocomplete form element. It allows us
- // to consistently select entities. See https://www.drupal.org/node/2418529.
- $form['users'] = [
- // A type of entity_autocomplete lets Drupal know it should autocomplete
- // entities.
- '#type' => 'entity_autocomplete',
- // We can specify entity types to autocomplete.
- '#target_type' => 'user',
- // Specifying #tags as TRUE allows for multiple selections, separated by
- // commas.
- '#tags' => TRUE,
- '#title' => $this->t('Choose a user (Separate with commas)'),
- ];
-
- $form['actions'] = [
- '#type' => 'actions',
- ];
- $form['actions']['submit'] = [
- '#type' => 'submit',
- '#value' => $this->t('Submit'),
- ];
-
- return $form;
- }
-
- /**
- * {@inheritdoc}
- *
- * Here we validate and signal an error if there are no users selected.
- */
- public function validateForm(array &$form, FormStateInterface $form_state) {
- $state_users = $form_state->getValue('users');
- if (empty($state_users)) {
- $form_state->setErrorByName('users', 'There were no users selected.');
- }
- }
-
- /**
- * {@inheritdoc}
- *
- * On submit, show the user the names of the users they selected.
- */
- public function submitForm(array &$form, FormStateInterface $form_state) {
- $state_users = $form_state->getValue('users');
- $users = [];
- foreach ($state_users as $state_user) {
- $uid = $state_user['target_id'];
- $users[] = $this->entityTypeManager->getStorage('user')->load($uid)->getDisplayName();
- }
- $this->messenger()->addMessage('These are your users: ' . implode(' ', $users));
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/src/Form/Simplest.php b/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/src/Form/Simplest.php
deleted file mode 100644
index 951a7f9cc..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/src/Form/Simplest.php
+++ /dev/null
@@ -1,80 +0,0 @@
- $this->t("Choose something and explain why"),
- '#type' => 'select',
- '#options' => [
- 'one' => 'one',
- 'two' => 'two',
- 'three' => 'three',
- ],
- '#ajax' => [
- // #ajax has two required keys: callback and wrapper.
- // 'callback' is a function that will be called when this element
- // changes.
- 'callback' => '::promptCallback',
- // 'wrapper' is the HTML id of the page element that will be replaced.
- 'wrapper' => 'replace-textfield-container',
- ],
- ];
-
- // The 'replace-textfield-container' container will be replaced whenever
- // 'changethis' is updated.
- $form['replace_textfield_container'] = [
- '#type' => 'container',
- '#attributes' => ['id' => 'replace-textfield-container'],
- ];
- $form['replace_textfield_container']['replace_textfield'] = [
- '#type' => 'textfield',
- '#title' => $this->t("Why"),
- ];
-
- // An AJAX request calls the form builder function for every change.
- // We can change how we build the form based on $form_state.
- $value = $form_state->getValue('changethis');
- // The getValue() method returns NULL by default if the form element does
- // not exist. It won't exist yet if we're building it for the first time.
- if ($value !== NULL) {
- $form['replace_textfield_container']['replace_textfield']['#description'] =
- $this->t("Say why you chose '@value'", ['@value' => $value]);
- }
- return $form;
- }
-
- /**
- * {@inheritdoc}
- */
- public function submitForm(array &$form, FormStateInterface $form_state) {
- // No-op. Our form doesn't need a submit handler, because the form is never
- // submitted. We add the method here so we fulfill FormInterface.
- }
-
- /**
- * Handles switching the available regions based on the selected theme.
- */
- public function promptCallback($form, FormStateInterface $form_state) {
- return $form['replace_textfield_container'];
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/src/Form/SubmitDriven.php b/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/src/Form/SubmitDriven.php
deleted file mode 100644
index 8e99f134d..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/src/Form/SubmitDriven.php
+++ /dev/null
@@ -1,73 +0,0 @@
- 'container',
- '#attributes' => ['id' => 'box-container'],
- ];
- // The box contains some markup that we can change on a submit request.
- $form['container']['box'] = [
- '#type' => 'markup',
- '#markup' => '
Initial markup for box
',
- ];
-
- $form['submit'] = [
- '#type' => 'submit',
- // The AJAX handler will call our callback, and will replace whatever page
- // element has id box-container.
- '#ajax' => [
- 'callback' => '::promptCallback',
- 'wrapper' => 'box-container',
- ],
- '#value' => $this->t('Submit'),
- ];
-
- return $form;
- }
-
- /**
- * {@inheritdoc}
- */
- public function submitForm(array &$form, FormStateInterface $form_state) {
- }
-
- /**
- * Callback for submit_driven example.
- *
- * Select the 'box' element, change the markup in it, and return it as a
- * renderable array.
- *
- * @return array
- * Renderable array (the box element)
- */
- public function promptCallback(array &$form, FormStateInterface $form_state) {
- // In most cases, it is recommended that you put this logic in form
- // generation rather than the callback. Submit driven forms are an
- // exception, because you may not want to return the form at all.
- $element = $form['container'];
- $element['box']['#markup'] = "Clicked submit ({$form_state->getValue('op')}): " . date('c');
- return $element;
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/src/Form/Wizard.php b/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/src/Form/Wizard.php
deleted file mode 100644
index 787d63063..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/src/Form/Wizard.php
+++ /dev/null
@@ -1,231 +0,0 @@
-setStringTranslation($container->get('string_translation'));
- $form->setMessenger($container->get('messenger'));
- return $form;
- }
-
- /**
- * {@inheritdoc}
- */
- public function buildForm(array $form, FormStateInterface $form_state, $no_js_use = FALSE) {
- $url = Url::fromUri('internal:/examples/ajax-example/wizard-nojs');
- $link = Link::fromTextAndUrl($this->t('examples/ajax-example/wizard-nojs'), $url)
- ->toString();
-
- // Prepare link for multiple arguments.
- $urltwo = Url::fromUri('internal:/examples/ajax-example/wizard');
- $linktwo = Link::fromTextAndUrl($this->t('examples/ajax-example/wizard'), $urltwo)
- ->toString();
-
- // We want to deal with hierarchical form values.
- $form['#tree'] = TRUE;
- $form['description'] = [
- '#markup' => $this->t('This example is a step-by-step wizard. The @link does it without page reloads; the @link1 is the same code but simulates a non-javascript environment, showing it with page reloads.', [
- '@link' => $linktwo,
- '@link1' => $link,
- ]),
- ];
-
- $form['step'] = [
- '#type' => 'value',
- '#value' => !empty($form_state->getValue('step')) ? $form_state->getValue('step') : 1,
- ];
-
- switch ($form['step']['#value']) {
- case 1:
- $limit_validation_errors = [['step']];
- $form['step1'] = [
- '#type' => 'fieldset',
- '#title' => $this->t('Step 1: Personal details'),
- ];
- $form['step1']['name'] = [
- '#type' => 'textfield',
- '#title' => $this->t('Your name'),
- '#default_value' => $form_state->hasValue(['step1', 'name']) ? $form_state->getValue(['step1', 'name']) : '',
- '#required' => TRUE,
- ];
- break;
-
- case 2:
- $limit_validation_errors = [['step'], ['step1']];
- $form['step1'] = [
- '#type' => 'value',
- '#value' => $form_state->getValue('step1'),
- ];
- $form['step2'] = [
- '#type' => 'fieldset',
- '#title' => $this->t('Step 2: Street address info'),
- ];
- $form['step2']['address'] = [
- '#type' => 'textfield',
- '#title' => $this->t('Your street address'),
- '#default_value' => $form_state->hasValue(['step2', 'address']) ? $form_state->getValue(['step2', 'address']) : '',
- '#required' => TRUE,
- ];
- break;
-
- case 3:
- $limit_validation_errors = [['step'], ['step1'], ['step2']];
- $form['step1'] = [
- '#type' => 'value',
- '#value' => $form_state->getValue('step1'),
- ];
- $form['step2'] = [
- '#type' => 'value',
- '#value' => $form_state->getValue('step2'),
- ];
- $form['step3'] = [
- '#type' => 'fieldset',
- '#title' => $this->t('Step 3: City info'),
- ];
- $form['step3']['city'] = [
- '#type' => 'textfield',
- '#title' => $this->t('Your city'),
- '#default_value' => $form_state->hasValue(['step3', 'city']) ? $form_state->getValue(['step3', 'city']) : '',
- '#required' => TRUE,
- ];
- break;
-
- default:
- $limit_validation_errors = [];
- }
-
- $form['actions'] = ['#type' => 'actions'];
- if ($form['step']['#value'] > 1) {
- $form['actions']['prev'] = [
- '#type' => 'submit',
- '#value' => $this->t('Previous step'),
- '#limit_validation_errors' => $limit_validation_errors,
- '#submit' => ['::prevSubmit'],
- '#ajax' => [
- 'wrapper' => 'ajax-example-wizard-wrapper',
- 'callback' => '::prompt',
- ],
- ];
- }
- if ($form['step']['#value'] != 3) {
- $form['actions']['next'] = [
- '#type' => 'submit',
- '#value' => $this->t('Next step'),
- '#submit' => ['::nextSubmit'],
- '#ajax' => [
- 'wrapper' => 'ajax-example-wizard-wrapper',
- 'callback' => '::prompt',
- ],
- ];
- }
- if ($form['step']['#value'] == 3) {
- $form['actions']['submit'] = [
- '#type' => 'submit',
- '#value' => $this->t("Submit your information"),
- ];
- }
-
- // This simply allows us to demonstrate no-javascript use without
- // actually turning off javascript in the browser. Removing the #ajax
- // element turns off AJAX behaviors on that element and as a result
- // ajax.js doesn't get loaded.
- // For demonstration only! You don't need this.
- if ($no_js_use) {
- // Remove the #ajax from the above, so ajax.js won't be loaded.
- // For demonstration only.
- unset($form['actions']['next']['#ajax']);
- unset($form['actions']['prev']['#ajax']);
- }
-
- $form['#prefix'] = '
';
- $form['#suffix'] = '
';
-
- return $form;
- }
-
- /**
- * Wizard callback function.
- *
- * @param array $form
- * Form API form.
- * @param \Drupal\Core\Form\FormStateInterface $form_state
- * Form API form.
- *
- * @return array
- * Form array.
- */
- public function prompt(array $form, FormStateInterface $form_state) {
- return $form;
- }
-
- /**
- * Ajax callback that moves the form to the next step and rebuild the form.
- *
- * @param array $form
- * The Form API form.
- * @param \Drupal\Core\Form\FormStateInterface $form_state
- * The FormState object.
- *
- * @return array
- * The Form API form.
- */
- public function nextSubmit(array $form, FormStateInterface $form_state) {
- $form_state->setValue('step', $form_state->getValue('step') + 1);
- $form_state->setRebuild();
- return $form;
- }
-
- /**
- * Ajax callback that moves the form to the previous step.
- *
- * @param array $form
- * The Form API form.
- * @param \Drupal\Core\Form\FormStateInterface $form_state
- * The FormState object.
- *
- * @return array
- * The Form API form.
- */
- public function prevSubmit(array $form, FormStateInterface $form_state) {
- $form_state->setValue('step', $form_state->getValue('step') - 1);
- $form_state->setRebuild();
- return $form;
- }
-
- /**
- * Save away the current information.
- */
- public function submitForm(array &$form, FormStateInterface $form_state) {
- $messenger = $this->messenger();
- $messenger->addMessage($this->t('Your information has been submitted:'));
- $messenger->addMessage($this->t('Name: @name', ['@name' => $form_state->getValue(['step1', 'name'])]));
- $messenger->addMessage($this->t('Address: @address', ['@address' => $form_state->getValue(['step2', 'address'])]));
- $messenger->addMessage($this->t('City: @city', ['@city' => $form_state->getValue(['step3', 'city'])]));
-
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/templates/description.html.twig b/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/templates/description.html.twig
deleted file mode 100644
index 76ed8e5f8..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/templates/description.html.twig
+++ /dev/null
@@ -1,29 +0,0 @@
-{#
-
-Description text for the Ajax Example.
-
-#}
-
-{% set simple_ajax_example = path('ajax_example.simplest') %}
-{% set ajax_generate_textfields = path('ajax_example.autotextfields') %}
-{% set ajax_submit = path('ajax_example.submit_driven_ajax') %}
-{% set ajax_dependent_dropdown = path('ajax_example.dependent_dropdown') %}
-{% set ajax_dependent_dropdown_nojs = path('ajax_example.dependent_dropdown', {'nojs': 'nojs'}) %}
-{% set ajax_dynamic_form = path('ajax_example.dynamic_form_sections') %}
-{% set ajax_dynamic_form_nojs = path('ajax_example.dynamic_form_sections', {'nojs': 'nojs'}) %}
-{% set ajax_wizard_example = path('ajax_example.wizard') %}
-{% set ajax_wizard_example_nojs = path('ajax_example.wizardnojs') %}
-
-{% trans %}
-
-
The AJAX example module provides many examples of AJAX including forms, links, and AJAX commands.
-{% endtrans %}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/tests/src/Functional/AjaxExampleMenuTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/tests/src/Functional/AjaxExampleMenuTest.php
deleted file mode 100644
index 779e146c1..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/tests/src/Functional/AjaxExampleMenuTest.php
+++ /dev/null
@@ -1,87 +0,0 @@
-drupalLogin(
- $this->createUser(['access content', 'access user profiles'])
- );
-
- $assertion = $this->assertSession();
-
- // Routes with menu links, and their form buttons.
- $routes_with_menu_links = [
- 'ajax_example.description' => [],
- 'ajax_example.simplest' => [],
- 'ajax_example.autotextfields' => ['Click Me'],
- 'ajax_example.submit_driven_ajax' => ['Submit'],
- 'ajax_example.dependent_dropdown' => ['Submit'],
- 'ajax_example.dynamic_form_sections' => ['Choose'],
- 'ajax_example.wizard' => ['Next step'],
- 'ajax_example.wizardnojs' => ['Next step'],
- 'ajax_example.ajax_link_render' => [],
- 'ajax_example.autocomplete_user' => ['Submit'],
- ];
-
- // Ensure the links appear in the tools menu sidebar.
- $this->drupalGet('');
- foreach (array_keys($routes_with_menu_links) as $route) {
- $assertion->linkByHrefExists(Url::fromRoute($route)->getInternalPath());
- }
-
- // All our routes with their form buttons.
- $routes = [
- 'ajax_example.ajax_link_callback' => [],
- ];
-
- // Go to all the routes and click all the buttons.
- $routes = array_merge($routes_with_menu_links, $routes);
- foreach ($routes as $route => $buttons) {
- $url = Url::fromRoute($route);
- if ($route === 'ajax_example.ajax_link_callback') {
- $url = Url::fromRoute($route, ['nojs' => 'nojs']);
- }
- $this->drupalGet($url);
- $assertion->statusCodeEquals(200);
- foreach ($buttons as $button) {
- $this->drupalPostForm($url, [], $button);
- $assertion->statusCodeEquals(200);
- }
- }
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/tests/src/Functional/DependentDropdownTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/tests/src/Functional/DependentDropdownTest.php
deleted file mode 100644
index 94c3e3a79..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/tests/src/Functional/DependentDropdownTest.php
+++ /dev/null
@@ -1,79 +0,0 @@
-getSession();
- $assert = $this->assertSession();
- $page = $session->getPage();
-
- // Get a URL object for the form, specifying no JS.
- $dropdown_url = Url::fromRoute('ajax_example.dependent_dropdown', ['nojs' => 'nojs']);
-
- // Get the form.
- $this->drupalGet($dropdown_url);
- // Check for the initial state.
- $assert->fieldDisabled('instrument_dropdown');
- $assert->fieldValueEquals('instrument_dropdown', 'none');
- $submit_button = $page->findButton('edit-submit');
- $this->assertTrue($submit_button->hasAttribute('disabled'));
-
- // Run through the matrix of form submissions.
- $families = [
- 'String' => ['Violin', 'Viola', 'Cello', 'Double Bass'],
- 'Woodwind' => ['Flute', 'Clarinet', 'Oboe', 'Bassoon'],
- 'Brass' => ['Trumpet', 'Trombone', 'French Horn', 'Euphonium'],
- 'Percussion' => ['Bass Drum', 'Timpani', 'Snare Drum', 'Tambourine'],
- ];
-
- foreach ($families as $family => $instruments) {
- // Post the form for the instrument family.
- $this->drupalPostForm($dropdown_url, ['instrument_family_dropdown' => $family], 'Choose');
- // Get the instrument dropdown elements.
- $instrument_options = $page->findAll('css', '#edit-instrument-dropdown option');
- $this->assertCount(count($instruments), $instrument_options);
- // Make sure all the instruments are in the select dropdown.
- foreach ($instrument_options as $instrument) {
- $this->assertContains($instrument->getAttribute('value'), $instruments);
- }
- // Post each instrument. We have to 'choose' again in order to unlock the
- // instrument dropdown.
- foreach ($instruments as $instrument) {
- $this->drupalPostForm($dropdown_url, ['instrument_family_dropdown' => $family], 'Choose');
- $this->drupalPostForm(NULL, ['instrument_dropdown' => $instrument], 'Submit');
- $assert->pageTextContains("Your values have been submitted. Instrument family: $family, Instrument: $instrument");
- }
- }
-
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/tests/src/Functional/DynamicFormSectionsTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/tests/src/Functional/DynamicFormSectionsTest.php
deleted file mode 100644
index 477011e65..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/tests/src/Functional/DynamicFormSectionsTest.php
+++ /dev/null
@@ -1,75 +0,0 @@
-assertSession();
- $page = $this->getSession()->getPage();
-
- // Get a URL object for the form, specifying no JS.
- $dropdown_url = Url::fromRoute('ajax_example.dynamic_form_sections', ['nojs' => 'nojs']);
-
- // Get the form.
- $this->drupalGet($dropdown_url);
- // Check for the initial state.
- $detail_children = $page->findAll('css', 'div.details-wrapper *');
- $this->assertEmpty($detail_children);
-
- // Go through the dropdown options. First outlier is 'Choose question style'
- // which should have an empty details section.
- $this->drupalPostForm($dropdown_url, ['question_type_select' => 'Choose question style'], 'Choose');
- $detail_children = $page->findAll('css', 'div.details-wrapper *');
- $this->assertEqual(count($detail_children), 0);
-
- // Cycle through the other dropdown values.
- $question_styles = [
- 'Multiple Choice',
- 'True/False',
- 'Fill-in-the-blanks',
- ];
- // These all add stuff to the details wrapper.
- foreach ($question_styles as $question_style) {
- $this->drupalPostForm($dropdown_url, ['question_type_select' => $question_style], 'Choose');
- $detail_children = $page->findAll('css', 'div.details-wrapper *');
- $this->assertNotEqual($this->count($detail_children), 0);
- $this->drupalPostForm(NULL, ['question' => 'George Washington'], 'Submit your answer');
- $assert->pageTextContains('You got the right answer: George Washington');
- }
- // One wrong answer to exercise that code path.
- $this->drupalPostForm($dropdown_url, ['question_type_select' => 'Multiple Choice'], 'Choose');
- $detail_children = $page->findAll('css', 'div.details-wrapper *');
- $this->assertNotEqual($this->count($detail_children), 0);
- $this->drupalPostForm(NULL, ['question' => 'Abraham Lincoln'], 'Submit your answer');
- $assert->pageTextContains('Sorry, your answer (Abraham Lincoln) is wrong');
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/tests/src/FunctionalJavascript/AjaxWizardTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/tests/src/FunctionalJavascript/AjaxWizardTest.php
deleted file mode 100644
index 8d4d895d4..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/tests/src/FunctionalJavascript/AjaxWizardTest.php
+++ /dev/null
@@ -1,129 +0,0 @@
-getSession();
- $page = $session->getPage();
- $assert = $this->assertSession();
-
- // Get the page.
- $form_url = Url::fromRoute('ajax_example.wizard');
- $this->drupalGet($form_url);
-
- // Check our initial state.
- $assert->fieldExists('name');
- $assert->fieldNotExists('address');
- $assert->fieldNotExists('city');
- $assert->buttonExists('Next step');
- $assert->buttonNotExists('Previous step');
- $assert->buttonNotExists('Submit your information');
-
- // We fill the name at first step and continue with the second step.
- $page->fillField('name', 'José Saramago');
- $page->pressButton('Next step');
- $assert->assertWaitOnAjaxRequest();
-
- // Check the state of the second step.
- $assert->fieldExists('address');
- $assert->fieldNotExists('name');
- $assert->fieldNotExists('city');
- $assert->buttonExists('Next step');
- $assert->buttonExists('Previous step');
- $assert->buttonNotExists('Submit your information');
-
- // We fill the address at the second step and continue with the last step.
- $page->fillField('address', 'Rua dos Bacalhoeiros, 10');
- $page->pressButton('Next step');
- $assert->assertWaitOnAjaxRequest();
-
- // Check the state of the third step.
- $assert->fieldExists('city');
- $assert->fieldNotExists('name');
- $assert->fieldNotExists('address');
- $assert->buttonNotExists('Next step');
- $assert->buttonExists('Previous step');
- $assert->buttonExists('Submit your information');
-
- // We fill the city at the third step and we finally submit the form.
- $page->fillField('city', 'Lisboa');
- $page->pressButton('Submit your information');
-
- // We check the output and assert that the already set values are displayed.
- $assert->pageTextContains('Your information has been submitted:');
- $assert->pageTextContains('Name: José Saramago');
- $assert->pageTextContains('Address: Rua dos Bacalhoeiros, 10');
- $assert->pageTextContains('City: Lisboa');
- }
-
- /**
- * Test that the previous values are correctly displayed.
- *
- * If we move back to previous steps the already set values should be
- * displayed.
- */
- public function testWizardPreviousStepsValues() {
- // Get our Mink stuff.
- $session = $this->getSession();
- $page = $session->getPage();
- $assert = $this->assertSession();
-
- // Get the page.
- $form_url = Url::fromRoute('ajax_example.wizard');
- $this->drupalGet($form_url);
-
- // We fill the first step and continue.
- $page->fillField('name', 'José Saramago');
- $page->pressButton('Next step');
- $assert->assertWaitOnAjaxRequest();
-
- // We fill the second step and continue with the last step.
- $page->fillField('address', 'Rua dos Bacalhoeiros, 10');
- $page->pressButton('Next step');
- $assert->assertWaitOnAjaxRequest();
-
- // We fill the third step and we finally submit the form.
- $page->fillField('city', 'Lisboa');
-
- // Now we move back to previous steps and check that the values are still
- // there.
- $page->pressButton('Previous step');
- $assert->assertWaitOnAjaxRequest();
-
- $assert->fieldValueEquals('address', 'Rua dos Bacalhoeiros, 10');
- $page->pressButton('Previous step');
- $assert->assertWaitOnAjaxRequest();
-
- $assert->fieldValueEquals('name', 'José Saramago');
-
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/tests/src/FunctionalJavascript/AutotextfieldsTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/tests/src/FunctionalJavascript/AutotextfieldsTest.php
deleted file mode 100644
index 23cdcc820..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/tests/src/FunctionalJavascript/AutotextfieldsTest.php
+++ /dev/null
@@ -1,85 +0,0 @@
-getSession();
- $page = $session->getPage();
- $assert = $this->assertSession();
-
- // Get the page.
- $form_url = Url::fromRoute('ajax_example.autotextfields');
- $this->drupalGet($form_url);
-
- // Check our initial state.
- $assert->checkboxNotChecked('ask_first_name');
- $assert->checkboxNotChecked('ask_last_name');
- $assert->fieldNotExists('first_name');
- $assert->fieldNotExists('last_name');
- // Submit the form. This tests what happens when there are no user
- // interactions because drupalPostForm() reloads the form.
- $this->drupalPostForm($form_url, [], 'Click Me');
- $assert->pageTextContains('Submit handler: First name: n/a Last name: n/a');
-
- // Ask for the first name.
- $page->checkField('ask_first_name');
- $assert->assertWaitOnAjaxRequest();
- $assert->fieldExists('first_name');
- $assert->fieldNotExists('last_name');
- // Submit the form. We have to find the field and set its value rather than
- // use drupalPostForm(), because when we post the form, it will be rebuilt.
- // We are testing the form state after AJAX has modified it, so we must
- // preserve that.
- $page->fillField('first_name', 'Dries');
- $page->pressButton('Click Me');
- $assert->pageTextContains('Submit handler: First name: Dries Last name: n/a');
-
- // Ask for the first and last name.
- $page->checkField('ask_first_name');
- $assert->assertWaitOnAjaxRequest();
- $assert->fieldExists('first_name');
- $page->checkField('ask_last_name');
- $assert->assertWaitOnAjaxRequest();
- $assert->fieldExists('last_name');
- // Submit the form.
- $page->fillField('first_name', 'Dries');
- $page->fillField('last_name', 'Buytaert');
- $page->pressButton('Click Me');
- $assert->pageTextContains('Submit handler: First name: Dries Last name: Buytaert');
-
- // Ask for only the last name.
- $page->checkField('ask_last_name');
- $assert->assertWaitOnAjaxRequest();
- $assert->fieldNotExists('first_name');
- $assert->fieldExists('last_name');
- // Submit the form.
- $page->fillField('last_name', 'Buytaert');
- $page->pressButton('Click Me');
- $assert->pageTextContains('Submit handler: First name: n/a Last name: Buytaert');
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/tests/src/FunctionalJavascript/DependentDropdownTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/tests/src/FunctionalJavascript/DependentDropdownTest.php
deleted file mode 100644
index 2488b83b3..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/tests/src/FunctionalJavascript/DependentDropdownTest.php
+++ /dev/null
@@ -1,80 +0,0 @@
-assertSession();
- $page = $this->getSession()->getPage();
-
- // Get a URL object for the form, specifying AJAX.
- $dropdown_url = Url::fromRoute('ajax_example.dependent_dropdown', ['nojs' => 'ajax']);
-
- // Get the form.
- $this->drupalGet($dropdown_url);
- // Check for the initial state.
- $assert->fieldDisabled('instrument_dropdown');
- $assert->fieldValueEquals('instrument_dropdown', 'none');
- $submit_button = $page->findButton('edit-submit');
- $this->assertTrue($submit_button->hasAttribute('disabled'));
-
- // Run through the matrix of families.
- $families = [
- 'String' => ['Violin', 'Viola', 'Cello', 'Double Bass'],
- 'Woodwind' => ['Flute', 'Clarinet', 'Oboe', 'Bassoon'],
- 'Brass' => ['Trumpet', 'Trombone', 'French Horn', 'Euphonium'],
- 'Percussion' => ['Bass Drum', 'Timpani', 'Snare Drum', 'Tambourine'],
- ];
-
- foreach ($families as $family => $instruments) {
- // Select a family.
- $family_dropdown = $assert->fieldExists('instrument_family_dropdown');
- $family_dropdown->setValue($family);
- $assert->assertWaitOnAjaxRequest();
-
- // Get the instrument dropdown elements.
- $instrument_options = $page->findAll('css', 'select[name="instrument_dropdown"] option');
- $this->assertCount(count($instruments), $instrument_options);
- // Make sure all the instruments are in the select dropdown.
- foreach ($instrument_options as $instrument) {
- $this->assertContains($instrument->getAttribute('value'), $instruments);
- }
-
- // Post each instrument.
- foreach ($instruments as $instrument) {
- $this->drupalGet($dropdown_url);
- $family_dropdown->setValue($family);
- $assert->assertWaitOnAjaxRequest();
- $this->drupalPostForm(NULL, ['instrument_dropdown' => $instrument], 'Submit');
- $assert->pageTextContains("Your values have been submitted. Instrument family: $family, Instrument: $instrument");
- }
- }
-
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/tests/src/FunctionalJavascript/DynamicFormSectionsTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/tests/src/FunctionalJavascript/DynamicFormSectionsTest.php
deleted file mode 100644
index 64161b3a3..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/tests/src/FunctionalJavascript/DynamicFormSectionsTest.php
+++ /dev/null
@@ -1,72 +0,0 @@
-assertSession();
- $page = $this->getSession()->getPage();
-
- // Get a URL object for the form, specifying no JS.
- $dropdown_url = Url::fromRoute('ajax_example.dynamic_form_sections', ['nojs' => 'ajax']);
-
- // Get the form.
- $this->drupalGet($dropdown_url);
- // Check for the initial state.
- $this->assertEmpty($page->findAll('css', 'div.details-wrapper *'));
-
- // Cycle through the other dropdown values.
- $question_styles = [
- 'Multiple Choice',
- 'True/False',
- 'Fill-in-the-blanks',
- ];
-
- // Check expectations against the details wrapper.
- $question_type_dropdown = $page->findField('question_type_select');
- foreach ($question_styles as $question_style) {
- $question_type_dropdown->setValue($question_style);
- $assert->assertWaitOnAjaxRequest();
- $this->assertNotEmpty($page->findAll('css', 'div.details-wrapper *'));
- }
- // Prompt to choose question should remove the question.
- $question_type_dropdown->setValue('Choose question style');
- $assert->assertWaitOnAjaxRequest();
- $this->assertEmpty($page->findAll('css', 'div.details-wrapper *'));
-
- // Submit the correct answers.
- foreach ($question_styles as $question_style) {
- $this->drupalGet($dropdown_url);
- $question_type_dropdown->setValue($question_style);
- $assert->assertWaitOnAjaxRequest();
- $this->drupalPostForm(NULL, ['question' => 'George Washington'], 'Submit your answer');
- $assert->pageTextContains('You got the right answer: George Washington');
- }
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/tests/src/FunctionalJavascript/EntityAutocompleteTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/tests/src/FunctionalJavascript/EntityAutocompleteTest.php
deleted file mode 100644
index 250839436..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/tests/src/FunctionalJavascript/EntityAutocompleteTest.php
+++ /dev/null
@@ -1,79 +0,0 @@
-createUser([], $name);
- }
-
- // Get our various Mink elements.
- $assert = $this->assertSession();
- $session = $this->getSession();
- $page = $session->getPage();
- // We'll be using the users field quite a bit, so let's make it a variable.
- $users_field_id = 'edit-users';
-
- // Get the form.
- $this->drupalGet(Url::fromRoute('ajax_example.autocomplete_user'));
- // Examine the DOM to make sure our change hasn't happened yet.
- $assert->fieldValueEquals($users_field_id, '');
-
- // Send an event to the DOM. This will start the autocomplete process.
- $autocomplete_field = $page->findById($users_field_id);
- // We can cause the autocomplete to happen by setting the value in the
- // element.
- $autocomplete_field->setValue('b');
- $this->getSession()->getDriver()->keyDown($autocomplete_field->getXpath(), ' ');
-
- // Wait for the autocomplete request to complete. Our code is much quicker
- // than the request time.
- $assert->waitOnAutocomplete();
-
- // Examine the DOM to see if our expected change happened.
- $results = $page->findAll('css', '.ui-autocomplete li');
- $this->assertCount(2, $results);
- foreach ($results as $result) {
- $this->assertContains($result->getText(), $names);
- }
-
- // Submit to see if our form processed the user properly.
- $autocomplete_field->blur();
- $this->submitForm([$users_field_id => 'bb, bc'], 'Submit');
- $assert->pageTextContains('These are your users: bb bc');
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/tests/src/FunctionalJavascript/SimplestTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/tests/src/FunctionalJavascript/SimplestTest.php
deleted file mode 100644
index c46668caf..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/tests/src/FunctionalJavascript/SimplestTest.php
+++ /dev/null
@@ -1,70 +0,0 @@
-drupalGet(Url::fromRoute('ajax_example.simplest'));
-
- // Get our Mink stuff.
- $page = $this->getSession()->getPage();
- $assert = $this->assertSession();
-
- // Don't repeat ourselves. This makes it easier if we change the markup
- // later.
- $description_selector = '#replace-textfield-container div.description';
-
- // Check our initial state.
- $assert->elementExists('css', '#replace-textfield-container');
- $assert->elementNotExists('css', $description_selector);
-
- // Cause events by changing the value of the dropdown for all the different
- // values. Start with three so the change event is triggered.
- foreach (['three', 'two', 'one'] as $value) {
- // Select the dropdown value.
- $page->selectFieldOption('changethis', $value);
- // Wait for AJAX to happen.
- $assert->assertWaitOnAjaxRequest();
- // Assert that the description exists.
- $assert->elementExists('css', $description_selector);
- // Get the description element from the page.
- $prompt_element = $page->find('css', $description_selector);
- // Verify that the prompt text changes when the dropdown changes.
- $this->assertEquals(
- "Say why you chose '$value'",
- $prompt_element->getText()
- );
- }
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/tests/src/FunctionalJavascript/SubmitDrivenTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/tests/src/FunctionalJavascript/SubmitDrivenTest.php
deleted file mode 100644
index fa4deb254..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/ajax_example/tests/src/FunctionalJavascript/SubmitDrivenTest.php
+++ /dev/null
@@ -1,50 +0,0 @@
-assertSession();
- // Get the page.
- $this->drupalGet(Url::fromRoute('ajax_example.submit_driven_ajax'));
- // Examine the DOM to make sure our change hasn't happened yet.
- $assert->pageTextNotContains('Clicked submit (Submit):');
- // Submit the form.
- $this->submitForm([], 'Submit');
- // Wait on the AJAX request.
- $assert->assertWaitOnAjaxRequest();
- // Compare DOM to our expectations.
- $assert->pageTextContains('Clicked submit (Submit):');
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/batch_example/batch_example.info.yml b/frontend/drupal9/web/modules/contrib/examples/modules/batch_example/batch_example.info.yml
deleted file mode 100644
index 74f9e359e..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/batch_example/batch_example.info.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-name: Batch Example
-type: module
-description: An example outlining how a module can define batch operations.
-package: Example modules
-core_version_requirement: ^8.7.7 || ^9
-dependencies:
- - examples:examples
- - drupal:toolbar
-
-# Information added by Drupal.org packaging script on 2021-10-07
-version: '3.0.3'
-project: 'examples'
-datestamp: 1633612832
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/batch_example/batch_example.install b/frontend/drupal9/web/modules/contrib/examples/modules/batch_example/batch_example.install
deleted file mode 100644
index e1c082f0d..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/batch_example/batch_example.install
+++ /dev/null
@@ -1,84 +0,0 @@
-query('SELECT COUNT(nid) FROM {node}')->fetchField();
- // A place to store messages during the run.
- $sandbox['messages'] = [];
- // Last node read via the query.
- $sandbox['current_node'] = -1;
- }
-
- // Process nodes by groups of 10 (arbitrary value).
- // When a group is processed, the batch update engine determines
- // whether it should continue processing in the same request or provide
- // progress feedback to the user and wait for the next request.
- $limit = 10;
-
- // Retrieve the next group of nids.
- $query = $db_connection->select('node', 'n');
- $query->fields('n', ['nid']);
- $result = $query
- ->where('n.nid > :nid', [':nid' => $sandbox['current_node']])
- ->range(0, $limit)
- ->orderBy('n.nid', 'ASC')
- ->execute();
- foreach ($result as $row) {
- // Here we actually perform a dummy 'update' on the current node.
- $node = $db_connection->query('SELECT nid FROM {node} WHERE nid = :nid', [':nid' => $row->nid])->fetchField();
-
- // Update our progress information.
- $sandbox['progress']++;
- $sandbox['current_node'] = $row->nid;
- }
-
- // Set the "finished" status, to tell batch engine whether this function
- // needs to run again. If you set a float, this will indicate the progress
- // of the batch so the progress bar will update.
- $sandbox['#finished'] = ($sandbox['progress'] >= $sandbox['max']) ? TRUE : ($sandbox['progress'] / $sandbox['max']);
-
- // Set up a per-run message; Make a copy of $sandbox so we can change it.
- // This is simply a debugging stanza to illustrate how to capture status
- // from each pass through hook_update_N().
- $sandbox_status = $sandbox;
- // Don't want them in the output.
- unset($sandbox_status['messages']);
- $sandbox['messages'][] = t('$sandbox=') . print_r($sandbox_status, TRUE);
-
- if ($sandbox['#finished']) {
- // hook_update_N() may optionally return a string which will be displayed
- // to the user.
- $final_message = '
' . implode('
', $sandbox['messages']) . "
";
- return t('The batch_example demonstration update did what it was supposed to do: @message', ['@message' => $final_message]);
- }
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/batch_example/batch_example.links.menu.yml b/frontend/drupal9/web/modules/contrib/examples/modules/batch_example/batch_example.links.menu.yml
deleted file mode 100644
index 272cebbf8..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/batch_example/batch_example.links.menu.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-# Define default links for this module.
-batch_example.form:
- title: Batch API Examples
- description: Batch examples using Drupal Batch API.
- route_name: batch_example.form
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/batch_example/batch_example.module b/frontend/drupal9/web/modules/contrib/examples/modules/batch_example/batch_example.module
deleted file mode 100644
index d0ebffa93..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/batch_example/batch_example.module
+++ /dev/null
@@ -1,134 +0,0 @@
- $id, '@details' => $operation_details]
- );
-}
-
-/**
- * Batch operation for batch 2: five at a time.
- *
- * This is the function that is called on each operation in batch 2.
- *
- * After each group of 5 control is returned to the batch API for later
- * continuation.
- */
-function batch_example_op_2($operation_details, &$context) {
- // Use the $context['sandbox'] at your convenience to store the
- // information needed to track progression between successive calls.
- if (empty($context['sandbox'])) {
- $context['sandbox'] = [];
- $context['sandbox']['progress'] = 0;
- $context['sandbox']['current_node'] = 0;
-
- // Save node count for the termination message.
- $context['sandbox']['max'] = 30;
- }
-
- // Process in groups of 5 (arbitrary value).
- // When a group of five is processed, the batch update engine determines
- // whether it should continue processing in the same request or provide
- // progress feedback to the user and wait for the next request.
- // That way even though we're already processing at the operation level
- // the operation itself is interruptible.
- $limit = 5;
-
- // Retrieve the next group.
- $result = range($context['sandbox']['current_node'] + 1, $context['sandbox']['current_node'] + 1 + $limit);
-
- foreach ($result as $row) {
- // Here we actually perform our dummy 'processing' on the current node.
- usleep(20000);
-
- // Store some results for post-processing in the 'finished' callback.
- // The contents of 'results' will be available as $results in the
- // 'finished' function (in this example, batch_example_finished()).
- $context['results'][] = $row . ' ' . $operation_details;
-
- // Update our progress information.
- $context['sandbox']['progress']++;
- $context['sandbox']['current_node'] = $row;
- $context['message'] = t('Running Batch "@id" @details',
- ['@id' => $row, '@details' => $operation_details]
- );
- }
-
- // Inform the batch engine that we are not finished,
- // and provide an estimation of the completion level we reached.
- if ($context['sandbox']['progress'] != $context['sandbox']['max']) {
- $context['finished'] = ($context['sandbox']['progress'] >= $context['sandbox']['max']);
- }
-}
-
-/**
- * Batch 'finished' callback used by both batch 1 and batch 2.
- */
-function batch_example_finished($success, $results, $operations) {
- $messenger = \Drupal::messenger();
- if ($success) {
- // Here we could do something meaningful with the results.
- // We just display the number of nodes we processed...
- $messenger->addMessage(t('@count results processed.', ['@count' => count($results)]));
- $messenger->addMessage(t('The final result was "%final"', ['%final' => end($results)]));
- }
- else {
- // An error occurred.
- // $operations contains the operations that remained unprocessed.
- $error_operation = reset($operations);
- $messenger->addMessage(
- t('An error occurred while processing @operation with arguments : @args',
- [
- '@operation' => $error_operation[0],
- '@args' => print_r($error_operation[0], TRUE),
- ]
- )
- );
- }
-}
-
-/**
- * @} End of "defgroup batch_example".
- */
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/batch_example/batch_example.routing.yml b/frontend/drupal9/web/modules/contrib/examples/modules/batch_example/batch_example.routing.yml
deleted file mode 100644
index 9da2d8bc7..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/batch_example/batch_example.routing.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-batch_example.form:
- path: '/examples/batch_example'
- defaults:
- _form: '\Drupal\batch_example\Form\BatchExampleForm'
- _title: 'Demo of batch processing'
- requirements:
- _permission: 'access content'
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/batch_example/src/Form/BatchExampleForm.php b/frontend/drupal9/web/modules/contrib/examples/modules/batch_example/src/Form/BatchExampleForm.php
deleted file mode 100644
index 54c8d58de..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/batch_example/src/Form/BatchExampleForm.php
+++ /dev/null
@@ -1,148 +0,0 @@
- 'markup',
- '#markup' => $this->t('This example offers two different batches. The first does 1000 identical operations, each completed in on run; the second does 20 operations, but each takes more than one run to operate if there are more than 5 nodes.'),
- ];
- $form['batch'] = [
- '#type' => 'select',
- '#title' => 'Choose batch',
- '#options' => [
- 'batch_1' => $this->t('batch 1 - 1000 operations'),
- 'batch_2' => $this->t('batch 2 - 20 operations.'),
- ],
- ];
- $form['submit'] = [
- '#type' => 'submit',
- '#value' => 'Go',
- ];
-
- return $form;
-
- }
-
- /**
- * {@inheritdoc}
- */
- public function submitForm(array &$form, FormStateInterface $form_state) {
- // Gather our form value.
- $value = $form_state->getValues()['batch'];
- // Set the batch, using convenience methods.
- $batch = [];
- switch ($value) {
- case 'batch_1':
- $batch = $this->generateBatch1();
- break;
-
- case 'batch_2':
- $batch = $this->generateBatch2();
- break;
- }
- batch_set($batch);
- }
-
- /**
- * Generate Batch 1.
- *
- * Batch 1 will process one item at a time.
- *
- * This creates an operations array defining what batch 1 should do, including
- * what it should do when it's finished. In this case, each operation is the
- * same and by chance even has the same $nid to operate on, but we could have
- * a mix of different types of operations in the operations array.
- */
- public function generateBatch1() {
- $num_operations = 1000;
- $this->messenger()->addMessage($this->t('Creating an array of @num operations', ['@num' => $num_operations]));
-
- $operations = [];
- // Set up an operations array with 1000 elements, each doing function
- // batch_example_op_1.
- // Each operation in the operations array means at least one new HTTP
- // request, running Drupal from scratch to accomplish the operation. If the
- // operation returns with $context['finished'] != TRUE, then it will be
- // called again.
- // In this example, $context['finished'] is always TRUE.
- for ($i = 0; $i < $num_operations; $i++) {
- // Each operation is an array consisting of
- // - The function to call.
- // - An array of arguments to that function.
- $operations[] = [
- 'batch_example_op_1',
- [
- $i + 1,
- $this->t('(Operation @operation)', ['@operation' => $i]),
- ],
- ];
- }
- $batch = [
- 'title' => $this->t('Creating an array of @num operations', ['@num' => $num_operations]),
- 'operations' => $operations,
- 'finished' => 'batch_example_finished',
- ];
- return $batch;
- }
-
- /**
- * Generate Batch 2.
- *
- * Batch 2 will process five items at a time.
- *
- * This creates an operations array defining what batch 2 should do, including
- * what it should do when it's finished. In this case, each operation is the
- * same and by chance even has the same $nid to operate on, but we could have
- * a mix of different types of operations in the operations array.
- */
- public function generateBatch2() {
- $num_operations = 20;
-
- $operations = [];
- // 20 operations, each one loads all nodes.
- for ($i = 0; $i < $num_operations; $i++) {
- $operations[] = [
- 'batch_example_op_2',
- [$this->t('(Operation @operation)', ['@operation' => $i])],
- ];
- }
- $batch = [
- 'operations' => $operations,
- 'finished' => 'batch_example_finished',
- // @current, @remaining, @total, @percentage, @estimate and @elapsed.
- // These placeholders are replaced with actual values in _batch_process(),
- // using strtr() instead of t(). The values are determined based on the
- // number of operations in the 'operations' array (above), NOT by the
- // number of nodes that will be processed. In this example, there are 20
- // operations, so @total will always be 20, even though there are multiple
- // nodes per operation.
- // Defaults to t('Completed @current of @total.').
- 'title' => $this->t('Processing batch 2'),
- 'init_message' => $this->t('Batch 2 is starting.'),
- 'progress_message' => $this->t('Processed @current out of @total.'),
- 'error_message' => $this->t('Batch 2 has encountered an error.'),
- ];
- return $batch;
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/batch_example/tests/src/Functional/BatchExampleWebTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/batch_example/tests/src/Functional/BatchExampleWebTest.php
deleted file mode 100644
index c27331bd3..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/batch_example/tests/src/Functional/BatchExampleWebTest.php
+++ /dev/null
@@ -1,45 +0,0 @@
-drupalCreateUser(['access content']);
- $this->drupalLogin($web_user);
-
- // Launch Batch 1.
- $this->drupalPostForm('examples/batch_example', ['batch' => 'batch_1'], 'Go');
- // Check that 1000 operations were performed.
- $this->assertText('1000 results processed');
-
- // Launch Batch 2.
- $this->drupalPostForm('examples/batch_example', ['batch' => 'batch_2'], 'Go');
- // Check that 600 operations were performed.
- $this->assertText('600 results processed');
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/block_example/block_example.info.yml b/frontend/drupal9/web/modules/contrib/examples/modules/block_example/block_example.info.yml
deleted file mode 100644
index 047029a94..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/block_example/block_example.info.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-name: Block Example
-type: module
-description: Demonstrates how a module can define blocks.
-package: Example modules
-core_version_requirement: ^8.7.7 || ^9
-dependencies:
- - drupal:block
- - drupal:node
- - examples:examples
-
-# Information added by Drupal.org packaging script on 2021-10-07
-version: '3.0.3'
-project: 'examples'
-datestamp: 1633612832
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/block_example/block_example.links.menu.yml b/frontend/drupal9/web/modules/contrib/examples/modules/block_example/block_example.links.menu.yml
deleted file mode 100644
index 4ec1c1ebc..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/block_example/block_example.links.menu.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-block_example.description:
- title: Block Example
- route_name: block_example.description
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/block_example/block_example.module b/frontend/drupal9/web/modules/contrib/examples/modules/block_example/block_example.module
deleted file mode 100644
index 109c6dbf3..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/block_example/block_example.module
+++ /dev/null
@@ -1,52 +0,0 @@
-getPluginDefinition();
- if ((!empty($build['#configuration']['label']) && mb_strpos($build['#configuration']['label'], 'uppercase')) || (!empty($definition['subject']) && mb_strpos($definition['subject'], 'uppercase'))) {
- // This will uppercase the block title.
- $build['#configuration']['label'] = mb_strtoupper($build['#configuration']['label']);
- }
-}
-
-/**
- * @} End of "defgroup block_example".
- */
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/block_example/block_example.routing.yml b/frontend/drupal9/web/modules/contrib/examples/modules/block_example/block_example.routing.yml
deleted file mode 100644
index 975fe5b1d..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/block_example/block_example.routing.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-block_example.description:
- path: '/examples/block-example'
- defaults:
- _controller: '\Drupal\block_example\Controller\BlockExampleController::description'
- _title: 'Block Example'
- requirements:
- _permission: 'access content'
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/block_example/config/schema/block_example.schema.yml b/frontend/drupal9/web/modules/contrib/examples/modules/block_example/config/schema/block_example.schema.yml
deleted file mode 100644
index 0de8cc82e..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/block_example/config/schema/block_example.schema.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-block.settings.example_configurable_text:
- type: block_settings
- label: 'Example configurable text block configuration'
- mapping:
- block_example_string:
- type: text
- label: 'Block contents'
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/block_example/src/Controller/BlockExampleController.php b/frontend/drupal9/web/modules/contrib/examples/modules/block_example/src/Controller/BlockExampleController.php
deleted file mode 100644
index 775c230ca..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/block_example/src/Controller/BlockExampleController.php
+++ /dev/null
@@ -1,20 +0,0 @@
- $this->t('A default value. This block was created at %time', ['%time' => date('c')]),
- ];
- }
-
- /**
- * {@inheritdoc}
- *
- * This method defines form elements for custom block configuration. Standard
- * block configuration fields are added by BlockBase::buildConfigurationForm()
- * (block title and title visibility) and BlockFormController::form() (block
- * visibility settings).
- *
- * @see \Drupal\block\BlockBase::buildConfigurationForm()
- * @see \Drupal\block\BlockFormController::form()
- */
- public function blockForm($form, FormStateInterface $form_state) {
- $form['block_example_string_text'] = [
- '#type' => 'textarea',
- '#title' => $this->t('Block contents'),
- '#description' => $this->t('This text will appear in the example block.'),
- '#default_value' => $this->configuration['block_example_string'],
- ];
- return $form;
- }
-
- /**
- * {@inheritdoc}
- *
- * This method processes the blockForm() form fields when the block
- * configuration form is submitted.
- *
- * The blockValidate() method can be used to validate the form submission.
- */
- public function blockSubmit($form, FormStateInterface $form_state) {
- $this->configuration['block_example_string']
- = $form_state->getValue('block_example_string_text');
- }
-
- /**
- * {@inheritdoc}
- */
- public function build() {
- return [
- '#markup' => $this->configuration['block_example_string'],
- ];
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/block_example/src/Plugin/Block/ExampleEmptyBlock.php b/frontend/drupal9/web/modules/contrib/examples/modules/block_example/src/Plugin/Block/ExampleEmptyBlock.php
deleted file mode 100644
index b14facd0d..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/block_example/src/Plugin/Block/ExampleEmptyBlock.php
+++ /dev/null
@@ -1,30 +0,0 @@
- $this->t("This block's title is changed to uppercase. Any block title which contains 'uppercase' will also be changed to uppercase."),
- ];
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/block_example/templates/description.html.twig b/frontend/drupal9/web/modules/contrib/examples/modules/block_example/templates/description.html.twig
deleted file mode 100644
index e3e188522..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/block_example/templates/description.html.twig
+++ /dev/null
@@ -1,15 +0,0 @@
-{#
-
-Description text for the Block Example.
-
-#}
-
-{% set block_admin_page = url('block.admin_display')['#markup'] %}
-
-{% trans %}
-
-
The Block Example provides three sample blocks which demonstrate the various
- block APIs. To experiment with the blocks, enable and configure them on
- the block admin page.
-
-{% endtrans %}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/block_example/tests/src/Functional/BlockExampleMenuTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/block_example/tests/src/Functional/BlockExampleMenuTest.php
deleted file mode 100644
index 2b5fd2f04..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/block_example/tests/src/Functional/BlockExampleMenuTest.php
+++ /dev/null
@@ -1,55 +0,0 @@
-drupalGet('');
- $this->assertLinkByHref('examples/block-example');
-
- $this->drupalGet('examples/block-example');
- $this->assertResponse(200);
-
- // Verify that the block admin page link works.
- $this->clickLink('the block admin page');
- // Since it links to the admin page, we should get a permissions error and
- // not 404.
- $this->assertResponse(403);
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/block_example/tests/src/Functional/BlockExampleTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/block_example/tests/src/Functional/BlockExampleTest.php
deleted file mode 100644
index b8250d5aa..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/block_example/tests/src/Functional/BlockExampleTest.php
+++ /dev/null
@@ -1,91 +0,0 @@
-assertSession();
-
- // Create user.
- $web_user = $this->drupalCreateUser(['administer blocks']);
- // Login the admin user.
- $this->drupalLogin($web_user);
-
- $theme_name = $this->config('system.theme')->get('default');
-
- // Verify the blocks are listed to be added.
- $this->drupalGet('/admin/structure/block/library/' . $theme_name, ['query' => ['region' => 'content']]);
- $assert->pageTextContains('Example: configurable text');
- $assert->pageTextContains('Example: empty block');
- $assert->pageTextContains('Example: uppercase this please');
-
- // Define and place blocks.
- $settings_configurable = [
- 'label' => 'Configurable text',
- 'id' => 'block_example_example_configurable_text',
- 'theme' => $theme_name,
- ];
- $this->drupalPlaceBlock('example_configurable_text', $settings_configurable);
-
- $settings_uppercase = [
- 'label' => 'Configurable block to be uppercased',
- 'id' => 'block_example_example_uppercased',
- 'theme' => $theme_name,
- ];
- $this->drupalPlaceBlock('example_uppercase', $settings_uppercase);
-
- $settings_empty = [
- 'label' => 'Empty block',
- 'id' => 'block_example_example_empty',
- 'theme' => $theme_name,
- ];
- $this->drupalPlaceBlock('example_empty', $settings_empty);
-
- // Verify that blocks are there. Empty block will not be shown, because it
- // holds an empty array.
- $this->drupalGet('');
- $assert->pageTextContains($settings_configurable['label']);
- $assert->pageTextContains($settings_uppercase['label']);
- $assert->pageTextContains(mb_strtoupper($settings_uppercase['label']));
- $assert->pageTextNotContains($settings_empty['label']);
-
- // Change content of configurable text block.
- $edit = [
- 'settings[block_example_string_text]' => $this->randomMachineName(),
- ];
- $this->drupalPostForm('/admin/structure/block/manage/' . $settings_configurable['id'], $edit, 'Save block');
- $assert->statusCodeEquals(200);
-
- // Verify that new content is shown.
- $this->drupalGet('');
- $assert->statusCodeEquals(200);
- $assert->pageTextContains($edit['settings[block_example_string_text]']);
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/cache_example/cache_example.info.yml b/frontend/drupal9/web/modules/contrib/examples/modules/cache_example/cache_example.info.yml
deleted file mode 100644
index 9eca39122..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/cache_example/cache_example.info.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-name: Cache Example
-description: Demonstrates how to use Cache API.
-package: Example modules
-core_version_requirement: ^8.7.7 || ^9
-type: module
-dependencies:
- - drupal:node
- - examples:examples
-
-# Information added by Drupal.org packaging script on 2021-10-07
-version: '3.0.3'
-project: 'examples'
-datestamp: 1633612832
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/cache_example/cache_example.links.menu.yml b/frontend/drupal9/web/modules/contrib/examples/modules/cache_example/cache_example.links.menu.yml
deleted file mode 100644
index 2e148950d..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/cache_example/cache_example.links.menu.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-cache_example.description:
- title: 'Cache Example'
- description: 'Example of Drupal Cache API'
- route_name: cache_example.description
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/cache_example/cache_example.module b/frontend/drupal9/web/modules/contrib/examples/modules/cache_example/cache_example.module
deleted file mode 100644
index ed9965042..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/cache_example/cache_example.module
+++ /dev/null
@@ -1,28 +0,0 @@
-setRequestStack($container->get('request_stack'))
- ->setStringTranslation($container->get('string_translation'))
- ->setMessenger($container->get('messenger'));
- $form->currentUser = $container->get('current_user');
- $form->cacheBackend = $container->get('cache.default');
- $form->dateFormatter = $container->get('date.formatter');
- $form->fileSystem = $container->get('file_system');
- return $form;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getFormId() {
- return 'cron_cache';
- }
-
- /**
- * {@inheritdoc}
- */
- public function buildForm(array $form, FormStateInterface $form_state) {
- // Log execution time.
- $start_time = microtime(TRUE);
-
- // Try to load the files count from cache. This function will accept two
- // arguments:
- // - cache object name (cid)
- // - cache bin, the (optional) cache bin (most often a database table) where
- // the object is to be saved.
- //
- // cache_get() returns the cached object or FALSE if object does not exist.
- if ($cache = $this->cacheBackend->get('cache_example_files_count')) {
- /*
- * Get cached data. Complex data types will be unserialized automatically.
- */
- $files_count = $cache->data;
- }
- else {
- // If there was no cached data available we have to search filesystem.
- // Recursively get all .PHP files from Drupal's core folder.
- $files_count = count($this->fileSystem->scanDirectory('core', '/.php/'));
-
- // Since we have recalculated, we now need to store the new data into
- // cache. Complex data types will be automatically serialized before
- // being saved into cache.
- // Here we use the default setting and create an unexpiring cache item.
- // See below for an example that creates an expiring cache item.
- $this->cacheBackend->set('cache_example_files_count', $files_count, CacheBackendInterface::CACHE_PERMANENT);
- }
-
- $end_time = microtime(TRUE);
- $duration = $end_time - $start_time;
-
- // Format intro message.
- $intro_message = '
' . $this->t("This example will search Drupal's core folder and display a count of the PHP files in it.") . ' ';
- $intro_message .= $this->t('This can take a while, since there are a lot of files to be searched.') . ' ';
- $intro_message .= $this->t('We will search filesystem just once and save output to the cache. We will use cached data for later requests.') . '
';
- $intro_message .= '
'
- . $this->t(
- 'Reload this page to see cache in action.',
- ['@url' => $this->getRequest()->getRequestUri()]
- )
- . ' ';
- $intro_message .= $this->t('You can use the button below to remove cached data.') . '
';
-
- $form['file_search'] = [
- '#type' => 'fieldset',
- '#title' => $this->t('File search caching'),
- ];
- $form['file_search']['introduction'] = [
- '#markup' => $intro_message,
- ];
-
- $color = empty($cache) ? 'red' : 'green';
- $retrieval = empty($cache) ? $this->t('calculated by traversing the filesystem') : $this->t('retrieved from cache');
-
- $form['file_search']['statistics'] = [
- '#type' => 'item',
- '#markup' => $this->t('%count files exist in this Drupal installation; @retrieval in @time ms. (Source: @source)', [
- '%count' => $files_count,
- '@retrieval' => $retrieval,
- '@time' => number_format($duration * 1000, 2),
- '@color' => $color,
- '@source' => empty($cache) ? $this->t('actual file search') : $this->t('cached'),
- ]
- ),
- ];
- $form['file_search']['remove_file_count'] = [
- '#type' => 'submit',
- '#submit' => ['::expireFiles'],
- '#value' => $this->t('Explicitly remove cached file count'),
- ];
-
- $form['expiration_demo'] = [
- '#type' => 'fieldset',
- '#title' => $this->t('Cache expiration settings'),
- ];
- $form['expiration_demo']['explanation'] = [
- '#markup' => $this->t('A cache item can be set as CACHE_PERMANENT, meaning that it will only be removed when explicitly cleared, or it can have an expiration time (a Unix timestamp).'),
- ];
-
- $item = $this->cacheBackend->get('cache_example_expiring_item', TRUE);
- if ($item == FALSE) {
- $item_status = $this->t('Cache item does not exist');
- }
- else {
- $item_status = $item->valid ? $this->t('Cache item exists and is set to expire at %time', ['%time' => $item->data]) :
- $this->t('Cache_item is invalid');
- }
-
- $form['expiration_demo']['current_status'] = [
- '#type' => 'item',
- '#title' => $this->t('Current status of cache item "cache_example_expiring_item"'),
- '#markup' => $item_status,
- ];
- $form['expiration_demo']['expiration'] = [
- '#type' => 'select',
- '#title' => $this->t('Time before cache expiration'),
- '#options' => [
- 'never_remove' => $this->t('CACHE_PERMANENT'),
- -10 => $this->t('Immediate expiration'),
- 10 => $this->t('10 seconds from form submission'),
- 60 => $this->t('1 minute from form submission'),
- 300 => $this->t('5 minutes from form submission'),
- ],
- '#default_value' => -10,
- '#description' => $this->t('Any cache item can be set to only expire when explicitly cleared, or to expire at a given time.'),
- ];
- $form['expiration_demo']['create_cache_item'] = [
- '#type' => 'submit',
- '#value' => $this->t('Create a cache item with this expiration'),
- '#submit' => ['::createExpiringItem'],
- ];
-
- $form['cache_clearing'] = [
- '#type' => 'fieldset',
- '#title' => $this->t('Expire and remove options'),
- '#description' => $this->t("We have APIs to expire cached items and also to just remove them. Unfortunately, they're all the same API, cache_clear_all"),
- ];
- $form['cache_clearing']['cache_clear_type'] = [
- '#type' => 'radios',
- '#title' => $this->t('Type of cache clearing to do'),
- '#options' => [
- 'expire' => $this->t('Remove items from the "cache" bin that have expired'),
- 'remove_all' => $this->t('Remove all items from the "cache" bin regardless of expiration'),
- 'remove_tag' => $this->t('Remove all items in the "cache" bin with the tag "cache_example" set to 1'),
- ],
- '#default_value' => 'expire',
- ];
- // Submit button to clear cached data.
- $form['cache_clearing']['clear_expired'] = [
- '#type' => 'submit',
- '#value' => $this->t('Clear or expire cache'),
- '#submit' => ['::cacheClearing'],
- '#access' => $this->currentUser->hasPermission('administer site configuration'),
- ];
-
- return $form;
- }
-
- /**
- * Submit handler that explicitly clears cache_example_files_count from cache.
- */
- public function expireFiles($form, &$form_state) {
- // Clear cached data. This function will delete cached object from cache
- // bin.
- //
- // The first argument is cache id to be deleted. Since we've provided it
- // explicitly, it will be removed whether or not it has an associated
- // expiration time. The second argument (required here) is the cache bin.
- // Using cache_clear_all() explicitly in this way
- // forces removal of the cached item.
- $this->cacheBackend->delete('cache_example_files_count');
-
- // Display message to the user.
- $this->messenger()->addMessage($this->t('Cached data key "cache_example_files_count" was cleared.'), 'status');
- }
-
- /**
- * Submit handler to create a new cache item with specified expiration.
- */
- public function createExpiringItem($form, &$form_state) {
-
- $tags = [
- 'cache_example:1',
- ];
-
- $interval = $form_state->getValue('expiration');
- if ($interval == 'never_remove') {
- $expiration = CacheBackendInterface::CACHE_PERMANENT;
- $expiration_friendly = $this->t('Never expires');
- }
- else {
- $expiration = time() + $interval;
- $expiration_friendly = $this->dateFormatter->format($expiration);
- }
- // Set the expiration to the actual Unix timestamp of the end of the
- // required interval. Also add a tag to it to be able to clear caches more
- // precise.
- $this->cacheBackend->set('cache_example_expiring_item', $expiration_friendly, $expiration, $tags);
- $this->messenger()->addMessage($this->t('cache_example_expiring_item was set to expire at %time', ['%time' => $expiration_friendly]));
- }
-
- /**
- * Submit handler to demonstrate the various uses of cache_clear_all().
- */
- public function cacheClearing($form, &$form_state) {
- switch ($form_state->getValue('cache_clear_type')) {
- case 'expire':
- // Here we'll remove all cache keys in the 'cache' bin that have
- // expired.
- $this->cacheBackend->garbageCollection();
- $this->messenger()->addMessage($this->t('\Drupal::cache()->garbageCollection() was called, removing any expired cache items.'));
- break;
-
- case 'remove_all':
- // This removes all keys in a bin using a super-wildcard. This
- // has nothing to do with expiration. It's just brute-force removal.
- $this->cacheBackend->deleteAll();
- $this->messenger()->addMessage($this->t('ALL entries in the "cache" bin were removed with \Drupal::cache()->deleteAll().'));
- break;
-
- case 'remove_tag':
- // This removes cache entries with the tag "cache_example" set to 1 in
- // the "cache".
- $tags = [
- 'cache_example:1',
- ];
- Cache::invalidateTags($tags);
- $this->messenger()->addMessage($this->t('Cache entries with the tag "cache_example" set to 1 in the "cache" bin were invalidated with \Drupal\Core\Cache\Cache::invalidateTags($tags).'));
- break;
- }
- }
-
- /**
- * {@inheritdoc}
- */
- public function submitForm(array &$form, FormStateInterface $form_state) {
-
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/cache_example/tests/src/Functional/CacheExampleTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/cache_example/tests/src/Functional/CacheExampleTest.php
deleted file mode 100644
index 924e7bb78..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/cache_example/tests/src/Functional/CacheExampleTest.php
+++ /dev/null
@@ -1,115 +0,0 @@
-assertSession();
-
- // Test for a link to the cache_example in the Tools menu.
- $this->drupalGet('');
- $assert->statusCodeEquals(200);
-
- $assert->linkByHrefExists('examples/cache-example');
-
- // Verify if the can successfully access the cache_example form.
- $this->drupalGet('examples/cache-example');
- $assert->statusCodeEquals(200);
- }
-
- /**
- * Test that our caches function.
- *
- * Does the following:
- * - Load cache example page and test if displaying uncached version.
- * - Reload once again and test if displaying cached version.
- * - Find reload link and click on it.
- * - Clear cache at the end and test if displaying uncached version again.
- */
- public function testCacheExampleBasic() {
- $assert = $this->assertSession();
-
- // We need administrative privileges to clear the cache.
- $admin_user = $this->drupalCreateUser(['administer site configuration']);
- $this->drupalLogin($admin_user);
-
- // Get initial page cache example page, first time accessed,
- // and assert uncached output.
- $this->drupalGet('examples/cache-example');
- $assert->pageTextContains('Source: actual file search');
-
- // Reload the page; the number should be cached.
- $this->drupalGet('examples/cache-example');
- $assert->pageTextContains('Source: cached');
-
- // Now push the button to remove the count.
- $this->drupalPostForm('examples/cache-example', [], 'Explicitly remove cached file count');
- $assert->pageTextContains('Source: actual file search');
-
- // Create a cached item. First make sure it doesn't already exist.
- $assert->pageTextContains('Cache item does not exist');
- $this->drupalPostForm('examples/cache-example', ['expiration' => -10], 'Create a cache item with this expiration');
- // We should now have an already-expired item. Automatically invalid.
- $assert->pageTextContains('Cache_item is invalid');
- // Now do the expiration operation.
- $this->drupalPostForm('examples/cache-example', ['cache_clear_type' => 'expire'], 'Clear or expire cache');
- // And verify that it was removed.
- $assert->pageTextContains('Cache item does not exist');
-
- // Create a cached item. This time we'll make it not expire.
- $this->drupalPostForm('examples/cache-example', ['expiration' => 'never_remove'], 'Create a cache item with this expiration');
- // We should now have an never-remove item.
- $assert->pageTextContains('Cache item exists and is set to expire at Never expires');
- // Now do the expiration operation.
- $this->drupalPostForm('examples/cache-example', ['cache_clear_type' => 'expire'], 'Clear or expire cache');
- // And verify that it was not removed.
- $assert->pageTextContains('Cache item exists and is set to expire at Never expires');
- // Now do tag invalidation.
- $this->drupalPostForm('examples/cache-example', ['cache_clear_type' => 'remove_tag'], 'Clear or expire cache');
- // And verify that it was invalidated.
- $assert->pageTextContains('Cache_item is invalid');
- // Do the hard delete.
- $this->drupalPostForm('examples/cache-example', ['cache_clear_type' => 'remove_all'], 'Clear or expire cache');
- // And verify that it was removed.
- $assert->pageTextContains('Cache item does not exist');
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/config/install/config_entity_example.robot.marvin.yml b/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/config/install/config_entity_example.robot.marvin.yml
deleted file mode 100644
index 1a7b1522e..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/config/install/config_entity_example.robot.marvin.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-# This file defines a default config entity. This allows the module to include
-# config entities that are present 'out of the box'. Default config entities
-# are created in Drupal when the module is enabled. They are removed when the
-# module is uninstalled.
-
-# Default config entities can be edited by the user within Drupal. This edited
-# entity wil become exportable through the configuration system. This file,
-# however, will remain untouched.
-
-# For our config entity to be added at installation time, we have to place it in
-# the config/install directory of our module. Thus our file is located at:
-# config/install/config_entity_example.robot.marvin.yml.
-
-# You can see where these properties are defined in the annotation of
-# Drupal\config_entity_example\Entity\Robot.
-
-# The id of the config entity.
-id: marvin
-# Our properties follow.
-label: 'Marvin, the paranoid android'
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/config/schema/config_entity_example.schema.yml b/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/config/schema/config_entity_example.schema.yml
deleted file mode 100644
index d31770f8b..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/config/schema/config_entity_example.schema.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-# Schema for the configuration files of the Config Entity Example module.
-
-# This schema tells the config system how to read our config YML files.
-# See for example the file config/config_entity_example.robot.marvin.yml, which
-# contains our default config entity.
-
-# Documentation for schema files like this one is located here:
-# https://drupal.org/node/1905070
-
-config_entity_example.robot.*:
- type: config_entity
- label: 'Robot'
- mapping:
- id:
- type: string
- label: 'Robot id'
- uuid:
- type: string
- label: 'UUID'
- label:
- type: label
- label: 'Label'
- floopy:
- type: boolean
- label: 'Floopy'
- langcode:
- type: string
- label: 'Default language'
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/config_entity_example.info.yml b/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/config_entity_example.info.yml
deleted file mode 100644
index 9a96b2f3e..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/config_entity_example.info.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-name: 'Config Entity Example'
-type: module
-description: 'Demonstrates how to create a config entity type.'
-package: Example modules
-core_version_requirement: ^8.7.7 || ^9
-dependencies:
- - examples:examples
-
-# Information added by Drupal.org packaging script on 2021-10-07
-version: '3.0.3'
-project: 'examples'
-datestamp: 1633612832
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/config_entity_example.links.action.yml b/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/config_entity_example.links.action.yml
deleted file mode 100644
index e55bd4af6..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/config_entity_example.links.action.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-# Add some local task links to facilitate navigation.
-
-config_entity_example.add_action:
- route_name: entity.robot.add_form
- title: 'Add robot'
- appears_on:
- - entity.robot.list
-
-config_entity_example.list_action:
- route_name: entity.robot.list
- title: 'List robots'
- appears_on:
- - entity.robot.add_form
- - entity.robot.edit_form
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/config_entity_example.links.menu.yml b/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/config_entity_example.links.menu.yml
deleted file mode 100644
index 328da767d..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/config_entity_example.links.menu.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-config_entity_example.menu:
- title: Config Entity Example
- route_name: entity.robot.list
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/config_entity_example.module b/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/config_entity_example.module
deleted file mode 100644
index 251c65922..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/config_entity_example.module
+++ /dev/null
@@ -1,42 +0,0 @@
-t('Robot');
- $header['machine_name'] = $this->t('Machine Name');
- $header['floopy'] = $this->t('Floopy');
- return $header + parent::buildHeader();
- }
-
- /**
- * Builds a row for an entity in the entity listing.
- *
- * @param \Drupal\Core\Entity\EntityInterface $entity
- * The entity for which to build the row.
- *
- * @return array
- * A render array of the table row for displaying the entity.
- *
- * @see \Drupal\Core\Entity\EntityListController::render()
- */
- public function buildRow(EntityInterface $entity) {
- $row['label'] = $entity->label();
- $row['machine_name'] = $entity->id();
- $row['floopy'] = $entity->floopy;
-
- return $row + parent::buildRow($entity);
- }
-
- /**
- * Adds some descriptive text to our entity list.
- *
- * Typically, there's no need to override render(). You may wish to do so,
- * however, if you want to add markup before or after the table.
- *
- * @return array
- * Renderable array.
- */
- public function render() {
- $build = $this->description();
- $build[] = parent::render();
- return $build;
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/src/Entity/Robot.php b/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/src/Entity/Robot.php
deleted file mode 100644
index 11fa3411e..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/src/Entity/Robot.php
+++ /dev/null
@@ -1,95 +0,0 @@
-t('Create Robot');
- return $actions;
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/src/Form/RobotDeleteForm.php b/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/src/Form/RobotDeleteForm.php
deleted file mode 100644
index 34756d2d5..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/src/Form/RobotDeleteForm.php
+++ /dev/null
@@ -1,89 +0,0 @@
-t('Are you sure you want to delete robot %label?', [
- '%label' => $this->entity->label(),
- ]);
- }
-
- /**
- * Gather the confirmation text.
- *
- * The confirm text is used as the text in the button that confirms the
- * question posed by getQuestion().
- *
- * @return string
- * Translated string.
- */
- public function getConfirmText() {
- return $this->t('Delete Robot');
- }
-
- /**
- * Gets the cancel URL.
- *
- * Provides the URL to go to if the user cancels the action. For entity
- * delete forms, this is typically the route that points at the list
- * controller.
- *
- * @return \Drupal\Core\Url
- * The URL to go to if the user cancels the deletion.
- */
- public function getCancelUrl() {
- return new Url('entity.robot.list');
- }
-
- /**
- * The submit handler for the confirm form.
- *
- * For entity delete forms, you use this to delete the entity in
- * $this->entity.
- *
- * @param array $form
- * An associative array containing the structure of the form.
- * @param \Drupal\Core\Form\FormStateInterface $form_state
- * An associative array containing the current state of the form.
- */
- public function submitForm(array &$form, FormStateInterface $form_state) {
- // Delete the entity.
- $this->entity->delete();
-
- // Set a message that the entity was deleted.
- $this->messenger()->addMessage($this->t('Robot %label was deleted.', [
- '%label' => $this->entity->label(),
- ]));
-
- // Redirect the user to the list controller when complete.
- $form_state->setRedirectUrl($this->getCancelUrl());
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/src/Form/RobotEditForm.php b/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/src/Form/RobotEditForm.php
deleted file mode 100644
index eda096f63..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/src/Form/RobotEditForm.php
+++ /dev/null
@@ -1,35 +0,0 @@
-t('Update Robot');
- return $actions;
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/src/Form/RobotFormBase.php b/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/src/Form/RobotFormBase.php
deleted file mode 100644
index 0ca7065b1..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/src/Form/RobotFormBase.php
+++ /dev/null
@@ -1,220 +0,0 @@
-entityStorage = $entity_storage;
- }
-
- /**
- * Factory method for RobotFormBase.
- *
- * When Drupal builds this class it does not call the constructor directly.
- * Instead, it relies on this method to build the new object. Why? The class
- * constructor may take multiple arguments that are unknown to Drupal. The
- * create() method always takes one parameter -- the container. The purpose
- * of the create() method is twofold: It provides a standard way for Drupal
- * to construct the object, meanwhile it provides you a place to get needed
- * constructor parameters from the container.
- *
- * In this case, we ask the container for an entity query factory. We then
- * pass the factory to our class as a constructor parameter.
- */
- public static function create(ContainerInterface $container) {
- $form = new static($container->get('entity_type.manager')->getStorage('robot'));
- $form->setMessenger($container->get('messenger'));
- return $form;
- }
-
- /**
- * Overrides Drupal\Core\Entity\EntityFormController::form().
- *
- * Builds the entity add/edit form.
- *
- * @param array $form
- * An associative array containing the structure of the form.
- * @param \Drupal\Core\Form\FormStateInterface $form_state
- * An associative array containing the current state of the form.
- *
- * @return array
- * An associative array containing the robot add/edit form.
- */
- public function buildForm(array $form, FormStateInterface $form_state) {
- // Get anything we need from the base class.
- $form = parent::buildForm($form, $form_state);
-
- // Drupal provides the entity to us as a class variable. If this is an
- // existing entity, it will be populated with existing values as class
- // variables. If this is a new entity, it will be a new object with the
- // class of our entity. Drupal knows which class to call from the
- // annotation on our Robot class.
- $robot = $this->entity;
-
- // Build the form.
- $form['label'] = [
- '#type' => 'textfield',
- '#title' => $this->t('Label'),
- '#maxlength' => 255,
- '#default_value' => $robot->label(),
- '#required' => TRUE,
- ];
- $form['id'] = [
- '#type' => 'machine_name',
- '#title' => $this->t('Machine name'),
- '#default_value' => $robot->id(),
- '#machine_name' => [
- 'exists' => [$this, 'exists'],
- 'replace_pattern' => '([^a-z0-9_]+)|(^custom$)',
- 'error' => 'The machine-readable name must be unique, and can only contain lowercase letters, numbers, and underscores. Additionally, it can not be the reserved word "custom".',
- ],
- '#disabled' => !$robot->isNew(),
- ];
- $form['floopy'] = [
- '#type' => 'checkbox',
- '#title' => $this->t('Floopy'),
- '#default_value' => $robot->floopy,
- ];
-
- // Return the form.
- return $form;
- }
-
- /**
- * Checks for an existing robot.
- *
- * @param string|int $entity_id
- * The entity ID.
- * @param array $element
- * The form element.
- * @param \Drupal\Core\Form\FormStateInterface $form_state
- * The form state.
- *
- * @return bool
- * TRUE if this format already exists, FALSE otherwise.
- */
- public function exists($entity_id, array $element, FormStateInterface $form_state) {
- // Use the query factory to build a new robot entity query.
- $query = $this->entityStorage->getQuery();
-
- // Query the entity ID to see if its in use.
- $result = $query->condition('id', $element['#field_prefix'] . $entity_id)
- ->execute();
-
- // We don't need to return the ID, only if it exists or not.
- return (bool) $result;
- }
-
- /**
- * Overrides Drupal\Core\Entity\EntityFormController::actions().
- *
- * To set the submit button text, we need to override actions().
- *
- * @param array $form
- * An associative array containing the structure of the form.
- * @param \Drupal\Core\Form\FormStateInterface $form_state
- * An associative array containing the current state of the form.
- *
- * @return array
- * An array of supported actions for the current entity form.
- */
- protected function actions(array $form, FormStateInterface $form_state) {
- // Get the basic actins from the base class.
- $actions = parent::actions($form, $form_state);
-
- // Change the submit button text.
- $actions['submit']['#value'] = $this->t('Save');
-
- // Return the result.
- return $actions;
- }
-
- /**
- * {@inheritdoc}
- */
- public function validateForm(array &$form, FormStateInterface $form_state) {
- parent::validateForm($form, $form_state);
-
- // Add code here to validate your config entity's form elements.
- // Nothing to do here.
- }
-
- /**
- * Overrides Drupal\Core\Entity\EntityFormController::save().
- *
- * Saves the entity. This is called after submit() has built the entity from
- * the form values. Do not override submit() as save() is the preferred
- * method for entity form controllers.
- *
- * @param array $form
- * An associative array containing the structure of the form.
- * @param \Drupal\Core\Form\FormStateInterface $form_state
- * An associative array containing the current state of the form.
- */
- public function save(array $form, FormStateInterface $form_state) {
- // EntityForm provides us with the entity we're working on.
- $robot = $this->getEntity();
-
- // Drupal already populated the form values in the entity object. Each
- // form field was saved as a public variable in the entity class. PHP
- // allows Drupal to do this even if the method is not defined ahead of
- // time.
- $status = $robot->save();
-
- // Grab the URL of the new entity. We'll use it in the message.
- $url = $robot->toUrl();
-
- // Create an edit link.
- $edit_link = Link::fromTextAndUrl($this->t('Edit'), $url)->toString();
-
- if ($status == SAVED_UPDATED) {
- // If we edited an existing entity...
- $this->messenger()->addMessage($this->t('Robot %label has been updated.', ['%label' => $robot->label()]));
- $this->logger('contact')->notice('Robot %label has been updated.', ['%label' => $robot->label(), 'link' => $edit_link]);
- }
- else {
- // If we created a new entity...
- $this->messenger()->addMessage($this->t('Robot %label has been added.', ['%label' => $robot->label()]));
- $this->logger('contact')->notice('Robot %label has been added.', ['%label' => $robot->label(), 'link' => $edit_link]);
- }
-
- // Redirect the user back to the listing route after the save operation.
- $form_state->setRedirect('entity.robot.list');
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/src/RobotAccessController.php b/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/src/RobotAccessController.php
deleted file mode 100644
index 78265eef8..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/src/RobotAccessController.php
+++ /dev/null
@@ -1,35 +0,0 @@
-The Config Entity Example module defines a Robot entity type. This is a list
- of the Robot entities currently in your Drupal site.
By default, when
- you enable this module, one entity is created from configuration. This is
- why we call them Config Entities. Marvin, the paranoid android, is created
- in the database when the module is enabled.
You can view a list of
- Robots here. You can also use the 'Operations' column to edit and delete
- Robots.
-
-{% endtrans %}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/tests/src/Functional/ConfigEntityExampleTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/tests/src/Functional/ConfigEntityExampleTest.php
deleted file mode 100644
index f94b560b9..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/tests/src/Functional/ConfigEntityExampleTest.php
+++ /dev/null
@@ -1,207 +0,0 @@
-assertSession();
-
- // 1) Verify that the Marvin entity was created when the module was
- // installed.
- $entity = Robot::load('marvin');
- $this->assertNotNull($entity, 'Marvin was created during installation.');
-
- // 2) Verify that permissions are applied to the various defined paths.
- // Define some paths. Since the Marvin entity is defined, we can use it
- // in our management paths.
- $forbidden_paths = [
- '/examples/config-entity-example',
- '/examples/config-entity-example/add',
- '/examples/config-entity-example/manage/marvin',
- '/examples/config-entity-example/manage/marvin/delete',
- ];
- // Check each of the paths to make sure we don't have access. At this point
- // we haven't logged in any users, so the client is anonymous.
- foreach ($forbidden_paths as $path) {
- $this->drupalGet($path);
- $assert->statusCodeEquals(403);
- }
-
- // Create a user with no permissions.
- $noperms_user = $this->drupalCreateUser();
- $this->drupalLogin($noperms_user);
- // Should be the same result for forbidden paths, since the user needs
- // special permissions for these paths.
- foreach ($forbidden_paths as $path) {
- $this->drupalGet($path);
- $assert->statusCodeEquals(403);
- }
-
- // Create a user who can administer robots.
- $admin_user = $this->drupalCreateUser(['administer robots']);
- $this->drupalLogin($admin_user);
- // Forbidden paths aren't forbidden any more.
- foreach ($forbidden_paths as $unforbidden) {
- $this->drupalGet($unforbidden);
- $assert->statusCodeEquals(200);
- }
-
- // Now that we have the admin user logged in, check the menu links.
- $this->drupalGet('');
- $assert->linkByHrefExists('examples/config-entity-example');
-
- // 3) Verify that we can manage entities through the user interface.
- // We still have the admin user logged in, so we'll create, update, and
- // delete an entity.
- // Go to the list page.
- $this->drupalGet('/examples/config-entity-example');
- $this->clickLink('Add robot');
- $robot_machine_name = 'roboname';
- $this->drupalPostForm(
- NULL,
- [
- 'label' => $robot_machine_name,
- 'id' => $robot_machine_name,
- 'floopy' => TRUE,
- ],
- 'Create Robot'
- );
-
- // 4) Verify that our robot appears when we edit it.
- $this->drupalGet('/examples/config-entity-example/manage/' . $robot_machine_name);
- $assert->fieldExists('label');
- $assert->checkboxChecked('edit-floopy');
-
- // 5) Verify that the label and machine name are shown in the list.
- $this->drupalGet('/examples/config-entity-example');
- $this->clickLink('Add robot');
- $robby_machine_name = 'robby_machine_name';
- $robby_label = 'Robby label';
- $this->drupalPostForm(
- NULL,
- [
- 'label' => $robby_label,
- 'id' => $robby_machine_name,
- 'floopy' => TRUE,
- ],
- 'Create Robot'
- );
- $this->drupalGet('/examples/config-entity-example');
- $assert->pageTextContains($robby_label);
- $assert->pageTextContains($robby_machine_name);
-
- // Try to re-submit the same robot, and verify that we see an error message
- // and not a PHP error.
- $this->drupalPostForm(
- Url::fromRoute('entity.robot.add_form'),
- [
- 'label' => $robby_label,
- 'id' => $robby_machine_name,
- 'floopy' => TRUE,
- ],
- 'Create Robot'
- );
- $assert->pageTextContains('The machine-readable name is already in use.');
-
- // 6) Verify that required links are present on respective paths.
- $this->drupalGet(Url::fromRoute('entity.robot.list'));
- $this->assertLinkByHref('/examples/config-entity-example/add');
- $this->assertLinkByHref('/examples/config-entity-example/manage/robby_machine_name');
- $this->assertLinkByHref('/examples/config-entity-example/manage/robby_machine_name/delete');
-
- // Verify links on Add Robot.
- $this->drupalGet('/examples/config-entity-example/add');
- $this->assertActionButton('examples/config-entity-example');
-
- // Verify links on Edit Robot.
- $this->drupalGet('/examples/config-entity-example/manage/robby_machine_name');
- $this->assertLinkByHref('/examples/config-entity-example/manage/robby_machine_name/delete');
- $this->assertActionButton('examples/config-entity-example');
-
- // Verify links on Delete Robot.
- $this->drupalGet('/examples/config-entity-example/manage/robby_machine_name/delete');
- // List page will be the destination of the cancel link.
- $cancel_button = $this->xpath(
- '//a[@id="edit-cancel" and contains(@href, :path)]',
- [':path' => '/examples/config-entity-example']
- );
- $this->assertEqual(count($cancel_button), 1, 'Found cancel button linking to list page.');
-
- // Try to submit a robot with a machine name of 'custom'. This is a reserved
- // keyword we've disallowed in the form.
- $this->drupalPostForm(
- Url::fromRoute('entity.robot.add_form'),
- [
- 'label' => 'Custom',
- 'id' => 'custom',
- 'floopy' => TRUE,
- ],
- 'Create Robot'
- );
- $assert->pageTextContains('Additionally, it can not be the reserved word "custom".');
-
- }
-
- /**
- * Wrap an assertion for the action button.
- *
- * @param string $path
- * Drupal path to a page.
- */
- protected function assertActionButton($path) {
- $button_element = $this->xpath(
- '//a[contains(@class, "button-action") and contains(@data-drupal-link-system-path, :path)]',
- [':path' => $path]
- );
- $this->assertEqual(count($button_element), 1, 'Found action button for path: ' . $path);
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/tests/src/Functional/RobotReferenceTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/tests/src/Functional/RobotReferenceTest.php
deleted file mode 100644
index 8ad3162fc..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/config_entity_example/tests/src/Functional/RobotReferenceTest.php
+++ /dev/null
@@ -1,88 +0,0 @@
-assertSession();
-
- $type = $this->createContentType();
-
- $this->drupalLogin($this->createUser([
- 'create ' . $type->id() . ' content',
- 'administer node fields',
- ]));
-
- // - Go to the "manage fields" section of a content entity.
- $this->drupalGet('admin/structure/types/manage/' . $type->id() . '/fields');
- $assert->statusCodeEquals(200);
-
- // - Click on the "add field" button.
- $this->clickLink('Add field');
-
- // - Under "Reference" select "other".
- // - Choose a label and click continue.
- $this->drupalPostForm(NULL, [
- 'new_storage_type' => 'entity_reference',
- 'field_name' => 'robot_reference',
- 'label' => 'robot_reference',
- ], 'Save and continue');
- $assert->statusCodeEquals(200);
-
- // - Under configuration select "robot".
- $this->drupalPostForm(NULL, [
- 'settings[target_type]' => 'robot',
- ], 'Save field settings');
- $assert->statusCodeEquals(200);
-
- // - Create a content entity containing the created reference field. Select
- // "Marvin, the paranoid android".
- // - Click save.
- $robot = Robot::loadMultiple();
- /* @var $robot \Drupal\config_entity_example\Entity\Robot */
- $robot = reset($robot);
- $this->drupalPostForm(Url::fromRoute('node.add', ['node_type' => $type->id()]), [
- 'title[0][value]' => 'title',
- 'field_robot_reference[0][target_id]' => $robot->label(),
- ], 'Save');
- $assert->statusCodeEquals(200);
- $assert->pageTextContains($robot->label());
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/content_entity_example.info.yml b/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/content_entity_example.info.yml
deleted file mode 100644
index bf46f26d9..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/content_entity_example.info.yml
+++ /dev/null
@@ -1,15 +0,0 @@
-name: Content Entity Example
-type: module
-description: Demonstrates how to create a content entity.
-package: Example modules
-core_version_requirement: ^8.7.7 || ^9
-# These modules are required by the tests, must be available at bootstrap time
-dependencies:
- - drupal:options
- - drupal:user
- - examples:examples
-
-# Information added by Drupal.org packaging script on 2021-10-07
-version: '3.0.3'
-project: 'examples'
-datestamp: 1633612832
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/content_entity_example.links.action.yml b/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/content_entity_example.links.action.yml
deleted file mode 100644
index d1ead9d33..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/content_entity_example.links.action.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-# All action links for this module
-
-content_entity_example.contact_add:
- # Which route will be called by the link
- route_name: content_entity_example.contact_add
- title: 'Add contact'
-
- # Where will the link appear, defined by route name.
- appears_on:
- - entity.content_entity_example_contact.collection
- - entity.content_entity_example_contact.canonical
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/content_entity_example.links.menu.yml b/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/content_entity_example.links.menu.yml
deleted file mode 100644
index 5f38fbe04..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/content_entity_example.links.menu.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-# Define the menu links for this module
-
-entity.content_entity_example_contact.collection:
- title: 'Content Entity Example'
- route_name: entity.content_entity_example_contact.collection
- description: 'List contacts'
-content_entity_example_contact.admin.structure.settings:
- title: 'Contact settings'
- description: 'Configure contact entity'
- route_name: content_entity_example.contact_settings
- parent: system.admin_structure
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/content_entity_example.links.task.yml b/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/content_entity_example.links.task.yml
deleted file mode 100644
index a76cf585a..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/content_entity_example.links.task.yml
+++ /dev/null
@@ -1,22 +0,0 @@
-# Define the 'local' links for the module
-
-contact.settings_tab:
- route_name: content_entity_example.contact_settings
- title: Settings
- base_route: content_entity_example.contact_settings
-
-contact.view:
- route_name: entity.content_entity_example_contact.canonical
- base_route: entity.content_entity_example_contact.canonical
- title: View
-
-contact.page_edit:
- route_name: entity.content_entity_example_contact.edit_form
- base_route: entity.content_entity_example_contact.canonical
- title: Edit
-
-contact.delete_confirm:
- route_name: entity.content_entity_example_contact.delete_form
- base_route: entity.content_entity_example_contact.canonical
- title: Delete
- weight: 10
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/content_entity_example.module b/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/content_entity_example.module
deleted file mode 100644
index ff7e59a63..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/content_entity_example.module
+++ /dev/null
@@ -1,45 +0,0 @@
-entityType->getAdminPermission();
- if ($account->hasPermission($admin_permission)) {
- return AccessResult::allowed();
- }
- switch ($operation) {
- case 'view':
- return AccessResult::allowedIfHasPermission($account, 'view contact entity');
-
- case 'update':
- return AccessResult::allowedIfHasPermission($account, 'edit contact entity');
-
- case 'delete':
- return AccessResult::allowedIfHasPermission($account, 'delete contact entity');
- }
- return AccessResult::neutral();
- }
-
- /**
- * {@inheritdoc}
- *
- * Separate from the checkAccess because the entity does not yet exist. It
- * will be created during the 'add' process.
- */
- protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
- // Check the admin_permission as defined in your @ContentEntityType
- // annotation.
- $admin_permission = $this->entityType->getAdminPermission();
- if ($account->hasPermission($admin_permission)) {
- return AccessResult::allowed();
- }
- return AccessResult::allowedIfHasPermission($account, 'add contact entity');
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/src/ContactInterface.php b/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/src/ContactInterface.php
deleted file mode 100644
index e11caa14f..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/src/ContactInterface.php
+++ /dev/null
@@ -1,18 +0,0 @@
-.
- *
- * Example: 'entity.content_entity_example_contact.canonical'.
- *
- * See the routing file at content_entity_example.routing.yml for the
- * corresponding implementation.
- *
- * The Contact class defines methods and fields for the contact entity.
- *
- * Being derived from the ContentEntityBase class, we can override the methods
- * we want. In our case we want to provide access to the standard fields about
- * creation and changed time stamps.
- *
- * Our interface (see ContactInterface) also exposes the EntityOwnerInterface.
- * This allows us to provide methods for setting and providing ownership
- * information.
- *
- * The most important part is the definitions of the field properties for this
- * entity type. These are of the same type as fields added through the GUI, but
- * they can by changed in code. In the definition we can define if the user with
- * the rights privileges can influence the presentation (view, edit) of each
- * field.
- *
- * The class also uses the EntityChangedTrait trait which allows it to record
- * timestamps of save operations.
- */
-class Contact extends ContentEntityBase implements ContactInterface {
-
- use EntityChangedTrait;
-
- /**
- * {@inheritdoc}
- *
- * When a new entity instance is added, set the user_id entity reference to
- * the current user as the creator of the instance.
- */
- public static function preCreate(EntityStorageInterface $storage_controller, array &$values) {
- parent::preCreate($storage_controller, $values);
- $values += [
- 'user_id' => \Drupal::currentUser()->id(),
- ];
- }
-
- /**
- * {@inheritdoc}
- */
- public function getOwner() {
- return $this->get('user_id')->entity;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getOwnerId() {
- return $this->get('user_id')->target_id;
- }
-
- /**
- * {@inheritdoc}
- */
- public function setOwnerId($uid) {
- $this->set('user_id', $uid);
- return $this;
- }
-
- /**
- * {@inheritdoc}
- */
- public function setOwner(UserInterface $account) {
- $this->set('user_id', $account->id());
- return $this;
- }
-
- /**
- * {@inheritdoc}
- *
- * Define the field properties here.
- *
- * Field name, type and size determine the table structure.
- *
- * In addition, we can define how the field and its content can be manipulated
- * in the GUI. The behaviour of the widgets used can be determined here.
- */
- public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
-
- // Standard field, used as unique if primary index.
- $fields['id'] = BaseFieldDefinition::create('integer')
- ->setLabel(t('ID'))
- ->setDescription(t('The ID of the Contact entity.'))
- ->setReadOnly(TRUE);
-
- // Standard field, unique outside of the scope of the current project.
- $fields['uuid'] = BaseFieldDefinition::create('uuid')
- ->setLabel(t('UUID'))
- ->setDescription(t('The UUID of the Contact entity.'))
- ->setReadOnly(TRUE);
-
- // Name field for the contact.
- // We set display options for the view as well as the form.
- // Users with correct privileges can change the view and edit configuration.
- $fields['name'] = BaseFieldDefinition::create('string')
- ->setLabel(t('Name'))
- ->setDescription(t('The name of the Contact entity.'))
- ->setSettings([
- 'max_length' => 255,
- 'text_processing' => 0,
- ])
- // Set no default value.
- ->setDefaultValue(NULL)
- ->setDisplayOptions('view', [
- 'label' => 'above',
- 'type' => 'string',
- 'weight' => -6,
- ])
- ->setDisplayOptions('form', [
- 'type' => 'string_textfield',
- 'weight' => -6,
- ])
- ->setDisplayConfigurable('form', TRUE)
- ->setDisplayConfigurable('view', TRUE);
-
- $fields['first_name'] = BaseFieldDefinition::create('string')
- ->setLabel(t('First Name'))
- ->setDescription(t('The first name of the Contact entity.'))
- ->setSettings([
- 'max_length' => 255,
- 'text_processing' => 0,
- ])
- // Set no default value.
- ->setDefaultValue(NULL)
- ->setDisplayOptions('view', [
- 'label' => 'above',
- 'type' => 'string',
- 'weight' => -5,
- ])
- ->setDisplayOptions('form', [
- 'type' => 'string_textfield',
- 'weight' => -5,
- ])
- ->setDisplayConfigurable('form', TRUE)
- ->setDisplayConfigurable('view', TRUE);
-
- // Owner field of the contact.
- // Entity reference field, holds the reference to the user object.
- // The view shows the user name field of the user.
- // The form presents a auto complete field for the user name.
- $fields['user_id'] = BaseFieldDefinition::create('entity_reference')
- ->setLabel(t('User Name'))
- ->setDescription(t('The Name of the associated user.'))
- ->setSetting('target_type', 'user')
- ->setSetting('handler', 'default')
- ->setDisplayOptions('view', [
- 'label' => 'above',
- 'type' => 'author',
- 'weight' => -3,
- ])
- ->setDisplayOptions('form', [
- 'type' => 'entity_reference_autocomplete',
- 'settings' => [
- 'match_operator' => 'CONTAINS',
- 'match_limit' => 10,
- 'size' => 60,
- 'placeholder' => '',
- ],
- 'weight' => -3,
- ])
- ->setDisplayConfigurable('form', TRUE)
- ->setDisplayConfigurable('view', TRUE);
-
- // Role field for the contact.
- // The values shown in options are 'administrator' and 'user'.
- $fields['role'] = BaseFieldDefinition::create('list_string')
- ->setLabel(t('Role'))
- ->setDescription(t('The role of the Contact entity.'))
- ->setSettings([
- 'allowed_values' => [
- 'administrator' => 'administrator',
- 'user' => 'user',
- ],
- ])
- // Set the default value of this field to 'user'.
- ->setDefaultValue('user')
- ->setDisplayOptions('view', [
- 'label' => 'above',
- 'type' => 'string',
- 'weight' => -2,
- ])
- ->setDisplayOptions('form', [
- 'type' => 'options_select',
- 'weight' => -2,
- ])
- ->setDisplayConfigurable('form', TRUE)
- ->setDisplayConfigurable('view', TRUE);
-
- $fields['langcode'] = BaseFieldDefinition::create('language')
- ->setLabel(t('Language code'))
- ->setDescription(t('The language code of ContentEntityExample entity.'));
- $fields['created'] = BaseFieldDefinition::create('created')
- ->setLabel(t('Created'))
- ->setDescription(t('The time that the entity was created.'));
-
- $fields['changed'] = BaseFieldDefinition::create('changed')
- ->setLabel(t('Changed'))
- ->setDescription(t('The time that the entity was last edited.'));
-
- return $fields;
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/src/Entity/Controller/ContactListBuilder.php b/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/src/Entity/Controller/ContactListBuilder.php
deleted file mode 100644
index 8866b3a3b..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/src/Entity/Controller/ContactListBuilder.php
+++ /dev/null
@@ -1,97 +0,0 @@
-get('entity_type.manager')->getStorage($entity_type->id()),
- $container->get('url_generator')
- );
- }
-
- /**
- * Constructs a new ContactListBuilder object.
- *
- * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
- * The entity type definition.
- * @param \Drupal\Core\Entity\EntityStorageInterface $storage
- * The entity storage class.
- * @param \Drupal\Core\Routing\UrlGeneratorInterface $url_generator
- * The url generator.
- */
- public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, UrlGeneratorInterface $url_generator) {
- parent::__construct($entity_type, $storage);
- $this->urlGenerator = $url_generator;
- }
-
- /**
- * {@inheritdoc}
- *
- * We override ::render() so that we can add our own content above the table.
- * parent::render() is where EntityListBuilder creates the table using our
- * buildHeader() and buildRow() implementations.
- */
- public function render() {
- $build['description'] = [
- '#markup' => $this->t('Content Entity Example implements a Contacts model. These contacts are fieldable entities. You can manage the fields on the Contacts admin page.', [
- '@adminlink' => $this->urlGenerator->generateFromRoute('content_entity_example.contact_settings'),
- ]),
- ];
- $build['table'] = parent::render();
- return $build;
- }
-
- /**
- * {@inheritdoc}
- *
- * Building the header and content lines for the contact list.
- *
- * Calling the parent::buildHeader() adds a column for the possible actions
- * and inserts the 'edit' and 'delete' links as defined for the entity type.
- */
- public function buildHeader() {
- $header['id'] = $this->t('ContactID');
- $header['name'] = $this->t('Name');
- $header['first_name'] = $this->t('First Name');
- $header['role'] = $this->t('Role');
- return $header + parent::buildHeader();
- }
-
- /**
- * {@inheritdoc}
- */
- public function buildRow(EntityInterface $entity) {
- /* @var $entity \Drupal\content_entity_example\Entity\Contact */
- $row['id'] = $entity->id();
- $row['name'] = $entity->toLink()->toString();
- $row['first_name'] = $entity->first_name->value;
- $row['role'] = $entity->role->value;
- return $row + parent::buildRow($entity);
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/src/Form/ContactDeleteForm.php b/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/src/Form/ContactDeleteForm.php
deleted file mode 100644
index c224dc21b..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/src/Form/ContactDeleteForm.php
+++ /dev/null
@@ -1,56 +0,0 @@
-t('Are you sure you want to delete entity %name?', ['%name' => $this->entity->label()]);
- }
-
- /**
- * {@inheritdoc}
- *
- * If the delete command is canceled, return to the contact list.
- */
- public function getCancelUrl() {
- return new Url('entity.content_entity_example_contact.collection');
- }
-
- /**
- * {@inheritdoc}
- */
- public function getConfirmText() {
- return $this->t('Delete');
- }
-
- /**
- * {@inheritdoc}
- *
- * Delete the entity and log the event. logger() replaces the watchdog.
- */
- public function submitForm(array &$form, FormStateInterface $form_state) {
- $entity = $this->getEntity();
- $entity->delete();
-
- $this->logger('content_entity_example')->notice('@type: deleted %title.',
- [
- '@type' => $this->entity->bundle(),
- '%title' => $this->entity->label(),
- ]);
- $form_state->setRedirect('entity.content_entity_example_contact.collection');
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/src/Form/ContactForm.php b/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/src/Form/ContactForm.php
deleted file mode 100644
index e35a4624c..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/src/Form/ContactForm.php
+++ /dev/null
@@ -1,42 +0,0 @@
-entity;
-
- $form['langcode'] = [
- '#title' => $this->t('Language'),
- '#type' => 'language_select',
- '#default_value' => $entity->getUntranslated()->language()->getId(),
- '#languages' => Language::STATE_ALL,
- ];
- return $form;
- }
-
- /**
- * {@inheritdoc}
- */
- public function save(array $form, FormStateInterface $form_state) {
- $form_state->setRedirect('entity.content_entity_example_contact.collection');
- $entity = $this->getEntity();
- $entity->save();
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/src/Form/ContactSettingsForm.php b/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/src/Form/ContactSettingsForm.php
deleted file mode 100644
index d271451c4..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/src/Form/ContactSettingsForm.php
+++ /dev/null
@@ -1,40 +0,0 @@
-assertSession();
-
- $web_user = $this->drupalCreateUser([
- 'add contact entity',
- 'edit contact entity',
- 'view contact entity',
- 'delete contact entity',
- 'administer contact entity',
- 'administer content_entity_example_contact display',
- 'administer content_entity_example_contact fields',
- 'administer content_entity_example_contact form display',
- ]);
-
- // Anonymous User should not see the link to the listing.
- $assert->pageTextNotContains('Content Entity Example');
-
- $this->drupalLogin($web_user);
-
- // Web_user user has the right to view listing.
- $assert->linkExists('Content Entity Example');
-
- $this->clickLink('Content Entity Example');
-
- // WebUser can add entity content.
- $assert->linkExists('Add contact');
-
- $this->clickLink($this->t('Add contact'));
-
- $assert->fieldValueEquals('name[0][value]', '');
- $assert->fieldValueEquals('name[0][value]', '');
- $assert->fieldValueEquals('name[0][value]', '');
- $assert->fieldValueEquals('name[0][value]', '');
-
- $user_ref = $web_user->name->value . ' (' . $web_user->id() . ')';
- $assert->fieldValueEquals('user_id[0][target_id]', $user_ref);
-
- // Post content, save an instance. Go back to list after saving.
- $edit = [
- 'name[0][value]' => 'test name',
- 'first_name[0][value]' => 'test first name',
- 'role' => 'administrator',
- ];
- $this->drupalPostForm(NULL, $edit, 'Save');
-
- // Entity listed.
- $assert->linkExists('Edit');
- $assert->linkExists('Delete');
-
- $this->clickLink('test name');
-
- // Entity shown.
- $assert->pageTextContains('test name');
- $assert->pageTextContains('test first name');
- $assert->pageTextContains('administrator');
- $assert->linkExists('Add contact');
- $assert->linkExists('Edit');
- $assert->linkExists('Delete');
-
- // Delete the entity.
- $this->clickLink('Delete');
-
- // Confirm deletion.
- $assert->linkExists('Cancel');
- $this->drupalPostForm(NULL, [], 'Delete');
-
- // Back to list, must be empty.
- $assert->pageTextNotContains('test name');
-
- // Settings page.
- $this->drupalGet('admin/structure/content_entity_example_contact_settings');
- $assert->pageTextContains('Contact Settings');
-
- // Make sure the field manipulation links are available.
- $assert->linkExists('Settings');
- $assert->linkExists('Manage fields');
- $assert->linkExists('Manage form display');
- $assert->linkExists('Manage display');
- }
-
- /**
- * Test all paths exposed by the module, by permission.
- */
- public function testPaths() {
- $assert = $this->assertSession();
-
- // Generate a contact so that we can test the paths against it.
- $contact = Contact::create([
- 'name' => 'somename',
- 'first_name' => 'Joe',
- 'role' => 'administrator',
- ]);
- $contact->save();
-
- // Gather the test data.
- $data = $this->providerTestPaths($contact->id());
-
- // Run the tests.
- foreach ($data as $datum) {
- // drupalCreateUser() doesn't know what to do with an empty permission
- // array, so we help it out.
- if ($datum[2]) {
- $user = $this->drupalCreateUser([$datum[2]]);
- $this->drupalLogin($user);
- }
- else {
- $user = $this->drupalCreateUser();
- $this->drupalLogin($user);
- }
- $this->drupalGet($datum[1]);
- $assert->statusCodeEquals($datum[0]);
- }
- }
-
- /**
- * Data provider for testPaths.
- *
- * @param int $contact_id
- * The id of an existing Contact entity.
- *
- * @return array
- * Nested array of testing data. Arranged like this:
- * - Expected response code.
- * - Path to request.
- * - Permission for the user.
- */
- protected function providerTestPaths($contact_id) {
- return [
- [
- 200,
- '/content_entity_example_contact/' . $contact_id,
- 'view contact entity',
- ],
- [
- 403,
- '/content_entity_example_contact/' . $contact_id,
- '',
- ],
- [
- 200,
- '/content_entity_example_contact/list',
- 'view contact entity',
- ],
- [
- 403,
- '/content_entity_example_contact/list',
- '',
- ],
- [
- 200,
- '/content_entity_example_contact/add',
- 'add contact entity',
- ],
- [
- 403,
- '/content_entity_example_contact/add',
- '',
- ],
- [
- 200,
- '/content_entity_example_contact/' . $contact_id . '/edit',
- 'edit contact entity',
- ],
- [
- 403,
- '/content_entity_example_contact/' . $contact_id . '/edit',
- '',
- ],
- [
- 200,
- '/contact/' . $contact_id . '/delete',
- 'delete contact entity',
- ],
- [
- 403,
- '/contact/' . $contact_id . '/delete',
- '',
- ],
- [
- 200,
- 'admin/structure/content_entity_example_contact_settings',
- 'administer contact entity',
- ],
- [
- 403,
- 'admin/structure/content_entity_example_contact_settings',
- '',
- ],
- ];
- }
-
- /**
- * Test add new fields to the contact entity.
- */
- public function testAddFields() {
- $web_user = $this->drupalCreateUser([
- 'administer contact entity',
- 'administer content_entity_example_contact display',
- 'administer content_entity_example_contact fields',
- 'administer content_entity_example_contact form display',
- ]);
-
- $this->drupalLogin($web_user);
- $entity_name = 'content_entity_example_contact';
- $add_field_url = 'admin/structure/' . $entity_name . '_settings/fields/add-field';
- $this->drupalGet($add_field_url);
- $field_name = 'test_name';
- $edit = [
- 'new_storage_type' => 'list_string',
- 'label' => 'test name',
- 'field_name' => $field_name,
- ];
-
- $this->drupalPostForm(NULL, $edit, 'Save and continue');
- $expected_path = $this->buildUrl('admin/structure/' . $entity_name . '_settings/fields/' . $entity_name . '.' . $entity_name . '.field_' . $field_name . '/storage');
-
- // Fetch url without query parameters.
- $current_path = strtok($this->getUrl(), '?');
- $this->assertEquals($expected_path, $current_path);
- }
-
- /**
- * Ensure admin and permissioned users can create contacts.
- */
- public function testCreateAdminPermission() {
- $assert = $this->assertSession();
- $add_url = Url::fromRoute('content_entity_example.contact_add');
-
- // Create a Contact entity object so that we can query it for it's annotated
- // properties. We don't need to save it.
- /* @var $contact \Drupal\content_entity_example\Entity\Contact */
- $contact = Contact::create();
-
- // Create an admin user and log them in. We use the entity annotation for
- // admin_permission in order to validate it. We also have to add the view
- // list permission because the add form redirects to the list on success.
- $this->drupalLogin($this->drupalCreateUser([
- $contact->getEntityType()->getAdminPermission(),
- 'view contact entity',
- ]));
-
- // Post a contact.
- $edit = [
- 'name[0][value]' => 'Test Admin Name',
- 'first_name[0][value]' => 'Admin First Name',
- 'role' => 'administrator',
- ];
- $this->drupalPostForm($add_url, $edit, 'Save');
- $assert->statusCodeEquals(200);
- $assert->pageTextContains('Test Admin Name');
-
- // Create a user with 'add contact entity' permission. We also have to add
- // the view list permission because the add form redirects to the list on
- // success.
- $this->drupalLogin($this->drupalCreateUser([
- 'add contact entity',
- 'view contact entity',
- ]));
-
- // Post a contact.
- $edit = [
- 'name[0][value]' => 'Mere Mortal Name',
- 'first_name[0][value]' => 'Mortal First Name',
- 'role' => 'user',
- ];
- $this->drupalPostForm($add_url, $edit, 'Save');
- $assert->statusCodeEquals(200);
- $assert->pageTextContains('Mere Mortal Name');
-
- // Finally, a user who can only view should not be able to get to the add
- // form.
- $this->drupalLogin($this->drupalCreateUser([
- 'view contact entity',
- ]));
- $this->drupalGet($add_url);
- $assert->statusCodeEquals(403);
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/tests/src/Kernel/ContactTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/tests/src/Kernel/ContactTest.php
deleted file mode 100644
index 0ceff3f8d..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/content_entity_example/tests/src/Kernel/ContactTest.php
+++ /dev/null
@@ -1,48 +0,0 @@
-installEntitySchema('content_entity_example_contact');
- $entity = Contact::create([
- 'name' => 'Name',
- 'first_name' => 'Firstname',
- 'user_id' => 0,
- 'role' => 'user',
- ]);
- $this->assertNotNull($entity);
- $this->assertEquals(SAVED_NEW, $entity->save());
- $this->assertEquals(SAVED_UPDATED, $entity->set('role', 'administrator')->save());
- $entity_id = $entity->id();
- $this->assertNotEmpty($entity_id);
- $entity->delete();
- $this->assertNull(Contact::load($entity_id));
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/config/install/cron_example.settings.yml b/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/config/install/cron_example.settings.yml
deleted file mode 100644
index 8527484d1..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/config/install/cron_example.settings.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-# Default form values for \Drupal\cron_example\Form\CronExampleForm.
-# @see examples/cron_example/config/schema/cron_example.schema.yml
-# @see \Drupal\cron_example\Form\CronExampleForm::getEditableConfigNames()
-interval: 300
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/config/schema/cron_example.schema.yml b/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/config/schema/cron_example.schema.yml
deleted file mode 100644
index f80c92cfc..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/config/schema/cron_example.schema.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-# Set configuration defaults. This schema describes the cron_example.settings
-# config. The defaults for this config are set in
-# config/install/cron_example.settings.yml and then used by
-# \Drupal\cron_example\Form\CronExampleForm.
-# @see https://www.drupal.org/node/1905070
-cron_example.settings:
- type: config_object
- label: 'Cron Example settings'
- mapping:
- interval:
- type: integer
- label: 'Period between cron runs'
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/cron_example.info.yml b/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/cron_example.info.yml
deleted file mode 100644
index eeb4cc117..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/cron_example.info.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-name: Cron Example
-type: module
-description: 'Demonstrates hook_cron() and related features'
-package: Example modules
-core_version_requirement: ^8.7.7 || ^9
-dependencies:
- - drupal:node
- - examples:examples
-
-# Information added by Drupal.org packaging script on 2021-10-07
-version: '3.0.3'
-project: 'examples'
-datestamp: 1633612832
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/cron_example.links.menu.yml b/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/cron_example.links.menu.yml
deleted file mode 100644
index 951c8fba3..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/cron_example.links.menu.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-cron_example.description:
- title: Cron Example
- route_name: cron_example.description
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/cron_example.module b/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/cron_example.module
deleted file mode 100644
index bfa615084..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/cron_example.module
+++ /dev/null
@@ -1,55 +0,0 @@
-get('interval');
- $interval = !empty($interval) ? $interval : 3600;
-
- // We usually don't want to act every time cron runs (which could be every
- // minute) so keep a time for the next run in the site state.
- $next_execution = \Drupal::state()->get('cron_example.next_execution', 0);
- if (REQUEST_TIME >= $next_execution) {
- // This is a silly example of a cron job.
- // It just makes it obvious that the job has run without
- // making any changes to your database.
- \Drupal::logger('cron_example')->notice('cron_example ran');
- if (\Drupal::state()->get('cron_example_show_status_message')) {
- \Drupal::messenger()->addMessage(t('cron_example executed at %time', ['%time' => date('c')]));
- \Drupal::state()->set('cron_example_show_status_message', FALSE);
- }
- \Drupal::state()->set('cron_example.next_execution', REQUEST_TIME + $interval);
- }
-}
-
-/**
- * @} End of "defgroup cron_example".
- */
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/cron_example.routing.yml b/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/cron_example.routing.yml
deleted file mode 100644
index 77ca419d0..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/cron_example.routing.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-cron_example.description:
- path: '/examples/cron-example'
- defaults:
- _form: '\Drupal\cron_example\Form\CronExampleForm'
- _title: 'Cron Example'
- requirements:
- _permission: 'access content'
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/src/Form/CronExampleForm.php b/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/src/Form/CronExampleForm.php
deleted file mode 100644
index b86ae14ce..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/src/Form/CronExampleForm.php
+++ /dev/null
@@ -1,256 +0,0 @@
-currentUser = $current_user;
- $this->cron = $cron;
- $this->queue = $queue;
- $this->state = $state;
-
- }
-
- /**
- * {@inheritdoc}
- */
- public static function create(ContainerInterface $container) {
- $form = new static(
- $container->get('config.factory'),
- $container->get('current_user'),
- $container->get('cron'),
- $container->get('queue'),
- $container->get('state')
- );
- $form->setMessenger($container->get('messenger'));
- return $form;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getFormId() {
- return 'cron_example';
- }
-
- /**
- * {@inheritdoc}
- */
- public function buildForm(array $form, FormStateInterface $form_state) {
- $config = $this->config('cron_example.settings');
-
- $form['status'] = [
- '#type' => 'details',
- '#title' => $this->t('Cron status information'),
- '#open' => TRUE,
- ];
- $form['status']['intro'] = [
- '#type' => 'item',
- '#markup' => $this->t('The cron example demonstrates hook_cron() and hook_queue_info() processing. If you have administrative privileges you can run cron from this page and see the results.'),
- ];
-
- $next_execution = $this->state->get('cron_example.next_execution');
- $next_execution = !empty($next_execution) ? $next_execution : REQUEST_TIME;
-
- $args = [
- '%time' => date('c', $this->state->get('cron_example.next_execution')),
- '%seconds' => $next_execution - REQUEST_TIME,
- ];
- $form['status']['last'] = [
- '#type' => 'item',
- '#markup' => $this->t('cron_example_cron() will next execute the first time cron runs after %time (%seconds seconds from now)', $args),
- ];
-
- if ($this->currentUser->hasPermission('administer site configuration')) {
- $form['cron_run'] = [
- '#type' => 'details',
- '#title' => $this->t('Run cron manually'),
- '#open' => TRUE,
- ];
- $form['cron_run']['cron_reset'] = [
- '#type' => 'checkbox',
- '#title' => $this->t("Run cron_example's cron regardless of whether interval has expired."),
- '#default_value' => FALSE,
- ];
- $form['cron_run']['cron_trigger']['actions'] = ['#type' => 'actions'];
- $form['cron_run']['cron_trigger']['actions']['sumbit'] = [
- '#type' => 'submit',
- '#value' => $this->t('Run cron now'),
- '#submit' => [[$this, 'cronRun']],
- ];
- }
-
- $form['cron_queue_setup'] = [
- '#type' => 'details',
- '#title' => $this->t('Cron queue setup (for hook_cron_queue_info(), etc.)'),
- '#open' => TRUE,
- ];
-
- $queue_1 = $this->queue->get('cron_example_queue_1');
- $queue_2 = $this->queue->get('cron_example_queue_2');
-
- $args = [
- '%queue_1' => $queue_1->numberOfItems(),
- '%queue_2' => $queue_2->numberOfItems(),
- ];
- $form['cron_queue_setup']['current_cron_queue_status'] = [
- '#type' => 'item',
- '#markup' => $this->t('There are currently %queue_1 items in queue 1 and %queue_2 items in queue 2', $args),
- ];
- $form['cron_queue_setup']['num_items'] = [
- '#type' => 'select',
- '#title' => $this->t('Number of items to add to queue'),
- '#options' => array_combine([1, 5, 10, 100, 1000], [1, 5, 10, 100, 1000]),
- '#default_value' => 5,
- ];
- $form['cron_queue_setup']['queue'] = [
- '#type' => 'radios',
- '#title' => $this->t('Queue to add items to'),
- '#options' => [
- 'cron_example_queue_1' => $this->t('Queue 1'),
- 'cron_example_queue_2' => $this->t('Queue 2'),
- ],
- '#default_value' => 'cron_example_queue_1',
- ];
- $form['cron_queue_setup']['actions'] = ['#type' => 'actions'];
- $form['cron_queue_setup']['actions']['submit'] = [
- '#type' => 'submit',
- '#value' => $this->t('Add jobs to queue'),
- '#submit' => [[$this, 'addItems']],
- ];
-
- $form['configuration'] = [
- '#type' => 'details',
- '#title' => $this->t('Configuration of cron_example_cron()'),
- '#open' => TRUE,
- ];
- $form['configuration']['cron_example_interval'] = [
- '#type' => 'select',
- '#title' => $this->t('Cron interval'),
- '#description' => $this->t('Time after which cron_example_cron will respond to a processing request.'),
- '#default_value' => $config->get('interval'),
- '#options' => [
- 60 => $this->t('1 minute'),
- 300 => $this->t('5 minutes'),
- 3600 => $this->t('1 hour'),
- 86400 => $this->t('1 day'),
- ],
- ];
-
- return parent::buildForm($form, $form_state);
- }
-
- /**
- * Allow user to directly execute cron, optionally forcing it.
- */
- public function cronRun(array &$form, FormStateInterface &$form_state) {
- $cron_reset = $form_state->getValue('cron_reset');
- if (!empty($cron_reset)) {
- $this->state->set('cron_example.next_execution', 0);
- }
-
- // Use a state variable to signal that cron was run manually from this form.
- $this->state->set('cron_example_show_status_message', TRUE);
- if ($this->cron->run()) {
- $this->messenger()->addMessage($this->t('Cron ran successfully.'));
- }
- else {
- $this->messenger()->addError($this->t('Cron run failed.'));
- }
- }
-
- /**
- * Add the items to the queue when signaled by the form.
- */
- public function addItems(array &$form, FormStateInterface &$form_state) {
- $values = $form_state->getValues();
- $queue_name = $form['cron_queue_setup']['queue'][$values['queue']]['#title'];
- $num_items = $form_state->getValue('num_items');
- // Queues are defined by a QueueWorker Plugin which are selected by their
- // id attritbute.
- // @see \Drupal\cron_example\Plugin\QueueWorker\ReportWorkerOne
- $queue = $this->queue->get($values['queue']);
-
- for ($i = 1; $i <= $num_items; $i++) {
- // Create a new item, a new data object, which is passed to the
- // QueueWorker's processItem() method.
- $item = new \stdClass();
- $item->created = REQUEST_TIME;
- $item->sequence = $i;
- $queue->createItem($item);
- }
-
- $args = [
- '%num' => $num_items,
- '%queue' => $queue_name,
- ];
- $this->messenger()->addMessage($this->t('Added %num items to %queue', $args));
- }
-
- /**
- * {@inheritdoc}
- */
- public function submitForm(array &$form, FormStateInterface $form_state) {
- // Update the interval as stored in configuration. This will be read when
- // this modules hook_cron function fires and will be used to ensure that
- // action is taken only after the appropiate time has elapsed.
- $this->config('cron_example.settings')
- ->set('interval', $form_state->getValue('cron_example_interval'))
- ->save();
-
- parent::submitForm($form, $form_state);
- }
-
- /**
- * {@inheritdoc}
- */
- protected function getEditableConfigNames() {
- return ['cron_example.settings'];
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/src/Plugin/QueueWorker/ReportWorkerBase.php b/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/src/Plugin/QueueWorker/ReportWorkerBase.php
deleted file mode 100644
index 0512f908f..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/src/Plugin/QueueWorker/ReportWorkerBase.php
+++ /dev/null
@@ -1,95 +0,0 @@
-state = $state;
- $this->logger = $logger;
- }
-
- /**
- * {@inheritdoc}
- */
- public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
- $form = new static(
- $configuration,
- $plugin_id,
- $plugin_definition,
- $container->get('state'),
- $container->get('logger.factory')
- );
- $form->setMessenger($container->get('messenger'));
- return $form;
- }
-
- /**
- * Simple reporter log and display information about the queue.
- *
- * @param int $worker
- * Worker number.
- * @param object $item
- * The $item which was stored in the cron queue.
- */
- protected function reportWork($worker, $item) {
- if ($this->state->get('cron_example_show_status_message')) {
- $this->messenger()->addMessage(
- $this->t('Queue @worker worker processed item with sequence @sequence created at @time', [
- '@worker' => $worker,
- '@sequence' => $item->sequence,
- '@time' => date('c', $item->created),
- ])
- );
- }
- $this->logger->get('cron_example')->info('Queue @worker worker processed item with sequence @sequence created at @time', [
- '@worker' => $worker,
- '@sequence' => $item->sequence,
- '@time' => date('c', $item->created),
- ]);
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/src/Plugin/QueueWorker/ReportWorkerOne.php b/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/src/Plugin/QueueWorker/ReportWorkerOne.php
deleted file mode 100644
index 653223bd7..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/src/Plugin/QueueWorker/ReportWorkerOne.php
+++ /dev/null
@@ -1,29 +0,0 @@
-reportWork(1, $data);
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/src/Plugin/QueueWorker/ReportWorkerTwo.php b/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/src/Plugin/QueueWorker/ReportWorkerTwo.php
deleted file mode 100644
index b4fad9a2f..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/src/Plugin/QueueWorker/ReportWorkerTwo.php
+++ /dev/null
@@ -1,29 +0,0 @@
-reportWork(2, $data);
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/tests/src/Functional/CronExampleTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/tests/src/Functional/CronExampleTest.php
deleted file mode 100644
index 128a742a6..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/cron_example/tests/src/Functional/CronExampleTest.php
+++ /dev/null
@@ -1,89 +0,0 @@
-drupalLogin($this->drupalCreateUser(['administer site configuration', 'access content']));
- }
-
- /**
- * Create an example node, test block through admin and user interfaces.
- */
- public function testCronExampleBasic() {
- $assert = $this->assertSession();
-
- $cron_form = Url::fromRoute('cron_example.description');
-
- // Pretend that cron has never been run (even though simpletest seems to
- // run it once...).
- $this->container->get('state')->set('cron_example.next_execution', 0);
- $this->drupalGet($cron_form);
-
- // Initial run should cause cron_example_cron() to fire.
- $post = [];
- $this->drupalPostForm($cron_form, $post, 'Run cron now');
- $assert->pageTextContains('cron_example executed at');
-
- // Forcing should also cause cron_example_cron() to fire.
- $post['cron_reset'] = TRUE;
- $this->drupalPostForm(NULL, $post, 'Run cron now');
- $assert->pageTextContains('cron_example executed at');
-
- // But if followed immediately and not forced, it should not fire.
- $post['cron_reset'] = FALSE;
- $this->drupalPostForm(NULL, $post, 'Run cron now');
- $assert->statusCodeEquals(200);
- $assert->pageTextNotContains('cron_example executed at');
- $assert->pageTextContains('There are currently 0 items in queue 1 and 0 items in queue 2');
-
- $post = [
- 'num_items' => 5,
- 'queue' => 'cron_example_queue_1',
- ];
- $this->drupalPostForm(NULL, $post, 'Add jobs to queue');
- $assert->pageTextContains('There are currently 5 items in queue 1 and 0 items in queue 2');
-
- $post = [
- 'num_items' => 100,
- 'queue' => 'cron_example_queue_2',
- ];
- $this->drupalPostForm(NULL, $post, 'Add jobs to queue');
- $assert->pageTextContains('There are currently 5 items in queue 1 and 100 items in queue 2');
-
- $this->drupalPostForm($cron_form, [], 'Run cron now');
- $assert->responseMatches('/Queue 1 worker processed item with sequence 5 /');
- $assert->responseMatches('/Queue 2 worker processed item with sequence 100 /');
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/dbtng_example/dbtng_example.info.yml b/frontend/drupal9/web/modules/contrib/examples/modules/dbtng_example/dbtng_example.info.yml
deleted file mode 100644
index 7819af8b3..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/dbtng_example/dbtng_example.info.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-name: DBTNG Example
-type: module
-description: 'Demonstrates how to use the database API: DBTNG.'
-package: Example modules
-core_version_requirement: ^8.7.7 || ^9
-dependencies:
- - drupal:node
- - drupal:user
- - examples:examples
-
-# Information added by Drupal.org packaging script on 2021-10-07
-version: '3.0.3'
-project: 'examples'
-datestamp: 1633612832
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/dbtng_example/dbtng_example.install b/frontend/drupal9/web/modules/contrib/examples/modules/dbtng_example/dbtng_example.install
deleted file mode 100644
index 0c86b3383..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/dbtng_example/dbtng_example.install
+++ /dev/null
@@ -1,94 +0,0 @@
- 'John',
- 'surname' => 'Doe',
- 'age' => 0,
- ],
- [
- 'name' => 'John',
- 'surname' => 'Roe',
- 'age' => 100,
- 'uid' => 1,
- ],
- ];
-
- $connection = \Drupal::database();
- foreach ($entries as $entry) {
- $connection->insert('dbtng_example')->fields($entry)->execute();
- }
-}
-
-/**
- * Implements hook_schema().
- *
- * Defines the database tables used by this module.
- *
- * @see hook_schema()
- *
- * @ingroup dbtng_example
- */
-function dbtng_example_schema() {
- $schema['dbtng_example'] = [
- 'description' => 'Stores example person entries for demonstration purposes.',
- 'fields' => [
- 'pid' => [
- 'type' => 'serial',
- 'not null' => TRUE,
- 'description' => 'Primary Key: Unique person ID.',
- ],
- 'uid' => [
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- 'description' => "Creator user's {users}.uid",
- ],
- 'name' => [
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- 'description' => 'Name of the person.',
- ],
- 'surname' => [
- 'type' => 'varchar',
- 'length' => 255,
- 'not null' => TRUE,
- 'default' => '',
- 'description' => 'Surname of the person.',
- ],
- 'age' => [
- 'type' => 'int',
- 'not null' => TRUE,
- 'default' => 0,
- 'size' => 'tiny',
- 'description' => 'The age of the person in years.',
- ],
- ],
- 'primary key' => ['pid'],
- 'indexes' => [
- 'name' => ['name'],
- 'surname' => ['surname'],
- 'age' => ['age'],
- ],
- ];
-
- return $schema;
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/dbtng_example/dbtng_example.links.menu.yml b/frontend/drupal9/web/modules/contrib/examples/modules/dbtng_example/dbtng_example.links.menu.yml
deleted file mode 100644
index 64c2b6e8d..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/dbtng_example/dbtng_example.links.menu.yml
+++ /dev/null
@@ -1,25 +0,0 @@
-dbtng_example.description:
- title: DBTNG Example
- route_name: dbtng_example.generate_entry_list
- expanded: TRUE
-
-dbtng_example.list:
- title: List
- route_name: dbtng_example.list
- weight: 0
- parent: dbtng_example.description
-dbtng_example.add:
- title: Add entry
- route_name: dbtng_example.add
- weight: 1
- parent: dbtng_example.description
-dbtng_example.update:
- title: Update entry
- route_name: dbtng_example.update
- weight: 2
- parent: dbtng_example.description
-dbtng_example.advanced:
- title: Advanced list
- route_name: dbtng_example.advanced
- weight: 3
- parent: dbtng_example.description
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/dbtng_example/dbtng_example.module b/frontend/drupal9/web/modules/contrib/examples/modules/dbtng_example/dbtng_example.module
deleted file mode 100644
index 741da6e06..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/dbtng_example/dbtng_example.module
+++ /dev/null
@@ -1,35 +0,0 @@
-get('dbtng_example.repository'));
- $controller->setStringTranslation($container->get('string_translation'));
- return $controller;
- }
-
- /**
- * Construct a new controller.
- *
- * @param \Drupal\dbtng_example\DbtngExampleRepository $repository
- * The repository service.
- */
- public function __construct(DbtngExampleRepository $repository) {
- $this->repository = $repository;
- }
-
- /**
- * Render a list of entries in the database.
- */
- public function entryList() {
- $content = [];
-
- $content['message'] = [
- '#markup' => $this->t('Generate a list of all entries in the database. There is no filter in the query.'),
- ];
-
- $rows = [];
- $headers = [
- $this->t('Id'),
- $this->t('uid'),
- $this->t('Name'),
- $this->t('Surname'),
- $this->t('Age'),
- ];
-
- $entries = $this->repository->load();
-
- foreach ($entries as $entry) {
- // Sanitize each entry.
- $rows[] = array_map('Drupal\Component\Utility\Html::escape', (array) $entry);
- }
- $content['table'] = [
- '#type' => 'table',
- '#header' => $headers,
- '#rows' => $rows,
- '#empty' => $this->t('No entries available.'),
- ];
- // Don't cache this page.
- $content['#cache']['max-age'] = 0;
-
- return $content;
- }
-
- /**
- * Render a filtered list of entries in the database.
- */
- public function entryAdvancedList() {
- $content = [];
-
- $content['message'] = [
- '#markup' => $this->t('A more complex list of entries in the database. Only the entries with name = "John" and age older than 18 years are shown, the username of the person who created the entry is also shown.'),
- ];
-
- $headers = [
- $this->t('Id'),
- $this->t('Created by'),
- $this->t('Name'),
- $this->t('Surname'),
- $this->t('Age'),
- ];
-
- $rows = [];
-
- $entries = $this->repository->advancedLoad();
-
- foreach ($entries as $entry) {
- // Sanitize each entry.
- $rows[] = array_map('Drupal\Component\Utility\Html::escape', $entry);
- }
- $content['table'] = [
- '#type' => 'table',
- '#header' => $headers,
- '#rows' => $rows,
- '#attributes' => ['id' => 'dbtng-example-advanced-list'],
- '#empty' => $this->t('No entries available.'),
- ];
- // Don't cache this page.
- $content['#cache']['max-age'] = 0;
- return $content;
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/dbtng_example/src/DbtngExampleRepository.php b/frontend/drupal9/web/modules/contrib/examples/modules/dbtng_example/src/DbtngExampleRepository.php
deleted file mode 100644
index cf7c8a3a0..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/dbtng_example/src/DbtngExampleRepository.php
+++ /dev/null
@@ -1,261 +0,0 @@
-connection = $connection;
- $this->setStringTranslation($translation);
- $this->setMessenger($messenger);
- }
-
- /**
- * Save an entry in the database.
- *
- * Exception handling is shown in this example. It could be simplified
- * without the try/catch blocks, but since an insert will throw an exception
- * and terminate your application if the exception is not handled, it is best
- * to employ try/catch.
- *
- * @param array $entry
- * An array containing all the fields of the database record.
- *
- * @return int
- * The number of updated rows.
- *
- * @throws \Exception
- * When the database insert fails.
- */
- public function insert(array $entry) {
- try {
- $return_value = $this->connection->insert('dbtng_example')
- ->fields($entry)
- ->execute();
- }
- catch (\Exception $e) {
- $this->messenger()->addMessage($this->t('Insert failed. Message = %message', [
- '%message' => $e->getMessage(),
- ]), 'error');
- }
- return $return_value ?? NULL;
- }
-
- /**
- * Update an entry in the database.
- *
- * @param array $entry
- * An array containing all the fields of the item to be updated.
- *
- * @return int
- * The number of updated rows.
- */
- public function update(array $entry) {
- try {
- // Connection->update()...->execute() returns the number of rows updated.
- $count = $this->connection->update('dbtng_example')
- ->fields($entry)
- ->condition('pid', $entry['pid'])
- ->execute();
- }
- catch (\Exception $e) {
- $this->messenger()->addMessage($this->t('Update failed. Message = %message, query= %query', [
- '%message' => $e->getMessage(),
- '%query' => $e->query_string,
- ]
- ), 'error');
- }
- return $count ?? 0;
- }
-
- /**
- * Delete an entry from the database.
- *
- * @param array $entry
- * An array containing at least the person identifier 'pid' element of the
- * entry to delete.
- *
- * @see Drupal\Core\Database\Connection::delete()
- */
- public function delete(array $entry) {
- $this->connection->delete('dbtng_example')
- ->condition('pid', $entry['pid'])
- ->execute();
- }
-
- /**
- * Read from the database using a filter array.
- *
- * The standard function to perform reads for static queries is
- * Connection::query().
- *
- * Connection::query() uses an SQL query with placeholders and arguments as
- * parameters.
- *
- * Drupal DBTNG provides an abstracted interface that will work with a wide
- * variety of database engines.
- *
- * The following is a query which uses a string literal SQL query. The
- * placeholders will be substituted with the values in the array. Placeholders
- * are marked with a colon ':'. Table names are marked with braces, so that
- * Drupal's' multisite feature can add prefixes as needed.
- *
- * @code
- * // SELECT * FROM {dbtng_example} WHERE uid = 0 AND name = 'John'
- * \Drupal::database()->query(
- * "SELECT * FROM {dbtng_example} WHERE uid = :uid and name = :name",
- * [':uid' => 0, ':name' => 'John']
- * )->execute();
- * @endcode
- *
- * For more dynamic queries, Drupal provides Connection::select() API method,
- * so there are several ways to perform the same SQL query. See the
- * @link http://drupal.org/node/310075 handbook page on dynamic queries. @endlink
- * @code
- * // SELECT * FROM {dbtng_example} WHERE uid = 0 AND name = 'John'
- * \Drupal::database()->select('dbtng_example')
- * ->fields('dbtng_example')
- * ->condition('uid', 0)
- * ->condition('name', 'John')
- * ->execute();
- * @endcode
- *
- * Here is select() with named placeholders:
- * @code
- * // SELECT * FROM {dbtng_example} WHERE uid = 0 AND name = 'John'
- * $arguments = array(':name' => 'John', ':uid' => 0);
- * \Drupal::database()->select('dbtng_example')
- * ->fields('dbtng_example')
- * ->where('uid = :uid AND name = :name', $arguments)
- * ->execute();
- * @endcode
- *
- * Conditions are stacked and evaluated as AND and OR depending on the type of
- * query. For more information, read the conditional queries handbook page at:
- * http://drupal.org/node/310086
- *
- * The condition argument is an 'equal' evaluation by default, but this can be
- * altered:
- * @code
- * // SELECT * FROM {dbtng_example} WHERE age > 18
- * \Drupal::database()->select('dbtng_example')
- * ->fields('dbtng_example')
- * ->condition('age', 18, '>')
- * ->execute();
- * @endcode
- *
- * @param array $entry
- * An array containing all the fields used to search the entries in the
- * table.
- *
- * @return object
- * An object containing the loaded entries if found.
- *
- * @see Drupal\Core\Database\Connection::select()
- */
- public function load(array $entry = []) {
- // Read all the fields from the dbtng_example table.
- $select = $this->connection
- ->select('dbtng_example')
- // Add all the fields into our select query.
- ->fields('dbtng_example');
-
- // Add each field and value as a condition to this query.
- foreach ($entry as $field => $value) {
- $select->condition($field, $value);
- }
- // Return the result in object format.
- return $select->execute()->fetchAll();
- }
-
- /**
- * Load dbtng_example records joined with user records.
- *
- * DBTNG also helps processing queries that return several rows, providing the
- * found objects in the same query execution call.
- *
- * This function queries the database using a JOIN between users table and the
- * example entries, to provide the username that created the entry, and
- * creates a table with the results, processing each row.
- *
- * SELECT
- * e.pid as pid, e.name as name, e.surname as surname, e.age as age
- * u.name as username
- * FROM
- * {dbtng_example} e
- * JOIN
- * users u ON e.uid = u.uid
- * WHERE
- * e.name = 'John' AND e.age > 18
- *
- * @see Drupal\Core\Database\Connection::select()
- * @see http://drupal.org/node/310075
- */
- public function advancedLoad() {
- // Get a select query for our dbtng_example table. We supply an alias of e
- // (for 'example').
- $select = $this->connection->select('dbtng_example', 'e');
- // Join the users table, so we can get the entry creator's username.
- $select->join('users_field_data', 'u', 'e.uid = u.uid');
- // Select these specific fields for the output.
- $select->addField('e', 'pid');
- $select->addField('u', 'name', 'username');
- $select->addField('e', 'name');
- $select->addField('e', 'surname');
- $select->addField('e', 'age');
- // Filter only persons named "John".
- $select->condition('e.name', 'John');
- // Filter only persons older than 18 years.
- $select->condition('e.age', 18, '>');
- // Make sure we only get items 0-49, for scalability reasons.
- $select->range(0, 50);
-
- $entries = $select->execute()->fetchAll(\PDO::FETCH_ASSOC);
-
- return $entries;
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/dbtng_example/src/Form/DbtngExampleAddForm.php b/frontend/drupal9/web/modules/contrib/examples/modules/dbtng_example/src/Form/DbtngExampleAddForm.php
deleted file mode 100644
index 18fd77c48..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/dbtng_example/src/Form/DbtngExampleAddForm.php
+++ /dev/null
@@ -1,144 +0,0 @@
-get('dbtng_example.repository'),
- $container->get('current_user')
- );
- // The StringTranslationTrait trait manages the string translation service
- // for us. We can inject the service here.
- $form->setStringTranslation($container->get('string_translation'));
- $form->setMessenger($container->get('messenger'));
- return $form;
- }
-
- /**
- * Construct the new form object.
- */
- public function __construct(DbtngExampleRepository $repository, AccountProxyInterface $current_user) {
- $this->repository = $repository;
- $this->currentUser = $current_user;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getFormId() {
- return 'dbtng_add_form';
- }
-
- /**
- * {@inheritdoc}
- */
- public function buildForm(array $form, FormStateInterface $form_state) {
- $form = [];
-
- $form['message'] = [
- '#markup' => $this->t('Add an entry to the dbtng_example table.'),
- ];
-
- $form['add'] = [
- '#type' => 'fieldset',
- '#title' => $this->t('Add a person entry'),
- ];
- $form['add']['name'] = [
- '#type' => 'textfield',
- '#title' => $this->t('Name'),
- '#size' => 15,
- ];
- $form['add']['surname'] = [
- '#type' => 'textfield',
- '#title' => $this->t('Surname'),
- '#size' => 15,
- ];
- $form['add']['age'] = [
- '#type' => 'textfield',
- '#title' => $this->t('Age'),
- '#size' => 5,
- '#description' => $this->t("Values greater than 127 will cause an exception. Try it - it's a great example why exception handling is needed with DTBNG."),
- ];
- $form['add']['submit'] = [
- '#type' => 'submit',
- '#value' => $this->t('Add'),
- ];
-
- return $form;
- }
-
- /**
- * {@inheritdoc}
- */
- public function validateForm(array &$form, FormStateInterface $form_state) {
- // Verify that the user is logged-in.
- if ($this->currentUser->isAnonymous()) {
- $form_state->setError($form['add'], $this->t('You must be logged in to add values to the database.'));
- }
- // Confirm that age is numeric.
- if (!intval($form_state->getValue('age'))) {
- $form_state->setErrorByName('age', $this->t('Age needs to be a number'));
- }
- }
-
- /**
- * {@inheritdoc}
- */
- public function submitForm(array &$form, FormStateInterface $form_state) {
- // Gather the current user so the new record has ownership.
- $account = $this->currentUser;
- // Save the submitted entry.
- $entry = [
- 'name' => $form_state->getValue('name'),
- 'surname' => $form_state->getValue('surname'),
- 'age' => $form_state->getValue('age'),
- 'uid' => $account->id(),
- ];
- $return = $this->repository->insert($entry);
- if ($return) {
- $this->messenger()->addMessage($this->t('Created entry @entry', ['@entry' => print_r($entry, TRUE)]));
- }
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/dbtng_example/src/Form/DbtngExampleUpdateForm.php b/frontend/drupal9/web/modules/contrib/examples/modules/dbtng_example/src/Form/DbtngExampleUpdateForm.php
deleted file mode 100644
index c05d30a57..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/dbtng_example/src/Form/DbtngExampleUpdateForm.php
+++ /dev/null
@@ -1,181 +0,0 @@
-get('dbtng_example.repository'));
- $form->setStringTranslation($container->get('string_translation'));
- $form->setMessenger($container->get('messenger'));
- return $form;
- }
-
- /**
- * Construct the new form object.
- */
- public function __construct(DbtngExampleRepository $repository) {
- $this->repository = $repository;
- }
-
- /**
- * Sample UI to update a record.
- */
- public function buildForm(array $form, FormStateInterface $form_state) {
- // Wrap the form in a div.
- $form = [
- '#prefix' => '
',
- '#suffix' => '
',
- ];
- // Add some explanatory text to the form.
- $form['message'] = [
- '#markup' => $this->t('Demonstrates a database update operation.'),
- ];
- // Query for items to display.
- $entries = $this->repository->load();
- // Tell the user if there is nothing to display.
- if (empty($entries)) {
- $form['no_values'] = [
- '#value' => $this->t('No entries exist in the table dbtng_example table.'),
- ];
- return $form;
- }
-
- $keyed_entries = [];
- $options = [];
- foreach ($entries as $entry) {
- $options[$entry->pid] = $this->t('@pid: @name @surname (@age)', [
- '@pid' => $entry->pid,
- '@name' => $entry->name,
- '@surname' => $entry->surname,
- '@age' => $entry->age,
- ]);
- $keyed_entries[$entry->pid] = $entry;
- }
-
- // Grab the pid.
- $pid = $form_state->getValue('pid');
- // Use the pid to set the default entry for updating.
- $default_entry = !empty($pid) ? $keyed_entries[$pid] : $entries[0];
-
- // Save the entries into the $form_state. We do this so the AJAX callback
- // doesn't need to repeat the query.
- $form_state->setValue('entries', $keyed_entries);
-
- $form['pid'] = [
- '#type' => 'select',
- '#options' => $options,
- '#title' => $this->t('Choose entry to update'),
- '#default_value' => $default_entry->pid,
- '#ajax' => [
- 'wrapper' => 'updateform',
- 'callback' => [$this, 'updateCallback'],
- ],
- ];
-
- $form['name'] = [
- '#type' => 'textfield',
- '#title' => $this->t('Updated first name'),
- '#size' => 15,
- '#default_value' => $default_entry->name,
- ];
-
- $form['surname'] = [
- '#type' => 'textfield',
- '#title' => $this->t('Updated last name'),
- '#size' => 15,
- '#default_value' => $default_entry->surname,
- ];
- $form['age'] = [
- '#type' => 'textfield',
- '#title' => $this->t('Updated age'),
- '#size' => 4,
- '#default_value' => $default_entry->age,
- '#description' => $this->t('Values greater than 127 will cause an exception'),
- ];
-
- $form['submit'] = [
- '#type' => 'submit',
- '#value' => $this->t('Update'),
- ];
- return $form;
- }
-
- /**
- * AJAX callback handler for the pid select.
- *
- * When the pid changes, populates the defaults from the database in the form.
- */
- public function updateCallback(array $form, FormStateInterface $form_state) {
- // Gather the DB results from $form_state.
- $entries = $form_state->getValue('entries');
- // Use the specific entry for this $form_state.
- $entry = $entries[$form_state->getValue('pid')];
- // Setting the #value of items is the only way I was able to figure out
- // to get replaced defaults on these items. #default_value will not do it
- // and shouldn't.
- foreach (['name', 'surname', 'age'] as $item) {
- $form[$item]['#value'] = $entry->$item;
- }
- return $form;
- }
-
- /**
- * {@inheritdoc}
- */
- public function validateForm(array &$form, FormStateInterface $form_state) {
- // Confirm that age is numeric.
- if (!intval($form_state->getValue('age'))) {
- $form_state->setErrorByName('age', $this->t('Age needs to be a number'));
- }
- }
-
- /**
- * {@inheritdoc}
- */
- public function submitForm(array &$form, FormStateInterface $form_state) {
- // Gather the current user so the new record has ownership.
- $account = $this->currentUser();
- // Save the submitted entry.
- $entry = [
- 'pid' => $form_state->getValue('pid'),
- 'name' => $form_state->getValue('name'),
- 'surname' => $form_state->getValue('surname'),
- 'age' => $form_state->getValue('age'),
- 'uid' => $account->id(),
- ];
- $count = $this->repository->update($entry);
- $this->messenger()->addMessage($this->t('Updated entry @entry (@count row updated)', [
- '@count' => $count,
- '@entry' => print_r($entry, TRUE),
- ]));
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/dbtng_example/tests/src/Functional/DbtngExampleTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/dbtng_example/tests/src/Functional/DbtngExampleTest.php
deleted file mode 100644
index e77966977..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/dbtng_example/tests/src/Functional/DbtngExampleTest.php
+++ /dev/null
@@ -1,152 +0,0 @@
-assertSession();
-
- // Assert that two entries were inserted at install.
- $result = $this->container->get('dbtng_example.repository')->load();
- $this->assertCount(2, $result, 'Did not find two entries in the table after installing the module.');
-
- // Test the example description page.
- $this->drupalGet('/examples/dbtng-example');
- $assert->statusCodeEquals(200);
-
- // Verify and validate that default menu links were loaded for this module.
- $links = $this->providerMenuLinks();
- foreach ($links as $page => $hrefs) {
- foreach ($hrefs as $href) {
- $this->drupalGet($page);
- $assert->linkByHrefExists($href);
- }
- }
- }
-
- /**
- * Data provider for testing menu links.
- *
- * @return array
- * Array of page -> link relationships to check for:
- * - The key is the path to the page where our link should appear.
- * - The value is an array of links that should appear on that page.
- */
- protected function providerMenuLinks() {
- return [
- '' => [
- '/examples/dbtng-example',
- ],
- '/examples/dbtng-example' => [
- '/examples/dbtng-example/add',
- '/examples/dbtng-example/update',
- '/examples/dbtng-example/advanced',
- ],
- ];
- }
-
- /**
- * Test the UI.
- */
- public function testUi() {
- $assert = $this->assertSession();
-
- $this->drupalLogin($this->createUser());
- // Test the basic list.
- $this->drupalGet('/examples/dbtng-example');
- $assert->statusCodeEquals(200);
- $assert->pageTextMatches('%John[td/<>\w\s]+Doe%');
-
- // Test the add tab.
- // Add the new entry.
- $this->drupalPostForm(
- '/examples/dbtng-example/add',
- [
- 'name' => 'Some',
- 'surname' => 'Anonymous',
- 'age' => 33,
- ],
- 'Add'
- );
- // Now find the new entry.
- $this->drupalGet('/examples/dbtng-example');
- $assert->pageTextMatches('%Some[td/<>\w\s]+Anonymous%');
- // Try the update tab.
- // Find out the pid of our "anonymous" guy.
- $result = $this->container->get('dbtng_example.repository')->load(['surname' => 'Anonymous']);
- $this->drupalGet('/examples/dbtng-example');
- $this->assertCount(1, $result, 'Did not find one entry in the table with surname = "Anonymous".');
- $entry = $result[0];
- unset($entry->uid);
-
- $entry = ['name' => 'NewFirstName', 'age' => 22];
- $this->drupalPostForm('/examples/dbtng-example/update', $entry, 'Update');
- // Now find the new entry.
- $this->drupalGet('/examples/dbtng-example');
- $assert->pageTextMatches('%NewFirstName[td/<>\w\s]+Anonymous%');
-
- // Try the advanced tab.
- $this->drupalGet('/examples/dbtng-example/advanced');
- $rows = $this->xpath("//*[@id='dbtng-example-advanced-list'][1]/tbody/tr");
- $this->assertCount(1, $rows);
-
- $field = $this->xpath("//*[@id='dbtng-example-advanced-list'][1]/tbody/tr/td[4]");
- $this->assertEquals('Roe', $field[0]->getText());
-
- // Try to add an entry while logged out.
- $this->drupalLogout();
- $this->drupalPostForm(
- '/examples/dbtng-example/add',
- [
- 'name' => 'Anonymous',
- 'surname' => 'UserCannotPost',
- 'age' => 'not a number',
- ],
- 'Add'
- );
- $assert->pageTextContains('You must be logged in to add values to the database.');
- $assert->pageTextContains('Age needs to be a number');
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/dbtng_example/tests/src/Kernel/DbtngExampleRepositoryTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/dbtng_example/tests/src/Kernel/DbtngExampleRepositoryTest.php
deleted file mode 100644
index 152e061d8..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/dbtng_example/tests/src/Kernel/DbtngExampleRepositoryTest.php
+++ /dev/null
@@ -1,121 +0,0 @@
-installSchema('dbtng_example', 'dbtng_example');
- // Inovke hook_install().
- $this->container->get('module_handler')->invoke('dbtng_example', 'install');
- }
-
- /**
- * Tests several combinations, adding entries, updating and deleting.
- */
- public function testDbtngExampleStorage() {
- /* @var $repository \Drupal\dbtng_example\DbtngExampleRepository */
- $repository = $this->container->get('dbtng_example.repository');
- // Create a new entry.
- $entry = [
- 'name' => 'James',
- 'surname' => 'Doe',
- 'age' => 23,
- ];
- $repository->insert($entry);
-
- // Save another entry.
- $entry = [
- 'name' => 'Jane',
- 'surname' => 'NotDoe',
- 'age' => 19,
- ];
- $repository->insert($entry);
-
- // Verify that 4 records are found in the database.
- $result = $repository->load();
- $this->assertCount(4, $result);
-
- // Verify 2 of these records have 'Doe' as surname.
- $result = $repository->load(['surname' => 'Doe']);
- $this->assertCount(2, $result, 'Did not find two entries in the table with surname = "Doe".');
-
- // Now find our not-Doe entry.
- $result = $repository->load(['surname' => 'NotDoe']);
- // Found one entry in the table with surname "NotDoe'.
- $this->assertCount(1, $result, 'Did not find one entry in the table with surname "NotDoe');
- // Our NotDoe will be changed to "NowDoe".
- $entry = $result[0];
- $entry->surname = "NowDoe";
- // update() returns the number of entries updated.
- $this->assertNotEquals(0, $repository->update((array) $entry));
-
- $result = $repository->load(['surname' => 'NowDoe']);
- $this->assertCount(1, $result, "Did not find renamed 'NowDoe' surname.");
-
- // Read only John Doe entry.
- $result = $repository->load(['name' => 'John', 'surname' => 'Doe']);
- $this->assertCount(1, $result, 'Did not find one entry for John Doe.');
-
- // Get the entry.
- $entry = (array) end($result);
- // Change age to 45.
- $entry['age'] = 45;
- // Update entry in database.
- $repository->update((array) $entry);
-
- // Find entries with age = 45.
- // Read only John Doe entry.
- $result = $repository->load(['surname' => 'NowDoe']);
- // Found one entry with surname = Nowdoe.
- $this->assertCount(1, $result, 'Did not find one entry with surname = Nowdoe.');
-
- // Verify it is Jane NowDoe.
- $entry = (array) end($result);
- // The name Jane is found in the entry.
- $this->assertEquals('Jane', $entry['name'], 'The name Jane is not found in the entry.');
- // The surname NowDoe is found in the entry.
- $this->assertEquals('NowDoe', $entry['surname'], 'The surname NowDoe is not found in the entry.');
-
- // Delete the entry.
- $repository->delete($entry);
-
- // Verify that now there are only 3 records.
- $result = $repository->load();
- // Found only three records, a record was deleted.
- $this->assertCount(3, $result, 'Did not find only three records, a record might not have been deleted.');
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/email_example/email_example.info.yml b/frontend/drupal9/web/modules/contrib/examples/modules/email_example/email_example.info.yml
deleted file mode 100644
index fe2073eeb..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/email_example/email_example.info.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-name: Email Example
-type: module
-description: Demonstrates how to send and alter Drupal-generated email messages.
-package: Example modules
-core_version_requirement: ^8.7.7 || ^9
-dependencies:
- - examples:examples
- - drupal:node
-
-# Information added by Drupal.org packaging script on 2021-10-07
-version: '3.0.3'
-project: 'examples'
-datestamp: 1633612832
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/email_example/email_example.links.menu.yml b/frontend/drupal9/web/modules/contrib/examples/modules/email_example/email_example.links.menu.yml
deleted file mode 100644
index 362c654d0..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/email_example/email_example.links.menu.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-email_example.description:
- title: 'E-mail Example'
- description: 'Callback for generating form.'
- route_name: email_example.description
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/email_example/email_example.module b/frontend/drupal9/web/modules/contrib/examples/modules/email_example/email_example.module
deleted file mode 100644
index b179bb87e..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/email_example/email_example.module
+++ /dev/null
@@ -1,99 +0,0 @@
- $message['langcode'],
- ];
-
- switch ($key) {
- // Send a simple message from the contact form.
- case 'contact_message':
- $from = \Drupal::config('system.site')->get('mail');
- $message['subject'] = t('E-mail sent from @site-name', ['@site-name' => $from], $options);
- // Note that the message body is an array, not a string.
- $account = \Drupal::currentUser();
- $message['body'][] = t('@name sent you the following message:', ['@name' => $account->getAccountName()], $options);
- // Because this is just user-entered text, we do not need to translate it.
- // Since user-entered text may have unintentional HTML entities in it like
- // '<' or '>', we need to make sure these entities are properly escaped,
- // as the body will later be transformed from HTML to text, meaning
- // that a normal use of '<' will result in truncation of the message.
- $message['body'][] = Html::escape($params['message']);
- break;
- }
-}
-
-/**
- * Implements hook_mail_alter().
- *
- * This function is not required to send an email using Drupal's mail system.
- *
- * hook_mail_alter() provides an interface to alter any aspect of email sent by
- * Drupal. You can use this hook to add a common site footer to all outgoing
- * email, add extra header fields, and/or modify the email in anyway. HTML-izing
- * the outgoing email is one possibility.
- */
-function email_example_mail_alter(&$message) {
- // For the purpose of this example, modify all the outgoing messages and
- // attach a site signature. The signature will be translated to the language
- // in which message was built.
- $options = [
- 'langcode' => $message['langcode'],
- ];
-
- $signature = t("\n--\nMail altered by email_example module.", [], $options);
- if (is_array($message['body'])) {
- $message['body'][] = $signature;
- }
- else {
- // Some modules use the body as a string, erroneously.
- $message['body'] .= $signature;
- }
-}
-
-/**
- * @} End of "defgroup email_example".
- */
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/email_example/email_example.routing.yml b/frontend/drupal9/web/modules/contrib/examples/modules/email_example/email_example.routing.yml
deleted file mode 100644
index df80907af..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/email_example/email_example.routing.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-email_example.description:
- path: '/examples/email-example'
- defaults:
- _form: '\Drupal\email_example\Form\EmailExampleGetFormPage'
- requirements:
- _permission: 'access content'
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/email_example/src/Form/EmailExampleGetFormPage.php b/frontend/drupal9/web/modules/contrib/examples/modules/email_example/src/Form/EmailExampleGetFormPage.php
deleted file mode 100644
index 30d3bc881..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/email_example/src/Form/EmailExampleGetFormPage.php
+++ /dev/null
@@ -1,163 +0,0 @@
-mailManager = $mail_manager;
- $this->languageManager = $language_manager;
- $this->emailValidator = $email_validator;
- }
-
- /**
- * {@inheritdoc}
- */
- public static function create(ContainerInterface $container) {
- $form = new static(
- $container->get('plugin.manager.mail'),
- $container->get('language_manager'),
- $container->get('email.validator')
- );
- $form->setMessenger($container->get('messenger'));
- $form->setStringTranslation($container->get('string_translation'));
- return $form;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getFormId() {
- return 'email_example';
- }
-
- /**
- * {@inheritdoc}
- */
- public function buildForm(array $form, FormStateInterface $form_state) {
- $form['intro'] = [
- '#markup' => $this->t('Use this form to send a message to an e-mail address. No spamming!'),
- ];
- $form['email'] = [
- '#type' => 'textfield',
- '#title' => $this->t('E-mail address'),
- '#required' => TRUE,
- ];
- $form['message'] = [
- '#type' => 'textarea',
- '#title' => $this->t('Message'),
- '#required' => TRUE,
- ];
- $form['submit'] = [
- '#type' => 'submit',
- '#value' => $this->t('Submit'),
- ];
- return $form;
- }
-
- /**
- * {@inheritdoc}
- */
- public function validateForm(array &$form, FormStateInterface $form_state) {
- if (!$this->emailValidator->isValid($form_state->getValue('email'))) {
- $form_state->setErrorByName('email', $this->t('That e-mail address is not valid.'));
- }
- }
-
- /**
- * {@inheritdoc}
- */
- public function submitForm(array &$form, FormStateInterface $form_state) {
- $form_values = $form_state->getValues();
-
- // All system mails need to specify the module and template key (mirrored
- // from hook_mail()) that the message they want to send comes from.
- $module = 'email_example';
- $key = 'contact_message';
-
- // Specify 'to' and 'from' addresses.
- $to = $form_values['email'];
- $from = $this->config('system.site')->get('mail');
-
- // "params" loads in additional context for email content completion in
- // hook_mail(). In this case, we want to pass in the values the user entered
- // into the form, which include the message body in $form_values['message'].
- $params = $form_values;
-
- // The language of the e-mail. This will one of three values:
- // - $account->getPreferredLangcode(): Used for sending mail to a particular
- // website user, so that the mail appears in their preferred language.
- // - \Drupal::currentUser()->getPreferredLangcode(): Used when sending a
- // mail back to the user currently viewing the site. This will send it in
- // the language they're currently using.
- // - \Drupal::languageManager()->getDefaultLanguage()->getId: Used when
- // sending mail to a pre-existing, 'neutral' address, such as the system
- // e-mail address, or when you're unsure of the language preferences of
- // the intended recipient.
- //
- // Since in our case, we are sending a message to a random e-mail address
- // that is not necessarily tied to a user account, we will use the site's
- // default language.
- $language_code = $this->languageManager->getDefaultLanguage()->getId();
-
- // Whether or not to automatically send the mail when we call mail() on the
- // mail manager. This defaults to TRUE, and is normally what you want unless
- // you need to do additional processing before the mail manager sends the
- // message.
- $send_now = TRUE;
- // Send the mail, and check for success. Note that this does not guarantee
- // message delivery; only that there were no PHP-related issues encountered
- // while sending.
- $result = $this->mailManager->mail($module, $key, $to, $language_code, $params, $from, $send_now);
- if ($result['result'] == TRUE) {
- $this->messenger()->addMessage($this->t('Your message has been sent.'));
- }
- else {
- $this->messenger()->addMessage($this->t('There was a problem sending your message and it was not sent.'), 'error');
- }
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/email_example/tests/src/Functional/EmailExampleTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/email_example/tests/src/Functional/EmailExampleTest.php
deleted file mode 100644
index a476d9b7e..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/email_example/tests/src/Functional/EmailExampleTest.php
+++ /dev/null
@@ -1,78 +0,0 @@
-assertSession();
- // Test for a link to the email_example in the Tools menu.
- $this->drupalGet('');
- $assert->statusCodeEquals(200);
- $assert->linkByHrefExists('examples/email-example');
-
- // Verify if we can successfully access the email_example page.
- $this->drupalGet('examples/email-example');
- $assert->statusCodeEquals(200);
-
- // Verifiy email form has email & message fields.
- $assert->fieldValueEquals('edit-email', NULL);
- $assert->fieldValueEquals('edit-message', NULL);
-
- // Verifiy email form is submitted.
- $edit = ['email' => 'example@example.com', 'message' => 'test'];
- $this->drupalPostForm('examples/email-example', $edit, 'Submit');
- $assert->statusCodeEquals(200);
-
- // Verifiy comfirmation page.
- $assert->pageTextContains('Your message has been sent.');
- $this->assertMailString('to', $edit['email'], 1);
-
- // Verifiy correct email recieved.
- $from = $this->config('system.site')->get('mail');
- $this->assertMailString('subject', "E-mail sent from $from", 1);
- $this->assertMailString('body', $edit['message'], 1);
- $this->assertMailString('body', "\n--\nMail altered by email_example module.", 1);
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/events_example/events_example.info.yml b/frontend/drupal9/web/modules/contrib/examples/modules/events_example/events_example.info.yml
deleted file mode 100644
index a036de794..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/events_example/events_example.info.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-name: Events Example
-type: module
-description: Provides an example of subscribing to and dispatching events.
-package: Example modules
-core_version_requirement: ^8.7.7 || ^9
-dependencies:
- - examples:examples
-
-# Information added by Drupal.org packaging script on 2021-10-07
-version: '3.0.3'
-project: 'examples'
-datestamp: 1633612832
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/events_example/events_example.links.menu.yml b/frontend/drupal9/web/modules/contrib/examples/modules/events_example/events_example.links.menu.yml
deleted file mode 100644
index 61eb582a0..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/events_example/events_example.links.menu.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-events_example.description:
- title: 'Events Example'
- description: 'Example of dispatching and subscribing to events.'
- route_name: events_example.description
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/events_example/events_example.module b/frontend/drupal9/web/modules/contrib/examples/modules/events_example/events_example.module
deleted file mode 100644
index 0bfac70fe..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/events_example/events_example.module
+++ /dev/null
@@ -1,75 +0,0 @@
-type = $type;
- $this->report = $report;
- }
-
- /**
- * Get the incident type.
- *
- * @return string
- * The type of report.
- */
- public function getType() {
- return $this->type;
- }
-
- /**
- * Get the detailed incident report.
- *
- * @return string
- * The text of the report.
- */
- public function getReport() {
- return $this->report;
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/events_example/src/EventSubscriber/EventsExampleSubscriber.php b/frontend/drupal9/web/modules/contrib/examples/modules/events_example/src/EventSubscriber/EventsExampleSubscriber.php
deleted file mode 100644
index bab1f5af2..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/events_example/src/EventSubscriber/EventsExampleSubscriber.php
+++ /dev/null
@@ -1,129 +0,0 @@
-getType() == 'stolen_princess') {
- $this->messenger()->addStatus($this->t('Mario has been alerted. Thank you. This message was set by an event subscriber. See @method()', ['@method' => __METHOD__]));
- // Optionally use the event object to stop propagation.
- // If there are other subscribers that have not been called yet this will
- // cause them to be skipped.
- $event->stopPropagation();
- }
- }
-
- /**
- * Let Batman know about any events involving the Joker.
- *
- * @param \Drupal\events_example\Event\IncidentReportEvent $event
- * The event object containing the incident report.
- */
- public function notifyBatman(IncidentReportEvent $event) {
- if ($event->getType() == 'joker') {
- $this->messenger()->addStatus($this->t('Batman has been alerted. Thank you. This message was set by an event subscriber. See @method()', ['@method' => __METHOD__]));
- $event->stopPropagation();
- }
- }
-
- /**
- * Handle incidents not handled by the other handlers.
- *
- * @param \Drupal\events_example\Event\IncidentReportEvent $event
- * The event object containing the incident report.
- */
- public function notifyDefault(IncidentReportEvent $event) {
- $this->messenger()->addStatus($this->t('Thank you for reporting this incident. This message was set by an event subscriber. See @method()', ['@method' => __METHOD__]));
- $event->stopPropagation();
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/events_example/src/Form/EventsExampleForm.php b/frontend/drupal9/web/modules/contrib/examples/modules/events_example/src/Form/EventsExampleForm.php
deleted file mode 100644
index fb0759d52..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/events_example/src/Form/EventsExampleForm.php
+++ /dev/null
@@ -1,130 +0,0 @@
-eventDispatcher = $event_dispatcher;
- }
-
- /**
- * {@inheritdoc}
- */
- public static function create(ContainerInterface $container) {
- return new static(
- $container->get('event_dispatcher')
- );
- }
-
- /**
- * {@inheritdoc}
- */
- public function buildForm(array $form, FormStateInterface $form_state) {
- $form['intro'] = [
- '#markup' => '
' . $this->t('This form demonstrates subscribing to, and dispatching, events. When the form is submitted an event is dispatched indicating a new report has been submitted. Event subscribers respond to this event with various messages depending on the incident type. Review the code for the events_example module to see how it works.') . '
',
- ];
-
- $form['incident_type'] = [
- '#type' => 'radios',
- '#required' => TRUE,
- '#title' => $this->t('What type of incident do you want to report?'),
- '#options' => [
- 'stolen_princess' => $this->t('Missing princess'),
- 'cat' => $this->t('Cat stuck in tree'),
- 'joker' => $this->t('Something involving the Joker'),
- ],
- ];
-
- $form['incident'] = [
- '#type' => 'textarea',
- '#required' => FALSE,
- '#title' => $this->t('Incident report'),
- '#description' => $this->t('Describe the incident in detail. This information will be passed along to all crime fighters.'),
- '#cols' => 60,
- '#rows' => 5,
- ];
-
- $form['actions'] = [
- '#type' => 'actions',
- ];
-
- $form['actions']['submit'] = [
- '#type' => 'submit',
- '#value' => $this->t('Submit'),
- ];
-
- return $form;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getFormId() {
- return 'events_example_form';
- }
-
- /**
- * {@inheritdoc}
- */
- public function submitForm(array &$form, FormStateInterface $form_state) {
- $type = $form_state->getValue('incident_type');
- $report = $form_state->getValue('incident');
-
- // When dispatching, or triggering, an event start by constructing a new
- // event object. Then use the event dispatcher service to notify any event
- // subscribers. Event objects are used to transport relevant data to any
- // subscribers, as well as keep track of the current state of an event. It
- // is best practice to create a unique class wrapping
- // \Symfony\Component\EventDispatcher\Event.
- $event = new IncidentReportEvent($type, $report);
-
- // Dispatch an event by specifying which event, and providing an event
- // object. Rather than hard code the event name you should use a constant
- // to represent the event being dispatched. The constant serves as a
- // location for documentation of the event, and ensures your code is future
- // proofed against event name changes.
- $this->eventDispatcher->dispatch(IncidentEvents::NEW_REPORT, $event);
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/events_example/tests/src/Functional/EventsExampleTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/events_example/tests/src/Functional/EventsExampleTest.php
deleted file mode 100644
index eb6a23899..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/events_example/tests/src/Functional/EventsExampleTest.php
+++ /dev/null
@@ -1,82 +0,0 @@
-drupalGet($events_example_form);
- $this->assertSession()->statusCodeEquals(200);
-
- // Verify the page contains the required form fields.
- $this->assertSession()->fieldExists('incident_type');
- $this->assertSession()->fieldExists('incident');
-
- // Submit the form with an incident type of 'stolen_princess'. This does a
- // couple of things. Fist of all, it ensures that our code in
- // EventsExampleForm::submitForm() that dispatches events works. If it did
- // not work, no event would be dispatched, and the message below would never
- // get displayed. Secondly, it tests that our
- // EventsExampleSubscriber::notifyMario() event subscriber is triggered for
- // incidents of the type 'stolen_princess'.
- $values = [
- 'incident_type' => 'stolen_princess',
- 'incident' => $this->randomString(),
- ];
- $this->drupalPostForm($events_example_form, $values, 'Submit');
- $this->assertSession()->pageTextContains('Mario has been alerted. Thank you.');
-
- // Fill out the form again, this time testing that the
- // EventsExampleSubscriber::notifyBatman() subscriber is working.
- $values = [
- 'incident_type' => 'joker',
- 'incident' => $this->randomString(),
- ];
- $this->drupalPostForm($events_example_form, $values, 'Submit');
- $this->assertSession()->pageTextContains('Batman has been alerted. Thank you.');
-
- // Fill out the form again, this time testing that our default handler
- // catches all the remaining values.
- $values = [
- 'incident_type' => 'cat',
- 'incident' => $this->randomString(),
- ];
- $this->drupalPostForm($events_example_form, $values, 'Submit');
- $this->assertSession()->pageTextContains('notifyDefault()');
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/events_example/tests/src/Kernel/EventsExampleServiceTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/events_example/tests/src/Kernel/EventsExampleServiceTest.php
deleted file mode 100644
index 071998b3d..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/events_example/tests/src/Kernel/EventsExampleServiceTest.php
+++ /dev/null
@@ -1,31 +0,0 @@
-container->get('events_example_subscriber');
- $this->assertInstanceOf(EventsExampleSubscriber::class, $subscriber);
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/config/schema/field_example.schema.yml b/frontend/drupal9/web/modules/contrib/examples/modules/field_example/config/schema/field_example.schema.yml
deleted file mode 100644
index c2e40ea05..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/config/schema/field_example.schema.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-# @see Configuration schema/metadata at https://drupal.org/node/1905070
-#
-field.field_example_rgb.value:
- type: sequence
- label: 'Default value'
- sequence:
- - type: mapping
- label: 'Default'
- mapping:
- value:
- type: string
- label: 'Value'
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/field_example.info.yml b/frontend/drupal9/web/modules/contrib/examples/modules/field_example/field_example.info.yml
deleted file mode 100644
index fb844c971..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/field_example.info.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-name: Field Example
-type: module
-description: Demonstrates the Field API via some field plugin implementations.
-package: Example modules
-core_version_requirement: ^8.7.7 || ^9
-dependencies:
- - drupal:color
- - drupal:node
- - examples:examples
-
-# Information added by Drupal.org packaging script on 2021-10-07
-version: '3.0.3'
-project: 'examples'
-datestamp: 1633612832
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/field_example.js b/frontend/drupal9/web/modules/contrib/examples/modules/field_example/field_example.js
deleted file mode 100644
index 1edb9ec55..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/field_example.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * @file
- * Javascript for Field Example.
- */
-
-/**
- * Provides a farbtastic colorpicker for the fancier widget.
- */
-(function ($) {
-
- 'use strict';
-
- Drupal.behaviors.field_example_colorpicker = {
- attach: function () {
- $('.edit-field-example-colorpicker').on('focus', function (event) {
- var edit_field = this;
- var picker = $(this).closest('div').parent().find('.field-example-colorpicker');
- // Hide all color pickers except this one.
- $('.field-example-colorpicker').hide();
- $(picker).show();
- $.farbtastic(picker, function (color) {
- edit_field.value = color;
- }).setColor(edit_field.value);
- });
- }
- };
-})(jQuery);
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/field_example.libraries.yml b/frontend/drupal9/web/modules/contrib/examples/modules/field_example/field_example.libraries.yml
deleted file mode 100644
index 7331ff916..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/field_example.libraries.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-colorpicker:
- version: 1.x
- js:
- field_example.js: {}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/field_example.links.menu.yml b/frontend/drupal9/web/modules/contrib/examples/modules/field_example/field_example.links.menu.yml
deleted file mode 100644
index 07b81b3be..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/field_example.links.menu.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-field_example.description:
- title: Field Example
- route_name: field_example.description
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/field_example.module b/frontend/drupal9/web/modules/contrib/examples/modules/field_example/field_example.module
deleted file mode 100644
index 7f005ab73..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/field_example.module
+++ /dev/null
@@ -1,34 +0,0 @@
- $item) {
- $elements[$delta] = [
- '#type' => 'html_tag',
- '#tag' => 'p',
- '#value' => $this->t('The content area color has been changed to @code', ['@code' => $item->value]),
- '#attributes' => [
- 'style' => 'background-color: ' . $item->value,
- ],
- ];
- }
- return $elements;
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/src/Plugin/Field/FieldFormatter/SimpleTextFormatter.php b/frontend/drupal9/web/modules/contrib/examples/modules/field_example/src/Plugin/Field/FieldFormatter/SimpleTextFormatter.php
deleted file mode 100644
index 6a382a470..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/src/Plugin/Field/FieldFormatter/SimpleTextFormatter.php
+++ /dev/null
@@ -1,45 +0,0 @@
- $item) {
- $elements[$delta] = [
- // We create a render array to produce the desired markup,
- // "
The color code ... #hexcolor
".
- // See theme_html_tag().
- '#type' => 'html_tag',
- '#tag' => 'p',
- '#attributes' => [
- 'style' => 'color: ' . $item->value,
- ],
- '#value' => $this->t('The color code in this field is @code', ['@code' => $item->value]),
- ];
- }
-
- return $elements;
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/src/Plugin/Field/FieldType/RgbItem.php b/frontend/drupal9/web/modules/contrib/examples/modules/field_example/src/Plugin/Field/FieldType/RgbItem.php
deleted file mode 100644
index 1a8d0e0d9..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/src/Plugin/Field/FieldType/RgbItem.php
+++ /dev/null
@@ -1,56 +0,0 @@
- [
- 'value' => [
- 'type' => 'text',
- 'size' => 'tiny',
- 'not null' => FALSE,
- ],
- ],
- ];
- }
-
- /**
- * {@inheritdoc}
- */
- public function isEmpty() {
- $value = $this->get('value')->getValue();
- return $value === NULL || $value === '';
- }
-
- /**
- * {@inheritdoc}
- */
- public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
- $properties['value'] = DataDefinition::create('string')
- ->setLabel(t('Hex value'));
-
- return $properties;
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/src/Plugin/Field/FieldWidget/ColorPickerWidget.php b/frontend/drupal9/web/modules/contrib/examples/modules/field_example/src/Plugin/Field/FieldWidget/ColorPickerWidget.php
deleted file mode 100644
index ebe07b8bb..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/src/Plugin/Field/FieldWidget/ColorPickerWidget.php
+++ /dev/null
@@ -1,43 +0,0 @@
- '',
- '#attributes' => ['class' => ['edit-field-example-colorpicker']],
- '#attached' => [
- // Add Farbtastic color picker and javascript file to trigger the
- // colorpicker.
- 'library' => [
- 'core/jquery.farbtastic',
- 'field_example/colorpicker',
- ],
- ],
- ];
-
- return $element;
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/src/Plugin/Field/FieldWidget/Text3Widget.php b/frontend/drupal9/web/modules/contrib/examples/modules/field_example/src/Plugin/Field/FieldWidget/Text3Widget.php
deleted file mode 100644
index ff9797314..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/src/Plugin/Field/FieldWidget/Text3Widget.php
+++ /dev/null
@@ -1,91 +0,0 @@
-value) ? $items[$delta]->value : '';
- // Parse the single hex string into RBG values.
- if (!empty($value)) {
- preg_match_all('@..@', substr($value, 1), $match);
- }
- else {
- $match = [[]];
- }
-
- // Set up the form element for this widget.
- $element += [
- '#type' => 'details',
- '#element_validate' => [
- [$this, 'validate'],
- ],
- ];
-
- // Add in the RGB textfield elements.
- foreach ([
- 'r' => $this->t('Red'),
- 'g' => $this->t('Green'),
- 'b' => $this->t('Blue'),
- ] as $key => $title) {
- $element[$key] = [
- '#type' => 'textfield',
- '#title' => $title,
- '#size' => 2,
- '#default_value' => array_shift($match[0]),
- '#attributes' => ['class' => ['rgb-entry']],
- '#description' => $this->t('The 2-digit hexadecimal representation of @color saturation, like "a1" or "ff"', ['@color' => $title]),
- ];
- // Since Form API doesn't allow a fieldset to be required, we
- // have to require each field element individually.
- if ($element['#required']) {
- $element[$key]['#required'] = TRUE;
- }
- }
- return ['value' => $element];
- }
-
- /**
- * Validate the fields and convert them into a single value as text.
- */
- public function validate($element, FormStateInterface $form_state) {
- // Validate each of the textfield entries.
- $values = [];
- foreach (['r', 'g', 'b'] as $colorfield) {
- $values[$colorfield] = $element[$colorfield]['#value'];
- // If they left any empty, we'll set the value empty and quit.
- if (strlen($values[$colorfield]) == 0) {
- $form_state->setValueForElement($element, '');
- return;
- }
- // If they gave us anything that's not hex, reject it.
- if ((strlen($values[$colorfield]) != 2) || !ctype_xdigit($values[$colorfield])) {
- $form_state->setError($element[$colorfield], $form_state, $this->t("Saturation value must be a 2-digit hexadecimal value between 00 and ff."));
- }
- }
-
- // Set the value of the entire form element.
- $value = strtolower(sprintf('#%02s%02s%02s', $values['r'], $values['g'], $values['b']));
- $form_state->setValueForElement($element, $value);
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/src/Plugin/Field/FieldWidget/TextWidget.php b/frontend/drupal9/web/modules/contrib/examples/modules/field_example/src/Plugin/Field/FieldWidget/TextWidget.php
deleted file mode 100644
index 1d0b5c462..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/src/Plugin/Field/FieldWidget/TextWidget.php
+++ /dev/null
@@ -1,55 +0,0 @@
-value) ? $items[$delta]->value : '';
- $element += [
- '#type' => 'textfield',
- '#default_value' => $value,
- '#size' => 7,
- '#maxlength' => 7,
- '#element_validate' => [
- [$this, 'validate'],
- ],
- ];
- return ['value' => $element];
- }
-
- /**
- * Validate the color text field.
- */
- public function validate($element, FormStateInterface $form_state) {
- $value = $element['#value'];
- if (strlen($value) === 0) {
- $form_state->setValueForElement($element, '');
- return;
- }
- if (!Color::validateHex($value)) {
- $form_state->setError($element, $this->t('Color must be a 3- or 6-digit hexadecimal value, suitable for CSS.'));
- }
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/templates/description.html.twig b/frontend/drupal9/web/modules/contrib/examples/modules/field_example/templates/description.html.twig
deleted file mode 100644
index ce1012b14..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/templates/description.html.twig
+++ /dev/null
@@ -1,15 +0,0 @@
-{#
-
-Description text for the Field Example.
-
-#}
-
-{% set edit_content_types = path('entity.node_type.collection') %}
-
-{% trans %}
-
-
-
-{% endtrans %}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/tests/src/Functional/ColorBackgroundFormatterTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/field_example/tests/src/Functional/ColorBackgroundFormatterTest.php
deleted file mode 100644
index 71a3ac48e..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/tests/src/Functional/ColorBackgroundFormatterTest.php
+++ /dev/null
@@ -1,100 +0,0 @@
-assertSession();
- // Login with Admin and create a field.
- $this->drupalLogin($this->administratorAccount);
- $this->fieldName = $this->createField('field_example_rgb', 'field_example_colorpicker', '1', 'field_example_color_background');
-
- // Login with Author user for content creation.
- $this->drupalLogin($this->authorAccount);
- $this->drupalGet('node/add/' . $this->contentTypeName);
-
- // Details to be submitted for content creation.
- $title = $this->randomMachineName(20);
- $edit = [
- 'title[0][value]' => $title,
- 'field_' . $this->fieldName . '[0][value]' => '#00ff00',
- ];
-
- // Submit the content creation form.
- $this->drupalPostForm(NULL, $edit, 'Save');
- $assert->pageTextContains((string) new FormattableMarkup('@type @title has been created', ['@type' => $this->contentTypeName, '@title' => $title]));
-
- // Verify color.
- $assert->pageTextContains('The content area color has been changed to #00ff00');
- }
-
- /**
- * Tests a multi-value field.
- *
- * Test the following scenarios in Field example:
- * - Creates a content type.
- * - Adds a multivalued field_example_rgb to it.
- * - Creates a node of the new type.
- * - Populates the multivalued field with two items.
- * - Tests the result.
- */
- public function testMultiValueField() {
- $assert = $this->assertSession();
-
- // Login with Admin and create a field.
- $this->drupalLogin($this->administratorAccount);
- $this->fieldName = $this->createField('field_example_rgb', 'field_example_colorpicker', '-1', 'field_example_color_background');
-
- // Login with Author user for content creation.
- $this->drupalLogin($this->authorAccount);
- $this->drupalGet('node/add/' . $this->contentTypeName);
-
- // Details to be submitted for content creation.
- $title = $this->randomMachineName(20);
- $edit = [
- 'title[0][value]' => $title,
- 'field_' . $this->fieldName . '[0][value]' => '#00ff00',
- ];
-
- // Add another field value.
- $this->drupalPostForm(NULL, $edit, 'Add another item');
-
- // Set value for newly added item.
- $edit = [
- 'field_' . $this->fieldName . '[1][value]' => '#ffff4f',
- ];
-
- // Submit the content creation form.
- $this->drupalPostForm(NULL, $edit, 'Save');
- $assert->pageTextContains((string) new FormattableMarkup('@type @title has been created', ['@type' => $this->contentTypeName, '@title' => $title]));
-
- // Verify color.
- $assert->pageTextContains('The content area color has been changed to #00ff00');
- $assert->pageTextContains('The content area color has been changed to #ffff4f');
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/tests/src/Functional/ColorPickerWidgetTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/field_example/tests/src/Functional/ColorPickerWidgetTest.php
deleted file mode 100644
index 4d7021a90..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/tests/src/Functional/ColorPickerWidgetTest.php
+++ /dev/null
@@ -1,101 +0,0 @@
-assertSession();
- // Login with Admin and create a field.
- $this->drupalLogin($this->administratorAccount);
- $this->fieldName = $this->createField('field_example_rgb', 'field_example_colorpicker', '1');
-
- // Login with Author user for content creation.
- $this->drupalLogin($this->authorAccount);
- $this->drupalGet('node/add/' . $this->contentTypeName);
-
- // Details to be submitted for content creation.
- $title = $this->randomMachineName(20);
- $edit = [
- 'title[0][value]' => $title,
- 'field_' . $this->fieldName . '[0][value]' => '#00ff00',
- ];
-
- // Submit the content creation form.
- $this->drupalPostForm(NULL, $edit, 'Save');
- $assert->pageTextContains((string) new FormattableMarkup('@type @title has been created', ['@type' => $this->contentTypeName, '@title' => $title]));
-
- // Verify color.
- $assert->pageTextContains('The color code in this field is #00ff00');
- }
-
- /**
- * Field example scenario tests.
- *
- * The following scenarios:
- * - Creates a content type.
- * - Adds a multivalued field_example_rgb to it.
- * - Creates a node of the new type.
- * - Populates the multivalued field with two items.
- * - Tests the result.
- */
- public function testMultiValueField() {
- $assert = $this->assertSession();
-
- // Login with Admin and create a field.
- $this->drupalLogin($this->administratorAccount);
- $this->fieldName = $this->createField('field_example_rgb', 'field_example_colorpicker', '-1');
-
- // Login with Author user for content creation.
- $this->drupalLogin($this->authorAccount);
- $this->drupalGet('node/add/' . $this->contentTypeName);
-
- // Details to be submitted for content creation.
- $title = $this->randomMachineName(20);
- $edit = [
- 'title[0][value]' => $title,
- 'field_' . $this->fieldName . '[0][value]' => '#00ff00',
- ];
-
- // Add another field value.
- $this->drupalPostForm(NULL, $edit, 'Add another item');
-
- // Set value for newly added item.
- $edit = [
- 'field_' . $this->fieldName . '[1][value]' => '#ffffff',
- ];
-
- // Submit the content creation form.
- $this->drupalPostForm(NULL, $edit, 'Save');
- $assert->pageTextContains((string) new FormattableMarkup('@type @title has been created', ['@type' => $this->contentTypeName, '@title' => $title]));
-
- // Verify color.
- $assert->pageTextContains('The color code in this field is #00ff00');
- $assert->pageTextContains('The color code in this field is #ffffff');
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/tests/src/Functional/FieldExampleBrowserTestBase.php b/frontend/drupal9/web/modules/contrib/examples/modules/field_example/tests/src/Functional/FieldExampleBrowserTestBase.php
deleted file mode 100644
index 76d87f1c6..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/tests/src/Functional/FieldExampleBrowserTestBase.php
+++ /dev/null
@@ -1,173 +0,0 @@
-administratorAccount = $this->drupalCreateUser($permissions);
- parent::drupalLogin($this->administratorAccount);
-
- // Prepare a new content type where the field will be added.
- $this->contentTypeName = strtolower($this->randomMachineName(10));
- $this->drupalGet('admin/structure/types/add');
- $edit = [
- 'name' => $this->contentTypeName,
- 'type' => $this->contentTypeName,
- ];
- $this->drupalPostForm(NULL, $edit, 'Save and manage fields');
- $this->assertText((string) new FormattableMarkup('The content type @name has been added.', ['@name' => $this->contentTypeName]));
-
- // Reset the permission cache.
- $create_permission = 'create ' . $this->contentTypeName . ' content';
- $this->checkPermissions([$create_permission]);
-
- // Now that we have a new content type, create a user that has privileges
- // on the content type.
- $this->authorAccount = $this->drupalCreateUser([$create_permission]);
- }
-
- /**
- * Create a field on the content type created during setUp().
- *
- * @param string $type
- * The storage field type to create.
- * @param string $widget_type
- * The widget to use when editing this field.
- * @param int|string $cardinality
- * Cardinality of the field. Use -1 to signify 'unlimited'.
- * @param string $fieldFormatter
- * The formatter to use when editing this field.
- *
- * @return string
- * Name of the field, like field_something
- */
- protected function createField($type = 'field_example_rgb', $widget_type = 'field_example_text', $cardinality = '1', $fieldFormatter = 'field_example_simple_text') {
- $assert = $this->assertSession();
-
- $this->drupalGet('admin/structure/types/manage/' . $this->contentTypeName . '/fields');
-
- // Go to the 'Add field' page.
- $this->clickLink('Add field');
-
- // Make a name for this field.
- $field_name = strtolower($this->randomMachineName(10));
-
- // Fill out the field form.
- $edit = [
- 'new_storage_type' => $type,
- 'field_name' => $field_name,
- 'label' => $field_name,
- ];
- $this->drupalPostForm(NULL, $edit, 'Save and continue');
-
- // Fill out the $cardinality form as if we're not using an unlimited number
- // of values.
- $edit = [
- 'cardinality' => 'number',
- 'cardinality_number' => (string) $cardinality,
- ];
- // If we have -1 for $cardinality, we should change the form's drop-down
- // from 'Number' to 'Unlimited'.
- if (-1 == $cardinality) {
- $edit = [
- 'cardinality' => '-1',
- 'cardinality_number' => '1',
- ];
- }
-
- // And now we save the cardinality settings.
- $this->drupalPostForm(NULL, $edit, 'Save field settings');
- $this->verbose(
- (string) new FormattableMarkup('Saved settings for field %field_name with widget %widget_type and cardinality %cardinality',
- [
- '%field_name' => $field_name,
- '%widget_type' => $widget_type,
- '%cardinality' => $cardinality,
- ]
- )
- );
- $assert->pageTextContains((string) new FormattableMarkup('Updated field @name field settings.', ['@name' => $field_name]));
-
- // Set the widget type for the newly created field.
- $this->drupalGet('admin/structure/types/manage/' . $this->contentTypeName . '/form-display');
- $edit = [
- 'fields[field_' . $field_name . '][type]' => $widget_type,
- ];
- $this->drupalPostForm(NULL, $edit, 'Save');
-
- // Set the field formatter for the newly created field.
- $this->drupalGet('admin/structure/types/manage/' . $this->contentTypeName . '/display');
- $edit1 = [
- 'fields[field_' . $field_name . '][type]' => $fieldFormatter,
- ];
- $this->drupalPostForm(NULL, $edit1, 'Save');
-
- return $field_name;
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/tests/src/Functional/FieldExampleMenuTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/field_example/tests/src/Functional/FieldExampleMenuTest.php
deleted file mode 100644
index 112e9175c..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/tests/src/Functional/FieldExampleMenuTest.php
+++ /dev/null
@@ -1,49 +0,0 @@
-assertSession();
- $this->drupalGet('');
- $assert->linkByHrefExists('examples/field-example');
- }
-
- /**
- * Tests field_example menus.
- */
- public function testBlockExampleMenu() {
- $assert = $this->assertSession();
- $this->drupalGet('examples/field-example');
- $assert->statusCodeEquals(200);
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/tests/src/Functional/Text3WidgetTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/field_example/tests/src/Functional/Text3WidgetTest.php
deleted file mode 100644
index 8b6b6077c..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/tests/src/Functional/Text3WidgetTest.php
+++ /dev/null
@@ -1,106 +0,0 @@
-assertSession();
- // Add a single field as administrator user.
- $this->drupalLogin($this->administratorAccount);
- $this->fieldName = $this->createField('field_example_rgb', 'field_example_3text', '1');
- // Post-condition: Content type now has the desired field.
- // Switch to the author user to create content with this type and field.
- $this->drupalLogin($this->authorAccount);
- $this->drupalGet('node/add/' . $this->contentTypeName);
-
- // Fill the create form.
- $title = 'test_title';
- $edit = [
- 'title[0][value]' => $title,
- 'field_' . $this->fieldName . '[0][value][r]' => '00',
- 'field_' . $this->fieldName . '[0][value][g]' => '0a',
- 'field_' . $this->fieldName . '[0][value][b]' => '01',
- ];
-
- // Create the content.
- $this->drupalPostForm(NULL, $edit, 'Save');
- $assert->pageTextContains((string) new FormattableMarkup('@type @title has been created', ['@type' => $this->contentTypeName, '@title' => $title]));
-
- // Verify the value is shown when viewing this node.
- $field_p = $this->xpath("//div[contains(@class,'field--type-field-example-rgb')]/div/p");
- $this->assertEquals("The color code in this field is #000a01", (string) $field_p[0]->getText());
- }
-
- /**
- * Test basic functionality of the example field.
- *
- * - Creates a content type.
- * - Adds a single-valued field_example_rgb to it.
- * - Adds a multivalued field_example_rgb to it.
- * - Creates a node of the new type.
- * - Populates the single-valued field.
- * - Populates the multivalued field with two items.
- * - Tests the result.
- */
- public function testMultiValueField() {
- $assert = $this->assertSession();
-
- // Add a single field as administrator user.
- $this->drupalLogin($this->administratorAccount);
- $this->fieldName = $this->createField('field_example_rgb', 'field_example_3text', '-1');
- // Post-condition: Content type now has the desired field.
- // Switch to the author user to create content with this type and field.
- $this->drupalLogin($this->authorAccount);
- $this->drupalGet('node/add/' . $this->contentTypeName);
-
- // Fill the create form.
- $title = $this->randomMachineName(20);
- $edit = [
- 'title[0][value]' => $title,
- 'field_' . $this->fieldName . '[0][value][r]' => '00',
- 'field_' . $this->fieldName . '[0][value][g]' => 'ff',
- 'field_' . $this->fieldName . '[0][value][b]' => '00',
- ];
-
- // Add a 2nd item to the multivalue field, so hit "add another".
- $this->drupalPostForm(NULL, $edit, 'Add another item');
- $edit = [
- 'field_' . $this->fieldName . '[1][value][r]' => 'ff',
- 'field_' . $this->fieldName . '[1][value][g]' => 'ff',
- 'field_' . $this->fieldName . '[1][value][b]' => 'ff',
- ];
-
- // Create the content.
- $this->drupalPostForm(NULL, $edit, 'Save');
- $assert->pageTextContains((string) new FormattableMarkup('@type @title has been created', ['@type' => $this->contentTypeName, '@title' => $title]));
-
- // Verify the values are shown when viewing this node.
- $field_p = $this->xpath("//div[contains(@class,'field--type-field-example-rgb')]/div/div/p");
- $this->assertEquals('The color code in this field is #00ff00', (string) $field_p[0]->getText());
- $this->assertEquals('The color code in this field is #ffffff', (string) $field_p[1]->getText());
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/tests/src/Functional/TextWidgetTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/field_example/tests/src/Functional/TextWidgetTest.php
deleted file mode 100644
index 6f0950047..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_example/tests/src/Functional/TextWidgetTest.php
+++ /dev/null
@@ -1,106 +0,0 @@
-assertSession();
-
- // Add a single field as administrator user.
- $this->drupalLogin($this->administratorAccount);
- $this->fieldName = $this->createField('field_example_rgb', 'field_example_text', '1');
-
- // Now that we have a content type with the desired field, switch to the
- // author user to create content with it.
- $this->drupalLogin($this->authorAccount);
- $this->drupalGet('node/add/' . $this->contentTypeName);
-
- // Add a node.
- $title = $this->randomMachineName(20);
- $edit = [
- 'title[0][value]' => $title,
- 'field_' . $this->fieldName . '[0][value]' => '#000001',
- ];
-
- // Create the content.
- $this->drupalPostForm(NULL, $edit, 'Save');
- $assert->pageTextContains((string) new FormattableMarkup('@type @title has been created', ['@type' => $this->contentTypeName, '@title' => $title]));
-
- // Verify the value is shown when viewing this node.
- $field_p = $this->xpath("//div[contains(@class,'field--type-field-example-rgb')]/div/p");
- $this->assertEquals('The color code in this field is #000001', (string) $field_p[0]->getText());
- }
-
- /**
- * Test basic functionality of the example field.
- *
- * - Creates a content type.
- * - Adds a single-valued field_example_rgb to it.
- * - Adds a multivalued field_example_rgb to it.
- * - Creates a node of the new type.
- * - Populates the single-valued field.
- * - Populates the multivalued field with two items.
- * - Tests the result.
- */
- public function testMultiValueField() {
- $assert = $this->assertSession();
-
- // Add a single field as administrator user.
- $this->drupalLogin($this->administratorAccount);
- $this->fieldName = $this->createField('field_example_rgb', 'field_example_text', '-1');
-
- // Now that we have a content type with the desired field, switch to the
- // author user to create content with it.
- $this->drupalLogin($this->authorAccount);
- $this->drupalGet('node/add/' . $this->contentTypeName);
-
- // Add a node.
- $title = $this->randomMachineName(20);
- $edit = [
- 'title[0][value]' => $title,
- 'field_' . $this->fieldName . '[0][value]' => '#00ff00',
- ];
-
- // We want to add a 2nd item to the multivalue field, so hit "add another".
- $this->drupalPostForm(NULL, $edit, 'Add another item');
-
- $edit = [
- 'field_' . $this->fieldName . '[1][value]' => '#ffffff',
- ];
-
- // Now we can fill in the second item in the multivalue field and save.
- $this->drupalPostForm(NULL, $edit, 'Save');
- $assert->pageTextContains((string) new FormattableMarkup('@type @title has been created', ['@type' => $this->contentTypeName, '@title' => $title]));
-
- // Verify the value is shown when viewing this node.
- $field_p = $this->xpath("//div[contains(@class,'field--type-field-example-rgb')]/div/div/p");
- $this->assertEquals('The color code in this field is #00ff00', (string) $field_p[0]->getText());
- $this->assertEquals('The color code in this field is #ffffff', (string) $field_p[1]->getText());
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/css/field-permission-description.css b/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/css/field-permission-description.css
deleted file mode 100644
index a366cc58d..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/css/field-permission-description.css
+++ /dev/null
@@ -1,3 +0,0 @@
-/**
- * Field Permssions Example CSS
- */
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/css/field_permission_example.css b/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/css/field_permission_example.css
deleted file mode 100644
index 2ace9bc30..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/css/field_permission_example.css
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * @file
- * CSS for Field Example.
- */
-.stickynote {
- background: #fefabc;
- padding: 0.8em;
- font-family: cursive;
- font-size: 1.1em;
- color: #def9ff;
- width: 15em;
- -moz-transform: rotate(2deg);
- -webkit-transform: rotate(2deg);
- -o-transform: rotate(2deg);
- -ms-transform: rotate(2deg);
- transform: rotate(2deg);
- -moz-box-shadow: 0 4px 6px #333;
- -webkit-box-shadow: 0 4px 6px #333;
- box-shadow: 0 4px 6px #333;
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/field_permission_example.info.yml b/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/field_permission_example.info.yml
deleted file mode 100644
index a7546ac14..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/field_permission_example.info.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-name: Field Permission Example
-type: module
-description: Demonstrates how to create a field and implement access control over it.
-package: Example modules
-core_version_requirement: ^8.7.7 || ^9
-dependencies:
- - drupal:node
- - examples:examples
-
-# Information added by Drupal.org packaging script on 2021-10-07
-version: '3.0.3'
-project: 'examples'
-datestamp: 1633612832
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/field_permission_example.libraries.yml b/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/field_permission_example.libraries.yml
deleted file mode 100644
index 9b4e619b1..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/field_permission_example.libraries.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-fieldnote_sticky:
- version: 1.x
- css:
- theme:
- css/field_permission_example.css: {}
-field_permissions_description:
- version: 1.x
- css:
- theme:
- css/field-permission-description.css: {}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/field_permission_example.links.menu.yml b/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/field_permission_example.links.menu.yml
deleted file mode 100644
index ce9a56b3d..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/field_permission_example.links.menu.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-field_permission_example.description:
- title: Field Permission Example
- route_name: field_permission_example.description
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/field_permission_example.module b/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/field_permission_example.module
deleted file mode 100644
index f6e45af90..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/field_permission_example.module
+++ /dev/null
@@ -1,197 +0,0 @@
-hasPermission(). We also give special edit
- * access to users with the 'bypass node access', 'administer content types'
- * permissions, defined by the node module, and the 'administer the fieldnote
- * field' we define for the module.
- *
- * One tricky part is that our field won't always be attached to nodes. It could
- * be attached to any type of entity. Fortunately, most content entities
- * implement EntityOwnerInterface, which gives us a way to check this. An
- * exception to this is the User entity; here, we just check to see that the
- * account name matches that of $account. We can get the entity itself by
- * calling $items->getEntity(), since these "know" what entity they belong to.
- *
- * In a real application, we'd have use-case specific permissions which might be
- * more complex than these. Or perhaps simpler.
- *
- * You can see a more complex field implementation in field_example.module.
- *
- * @see field_example
- * @see field_example.module
- * @see field_types
- * @see field
- */
-
-// Use statements to support hook_entity_field_access.
-use Drupal\Core\Field\FieldDefinitionInterface;
-use Drupal\Core\Session\AccountInterface;
-use Drupal\Core\Field\FieldItemListInterface;
-use Drupal\Core\Access\AccessResult;
-
-// Interfaces used by entities to declare "ownership".
-use Drupal\user\EntityOwnerInterface;
-use Drupal\user\UserInterface;
-
-// Use statements for hook_entity_test_access.
-use Drupal\Core\Entity\EntityInterface;
-
-/**
- * Implements hook_entity_field_access().
- *
- * We want to make sure that fields aren't being seen or edited
- * by those who shouldn't.
- */
-function field_permission_example_entity_field_access($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, FieldItemListInterface $items = NULL) {
- $messenger = \Drupal::messenger();
- // Find out what field we're looking at. If it isn't
- // our sticky note widget, tell Drupal we don't care about its access.
- if ($field_definition->getType() != 'field_permission_example_fieldnote') {
- return AccessResult::neutral();
- }
-
- // First we'll check if the user has the 'superuser'
- // permissions that node provides. This way administrators
- // will be able to administer the content types.
- if ($account->hasPermission('bypass node access')) {
- $messenger->addMessage(t('User can bypass node access.'));
- return AccessResult::allowed();
- }
- if ($account->hasPermission('administer content types', $account)) {
- $messenger->addMessage(t('User can administer content types.'));
- return AccessResult::allowed();
- }
- if ($account->hasPermission('administer the fieldnote field', $account)) {
- $messenger->addMessage(t('User can administer this field.'));
- return AccessResult::allowed();
- }
-
- // For anyone else, it depends on the desired operation.
- if ($operation == 'view' and $account->hasPermission('view any fieldnote')) {
- $messenger->addMessage(t('User can view any field note.'));
- return AccessResult::allowed();
- }
-
- if ($operation == 'edit' and $account->hasPermission('edit any fieldnote')) {
- $messenger->addMessage(t('User can edit any field note.'));
- return AccessResult::allowed();
- }
-
- // At this point, we need to know if the user "owns" the entity we're attached
- // to. If it's a user, we'll use the account name to test. Otherwise rely on
- // the entity implementing the EntityOwnerInterface. Anything else can't be
- // owned, and we'll refuse access.
- if ($items) {
- $entity = $items->getEntity();
- if ((($entity instanceof EntityOwnerInterface) and
- $entity->getOwner()->getAccountName() == $account->getAccountName()) or
- (($entity instanceof UserInterface) and
- $entity->name->value == $account->getAccountName())
- ) {
- if ($operation == 'view' and $account->hasPermission('view own fieldnote')) {
- $messenger->addMessage(t('User can view their own field note.'));
- return AccessResult::allowed();
- }
- if ($operation == 'edit' and $account->hasPermission('edit own fieldnote')) {
- $messenger->addMessage(t('User can edit their own field note.'));
- return AccessResult::allowed();
- }
- }
- }
- // Anything else on this field is forbidden.
- return AccessResult::forbidden();
-}
-
-/**
- * Implements hook_ENTITY_TYPE_access().
- *
- * Note: this routine is added so we can more easily test our access code. Core
- * defines an entity_test entity that is used for testing fields in core. We add
- * this routine to make the entity_test entity editable by our tests.
- */
-function field_permission_example_entity_test_access(EntityInterface $entity, $operation, AccountInterface $account, $langcode) {
- if ($operation == 'edit') {
- $perms = [
- 'administer the fieldnote field',
- 'edit any fieldnote',
- 'edit own fieldnote',
- ];
- foreach ($perms as $perm) {
- if ($account->hasPermission($perm)) {
- return AccessResult::allowed();
- }
- }
- }
- return AccessResult::neutral();
-}
-
-/**
- * @} End of "defgroup field_permission_example".
- */
-
-/**
- * Implements hook_theme().
- *
- * Since we have a lot to explain, we're going to use Twig to do it.
- */
-function field_permission_example_theme() {
- return [
- 'field_permission_description' => [
- 'template' => 'description',
- 'variables' => [
- 'admin_link' => NULL,
- ],
- ],
- ];
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/field_permission_example.permissions.yml b/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/field_permission_example.permissions.yml
deleted file mode 100644
index c70eb2b35..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/field_permission_example.permissions.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-# Permissions for the field_permission_example module
-'view own fieldnote':
- title: View own fieldnote
-'edit own fieldnote':
- title: Edit own fieldnote
-'view any fieldnote':
- title: View any fieldnote
-'edit any fieldnote':
- title: Edit any fieldnote
-'administer the fieldnote field':
- title: Administer settings for the fieldnote field.
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/field_permission_example.routing.yml b/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/field_permission_example.routing.yml
deleted file mode 100644
index b58b97b47..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/field_permission_example.routing.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-field_permission_example.description:
- path: '/examples/field-permission-example'
- defaults:
- _title: 'Field Permission Example'
- _controller: '\Drupal\field_permission_example\Controller\FieldPermissionExampleController::description'
- requirements:
- _permission: 'access content'
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/src/Controller/FieldPermissionExampleController.php b/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/src/Controller/FieldPermissionExampleController.php
deleted file mode 100644
index ff31ac323..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/src/Controller/FieldPermissionExampleController.php
+++ /dev/null
@@ -1,29 +0,0 @@
-t('the permissions admin page'), 'user.admin_permissions')->toString();
-
- $build = [
- 'description' => [
- '#theme' => 'field_permission_description',
- '#admin_link' => $permissions_admin_link,
- ],
- ];
- return $build;
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/src/Plugin/Field/FieldFormatter/SimpleTextFormatter.php b/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/src/Plugin/Field/FieldFormatter/SimpleTextFormatter.php
deleted file mode 100644
index ce91470dd..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/src/Plugin/Field/FieldFormatter/SimpleTextFormatter.php
+++ /dev/null
@@ -1,49 +0,0 @@
- $item) {
- $elements[$delta] = [
- // We wrap the fieldnote content up in a div tag.
- '#type' => 'html_tag',
- '#tag' => 'div',
- // This text is auto-XSS escaped. See docs for the html_tag element.
- '#value' => $item->value,
- // Let's give the note a nice sticky-note CSS appearance.
- '#attributes' => [
- 'class' => 'stickynote',
- ],
- // ..And this is the CSS for the stickynote.
- '#attached' => [
- 'library' => ['field_permission_example/fieldnote_sticky'],
- ],
- ];
- }
-
- return $elements;
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/src/Plugin/Field/FieldType/FieldNote.php b/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/src/Plugin/Field/FieldType/FieldNote.php
deleted file mode 100644
index 8a4c75635..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/src/Plugin/Field/FieldType/FieldNote.php
+++ /dev/null
@@ -1,56 +0,0 @@
- [
- 'value' => [
- 'type' => 'text',
- 'size' => 'normal',
- 'not null' => FALSE,
- ],
- ],
- ];
- }
-
- /**
- * {@inheritdoc}
- */
- public function isEmpty() {
- $value = $this->get('value')->getValue();
- return $value === NULL || $value === '';
- }
-
- /**
- * {@inheritdoc}
- */
- public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
- $properties['value'] = DataDefinition::create('string')
- ->setLabel(t('Field Note'));
-
- return $properties;
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/src/Plugin/Field/FieldWidget/TextWidget.php b/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/src/Plugin/Field/FieldWidget/TextWidget.php
deleted file mode 100644
index cd24f05df..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/src/Plugin/Field/FieldWidget/TextWidget.php
+++ /dev/null
@@ -1,35 +0,0 @@
-value) ? $items[$delta]->value : '';
- $element += [
- '#type' => 'textarea',
- '#default_value' => $value,
- ];
- return ['value' => $element];
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/templates/description.html.twig b/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/templates/description.html.twig
deleted file mode 100644
index 52f7a399d..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/templates/description.html.twig
+++ /dev/null
@@ -1,32 +0,0 @@
-{#
-/**
- * @file
- * Contains the text of the field_permission_example explanation/description page
- *
- * Available variables:
- * - admin_link: The translated link pointing to the administer permissions page.
- */
-#}
-
-{% set edit_content_types = path('entity.node_type.collection') %}
-
-{% trans %}
-
-
The Field Permission Example module shows how you can restrict view and edit
-permissions within your field implementation. It adds a new field type called
-Fieldnote. Fieldnotes appear as simple text boxes on the create/edit form, and
-as sticky notes when viewed. By 'sticky note' we mean 'Post-It Note' but that's
-a trademarked term.
-
-
To see this field in action, add it to a
-content type or user profile. Go to the permissions page ({{admin_link}})
-and look at the 'Field Permission Example' section. This allows you to change
-which roles can see and edit Fieldnote fields.
-
-
Creating different users with different capabilities will let you see these
-behaviors in action. Fieldnote helpfully displays a message telling you which
-permissions it is trying to resolve for the current field/user combination.
-
-
Definitely look through the code to see various implementation details.
-
-{% endtrans %}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/tests/src/Kernel/FieldNoteItemTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/tests/src/Kernel/FieldNoteItemTest.php
deleted file mode 100644
index 397d0d237..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/field_permission_example/tests/src/Kernel/FieldNoteItemTest.php
+++ /dev/null
@@ -1,292 +0,0 @@
-container->get('entity_type.manager');
-
- // Set up our entity_type and user type for our new field:
- $type_manager
- ->getStorage('field_storage_config')
- ->create([
- 'field_name' => 'field_fieldnote',
- 'entity_type' => 'entity_test',
- 'type' => 'field_permission_example_fieldnote',
- ])->save();
-
- $type_manager
- ->getStorage('field_config')
- ->create([
- 'entity_type' => 'entity_test',
- 'field_name' => 'field_fieldnote',
- 'bundle' => 'entity_test',
- ])->save();
-
- // Create a form display for the default form mode, and
- // add our field type.
- $type_manager
- ->getStorage('entity_form_display')
- ->create([
- 'targetEntityType' => 'entity_test',
- 'bundle' => 'entity_test',
- 'mode' => 'default',
- 'status' => TRUE,
- ])
- ->setComponent('field_fieldnote', [
- 'type' => 'field_permission_example_widget',
- ])
- ->save();
-
- // Now do this for the user type.
- $type_manager
- ->getStorage('field_storage_config')
- ->create([
- 'field_name' => 'user_fieldnote',
- 'entity_type' => 'user',
- 'type' => 'field_permission_example_fieldnote',
- ])->save();
-
- $type_manager
- ->getStorage('field_config')
- ->create([
- 'entity_type' => 'user',
- 'field_name' => 'user_fieldnote',
- 'bundle' => 'user',
- ])->save();
-
- // Fetch a form display for a user. This may already exist, so check as
- // Core does.
- // @see https://api.drupal.org/api/drupal/core%21includes%21entity.inc/function/entity_get_form_display/8
- $entity_form_display
- = $type_manager
- ->getStorage('entity_form_display')
- ->load('user.user.default');
- if (empty($entity_form_display)) {
- $entity_form_display
- = $type_manager
- ->getStorage('entity_form_display')
- ->create([
- 'targetEntityType' => 'user',
- 'bundle' => 'user',
- 'mode' => 'default',
- 'status' => TRUE,
- ]);
- }
- // And add our fancy field to that display:
- $entity_form_display->setComponent('field_fieldnote', [
- 'type' => 'field_permission_example_widget',
- ])->save();
-
- }
-
- /**
- * Test entity fields of the field_permission_example_fieldnote field type.
- */
- public function testFieldNoteItem() {
- // Verify entity creation.
- $type_manager = $this->container->get('entity_type.manager');
- $entity
- = $type_manager
- ->getStorage('entity_test')
- ->create([]);
- $value = 'This is an epic entity';
- $entity->field_fieldnote = $value;
- $entity->name->value = $this->randomMachineName();
- $entity->save();
-
- // Verify entity has been created properly.
- $id = $entity->id();
- $entity
- = $type_manager
- ->getStorage('entity_test')
- ->load($id);
-
- $this->assertTrue($entity->field_fieldnote instanceof FieldItemListInterface, 'Field implements interface.');
- $this->assertTrue($entity->field_fieldnote[0] instanceof FieldItemInterface, 'Field item implements interface.');
- $this->assertEqual($entity->field_fieldnote->value, $value);
- $this->assertEqual($entity->field_fieldnote[0]->value, $value);
-
- // Verify changing the field's value.
- $new_value = $this->randomMachineName();
- $entity->field_fieldnote->value = $new_value;
- $this->assertEqual($entity->field_fieldnote->value, $new_value);
-
- // Read changed entity and assert changed values.
- $entity->save();
-
- $entity
- = $type_manager
- ->getStorage('entity_test')
- ->load($id);
-
- $this->assertEqual($entity->field_fieldnote->value, $new_value);
-
- // Test sample item generation.
- $entity
- = $type_manager
- ->getStorage('entity_test')
- ->create([]);
-
- $entity->field_fieldnote->generateSampleItems();
- $this->entityValidateAndSave($entity);
- }
-
- /**
- * Test multiple access scenarios for the fieldnote field.
- */
- public function testFieldNoteAccess() {
-
- // Let's set up some scenarios.
- $scenarios = [
- 'admin_type' => [
- 'perms' => ['administer the fieldnote field'],
- 'can_view_any' => TRUE,
- 'can_edit_any' => TRUE,
- 'can_view_own' => TRUE,
- 'can_edit_own' => TRUE,
- ],
- 'low_access' => [
- 'perms' => ['view test entity'],
- 'can_view_any' => FALSE,
- 'can_edit_any' => FALSE,
- 'can_view_own' => FALSE,
- 'can_edit_own' => FALSE,
- ],
- 'view_any' => [
- 'perms' => [
- 'view test entity',
- 'view any fieldnote',
- ],
- 'can_view_any' => TRUE,
- 'can_edit_any' => FALSE,
- 'can_view_own' => FALSE,
- 'can_edit_own' => FALSE,
- ],
- 'edit_any' => [
- 'perms' => [
- 'view test entity',
- 'view any fieldnote',
- 'edit any fieldnote',
- ],
- 'can_view_any' => TRUE,
- 'can_edit_any' => TRUE,
- 'can_view_own' => FALSE,
- 'can_edit_own' => FALSE,
- ],
- 'view_own' => [
- 'perms' => [
- 'view test entity',
- 'view own fieldnote',
- ],
- 'can_view_any' => FALSE,
- 'can_edit_any' => FALSE,
- 'can_view_own' => TRUE,
- 'can_edit_own' => FALSE,
- ],
- 'edit_own' => [
- 'perms' => [
- 'view test entity',
- 'view own fieldnote',
- 'edit own fieldnote',
- ],
- 'can_view_any' => FALSE,
- 'can_edit_any' => FALSE,
- 'can_view_own' => TRUE,
- 'can_edit_own' => TRUE,
- ],
- ];
-
- $value = 'This is an epic entity';
- // We also need to test users as an entity to attach to. They work
- // a little differently than most content entity types:
- $arbitrary_user = $this->createUser([], 'Some User');
- $arbitrary_user->user_fieldnote = $value;
- $arbitrary_user->save();
-
- $storage = $this->container->get('entity_type.manager')->getStorage('entity_test');
-
- foreach ($scenarios as $name => $scenario) {
- $test_user = $this->createUser($scenario['perms'], $name);
- $entity = $storage->create(['entity_test']);
- $entity->field_fieldnote = $value;
- $entity->name->value = $this->randomMachineName();
- $entity->save();
-
- foreach (['can_view_any', 'can_edit_any'] as $op) {
- $this->doAccessAssertion($entity, 'field_fieldnote', $test_user, $name, $op, $scenario[$op]);
- $this->doAccessAssertion($arbitrary_user, 'user_fieldnote', $test_user, $name, $op, $scenario[$op]);
- }
-
- if ($scenario['can_view_own'] or $scenario['can_edit_own']) {
- $entity->user_id = $test_user;
- $entity->save();
- $test_user->user_fieldnote = $value;
- $test_user->save();
-
- foreach (['can_view_own', 'can_edit_own'] as $op) {
- $this->doAccessAssertion($entity, 'field_fieldnote', $test_user, $name, $op, $scenario[$op]);
- $this->doAccessAssertion($test_user, 'user_fieldnote', $test_user, $name, $op, $scenario[$op]);
- }
- }
- }
-
- }
-
- /**
- * Helper routine to run the assertions.
- */
- protected function doAccessAssertion($entity, $field_name, $account, $name, $op, $expected) {
- $expect_str = $expected ? "CAN" : "CANNOT";
- $assert_str = "$name $expect_str do $op on field $field_name";
- $operation = preg_match('/edit/', $op) ? "edit" : "view";
- $result = $entity->$field_name->access($operation, $account);
- if ($expected) {
- $this->assertTrue($result, $assert_str);
- }
- else {
- $this->assertFalse($result, $assert_str);
- }
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/file_example/file_example.info.yml b/frontend/drupal9/web/modules/contrib/examples/modules/file_example/file_example.info.yml
deleted file mode 100644
index 2082c2cb7..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/file_example/file_example.info.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-name: File Example
-type: module
-description: Demonstrates using the Drupal File API and stream wrappers.
-package: Example modules
-core_version_requirement: ^8.7.7 || ^9
-dependencies:
- - drupal:file
- - examples:examples
- - examples:stream_wrapper_example
-
-# Information added by Drupal.org packaging script on 2021-10-07
-version: '3.0.3'
-project: 'examples'
-datestamp: 1633612832
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/form_api_example.info.yml b/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/form_api_example.info.yml
deleted file mode 100644
index 3b6222acb..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/form_api_example.info.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-name: Form API Example
-type: module
-description: Demonstrates the Drupal Form API.
-package: Example modules
-core_version_requirement: ^8.7.7 || ^9
-configure: form_api_example.description
-dependencies:
- - drupal:node
- - examples:examples
-
-# Information added by Drupal.org packaging script on 2021-10-07
-version: '3.0.3'
-project: 'examples'
-datestamp: 1633612832
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/form_api_example.links.menu.yml b/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/form_api_example.links.menu.yml
deleted file mode 100644
index 91ff9a279..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/form_api_example.links.menu.yml
+++ /dev/null
@@ -1,85 +0,0 @@
-# Define default links for this module.
-form_api_example.description:
- title: Form API Examples
- description: Form examples using Drupal Form API.
- route_name: form_api_example.description
- expanded: TRUE
-
-form_api_example.simple_form:
- title: Simple form
- description: A simple form example with submit processing.
- route_name: form_api_example.simple_form
- parent: form_api_example.description
- weight: -10
-
-form_api_example.multistep_form:
- title: Multistep form
- description: Multistep form example with submit processing.
- route_name: form_api_example.multistep_form
- parent: form_api_example.description
- weight: -9
-
-form_api_example.input_demo:
- title: Common input elements
- description: A form to demonstrate input elements.
- route_name: form_api_example.input_demo
- parent: form_api_example.description
- weight: -8
-
-form_api_example.build_demo:
- title: Build form demo
- description: Demonstrates the order of firing of from controller methods.
- route_name: form_api_example.build_demo
- parent: form_api_example.description
- weight: -7
-
-form_api_example.container_demo:
- title: Container elements
- description: A form to demonstrate use of containers.
- route_name: form_api_example.container_demo
- parent: form_api_example.description
- weight: -6
-
-form_api_example.state_demo:
- title: Form state binding
- description: A form to demonstrate binding of form state.
- route_name: form_api_example.state_demo
- parent: form_api_example.description
- weight: -5
-
-form_api_example.vertical_tabs_demo:
- title: Vertical tab elements
- description: A form to demonstrate use of vertical tabs.
- route_name: form_api_example.vertical_tabs_demo
- parent: form_api_example.description
- weight: -4
-
-form_api_example.ajax_color_demo:
- title: Ajax form
- description: AJAX form demo.
- route_name: form_api_example.ajax_color_demo
- parent: form_api_example.description
- weight: -3
-
-form_api_example.ajax_addmore:
- title: Add-more button
- description: Form with 'add more' and 'remove' buttons.
- route_name: form_api_example.ajax_addmore
- parent: form_api_example.description
- weight: -2
-
-form_api_example.ajax_addremoveelements:
- title: Add-more and remove buttons
- description: Form with 'add more' button and 'remove' buttons for each element.
- route_name: form_api_example.ajaxaddremoveelements
- parent: form_api_example.description
- weight: -1
-
-form_api_example.modal_form:
- title: Modal form
- description: Demonstrates using Drupal's modal form.
- route_name: form_api_example.modal_form
- route_parameters:
- nojs: nojs
- parent: form_api_example.description
- weight: 0
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/form_api_example.module b/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/form_api_example.module
deleted file mode 100644
index 42139c2c8..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/form_api_example.module
+++ /dev/null
@@ -1,45 +0,0 @@
-getForm()
- * - form_api_example.routing.yml
- *
- * In addition to the simple example described above this module provides
- * examples that demonstrate:
- * - Elements used for data input
- * -\Drupal\form_api_example\Form\InputDemo
- * - The order of execution of form controller methods
- * - \Drupal\form_api_example\Form\BuildDemo
- * - Container elements used to group items
- * - \Drupal\form_api_example\Form\ContainerDemo
- * - Hiding elements based on the state of other elements
- * - \Drupal\form_api_example\Form\StateDemo
- * - Vertical Tabs elements in forms
- * - \Drupal\form_api_example\Form\VerticalTabsDemo
- * - Populating a portion on a form with Ajax callbacks
- * - \Drupal\form_api_example\Form\AjaxColorForm
- * - Adding additional fields to a form with Ajax callbacks
- * - \Drupal\form_api_example\Form\AjaxAddMore
- * - Modal form creation
- * - \Drupal\form_api_example\Controller\Page
- * - \Drupal\form_api_example\Form\ModalForm
- * - Displaying a form in a block
- * - \Drupal\form_api_example\Plugin\Block\SimpleFormBlock
- *
- * @} End of "defgroup field_example".
- */
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/form_api_example.routing.yml b/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/form_api_example.routing.yml
deleted file mode 100644
index d3fd17edf..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/form_api_example.routing.yml
+++ /dev/null
@@ -1,108 +0,0 @@
-# This routing.yml file makes both the fapi example description page and the
-# included sample forms available at specific URL's on your site. A route
-# maps a URL path to a controller. For page controllers it defines the
-# function or method that will be called when the page is accessed. For form
-# controllers the content is determined by the buildForm method defined by the
-# form controller implementation.
-
-# Access to these paths is restricted to users with the permission
-# 'access content'. This is notated as _permission: 'access content'.
-
-# Menu items corresponding to these URLs are defined separately in the
-# form_api_example.links.menu.yml file.
-form_api_example.description:
- path: '/examples/form-api-example'
- defaults:
- _controller: '\Drupal\form_api_example\Controller\Page::description'
- _title: 'Form API Examples'
- requirements:
- _permission: 'access content'
-
-form_api_example.simple_form:
- path: '/examples/form-api-example/simple-form'
- defaults:
- _form: '\Drupal\form_api_example\Form\SimpleForm'
- _title: 'Simple form'
- requirements:
- _permission: 'access content'
-
-form_api_example.input_demo:
- path: '/examples/form-api-example/input-demo'
- defaults:
- _form: '\Drupal\form_api_example\Form\InputDemo'
- _title: 'Common input elements'
- requirements:
- _permission: 'access content'
-
-form_api_example.state_demo:
- path: '/examples/form-api-example/state-demo'
- defaults:
- _form: '\Drupal\form_api_example\Form\StateDemo'
- _title: 'Form state binding'
- requirements:
- _permission: 'access content'
-
-form_api_example.container_demo:
- path: '/examples/form-api-example/container-demo'
- defaults:
- _form: '\Drupal\form_api_example\Form\ContainerDemo'
- _title: 'Container elements'
- requirements:
- _permission: 'access content'
-
-form_api_example.vertical_tabs_demo:
- path: '/examples/form-api-example/vertical-tabs-demo'
- defaults:
- _form: '\Drupal\form_api_example\Form\VerticalTabsDemo'
- _title: 'Vertical tab elements'
- requirements:
- _permission: 'access content'
-
-form_api_example.modal_form:
- path: '/examples/form-api-example/modal-form/{nojs}'
- defaults:
- _form: '\Drupal\form_api_example\Form\ModalForm'
- _title: 'Modal form'
- nojs: ajax
- requirements:
- _permission: 'access content'
-
-form_api_example.ajax_color_demo:
- path: '/examples/form-api-example/ajax-color-demo'
- defaults:
- _form: '\Drupal\form_api_example\Form\AjaxColorForm'
- _title: 'AJAX color form'
- requirements:
- _permission: 'access content'
-
-form_api_example.build_demo:
- path: '/examples/form-api-example/build-demo'
- defaults:
- _form: '\Drupal\form_api_example\Form\BuildDemo'
- _title: 'Build form demo'
- requirements:
- _permission: 'access content'
-
-form_api_example.ajax_addmore:
- path: '/examples/form-api-example/ajax-addmore'
- defaults:
- _form: '\Drupal\form_api_example\Form\AjaxAddMore'
- _title: 'Add-more button'
- requirements:
- _permission: 'access content'
-
-form_api_example.ajaxaddremoveelements:
- path: '/examples/form-api-example/ajaxaddremoveelements'
- defaults:
- _form: '\Drupal\form_api_example\Form\AjaxAddRemoveElements'
- _title: 'AJAX add and remove elements'
- requirements:
- _permission: 'access content'
-
-form_api_example.multistep_form:
- path: '/examples/form-api-example/multistep-form'
- defaults:
- _form: '\Drupal\form_api_example\Form\MultistepForm'
- _title: 'Multistep form'
- requirements:
- _permission: 'access content'
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Controller/Page.php b/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Controller/Page.php
deleted file mode 100644
index c7b24a947..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Controller/Page.php
+++ /dev/null
@@ -1,21 +0,0 @@
- 'item',
- '#markup' => $this->t('This example shows an add-more and a remove-last button.'),
- ];
-
- // Gather the number of names in the form already.
- $num_names = $form_state->get('num_names');
- // We have to ensure that there is at least one name field.
- if ($num_names === NULL) {
- $name_field = $form_state->set('num_names', 1);
- $num_names = 1;
- }
-
- $form['#tree'] = TRUE;
- $form['names_fieldset'] = [
- '#type' => 'fieldset',
- '#title' => $this->t('People coming to picnic'),
- '#prefix' => '
',
- '#suffix' => '
',
- ];
-
- for ($i = 0; $i < $num_names; $i++) {
- $form['names_fieldset']['name'][$i] = [
- '#type' => 'textfield',
- '#title' => $this->t('Name'),
- ];
- }
-
- $form['names_fieldset']['actions'] = [
- '#type' => 'actions',
- ];
- $form['names_fieldset']['actions']['add_name'] = [
- '#type' => 'submit',
- '#value' => $this->t('Add one more'),
- '#submit' => ['::addOne'],
- '#ajax' => [
- 'callback' => '::addmoreCallback',
- 'wrapper' => 'names-fieldset-wrapper',
- ],
- ];
- // If there is more than one name, add the remove button.
- if ($num_names > 1) {
- $form['names_fieldset']['actions']['remove_name'] = [
- '#type' => 'submit',
- '#value' => $this->t('Remove one'),
- '#submit' => ['::removeCallback'],
- '#ajax' => [
- 'callback' => '::addmoreCallback',
- 'wrapper' => 'names-fieldset-wrapper',
- ],
- ];
- }
- $form['actions']['submit'] = [
- '#type' => 'submit',
- '#value' => $this->t('Submit'),
- ];
-
- return $form;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getFormId() {
- return 'form_api_example_ajax_addmore';
- }
-
- /**
- * Callback for both ajax-enabled buttons.
- *
- * Selects and returns the fieldset with the names in it.
- */
- public function addmoreCallback(array &$form, FormStateInterface $form_state) {
- return $form['names_fieldset'];
- }
-
- /**
- * Submit handler for the "add-one-more" button.
- *
- * Increments the max counter and causes a rebuild.
- */
- public function addOne(array &$form, FormStateInterface $form_state) {
- $name_field = $form_state->get('num_names');
- $add_button = $name_field + 1;
- $form_state->set('num_names', $add_button);
- // Since our buildForm() method relies on the value of 'num_names' to
- // generate 'name' form elements, we have to tell the form to rebuild. If we
- // don't do this, the form builder will not call buildForm().
- $form_state->setRebuild();
- }
-
- /**
- * Submit handler for the "remove one" button.
- *
- * Decrements the max counter and causes a form rebuild.
- */
- public function removeCallback(array &$form, FormStateInterface $form_state) {
- $name_field = $form_state->get('num_names');
- if ($name_field > 1) {
- $remove_button = $name_field - 1;
- $form_state->set('num_names', $remove_button);
- }
- // Since our buildForm() method relies on the value of 'num_names' to
- // generate 'name' form elements, we have to tell the form to rebuild. If we
- // don't do this, the form builder will not call buildForm().
- $form_state->setRebuild();
- }
-
- /**
- * Final submit handler.
- *
- * Reports what values were finally set.
- */
- public function submitForm(array &$form, FormStateInterface $form_state) {
- $values = $form_state->getValue(['names_fieldset', 'name']);
-
- $output = $this->t('These people are coming to the picnic: @names', [
- '@names' => implode(', ', $values),
- ]
- );
- $this->messenger()->addMessage($output);
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/AjaxAddRemoveElements.php b/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/AjaxAddRemoveElements.php
deleted file mode 100644
index 216f4fad0..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/AjaxAddRemoveElements.php
+++ /dev/null
@@ -1,187 +0,0 @@
- 'item',
- '#markup' => $this->t('This example shows an add-more button and a remove button for each specific element.'),
- ];
-
- // Get the number of names in the form already.
- $num_lines = $form_state->get('num_lines');
- // We have to ensure that there is at least one name field.
- if ($num_lines === NULL) {
- $form_state->set('num_lines', 1);
- $num_lines = $form_state->get('num_lines');
- }
-
- // Get a list of fields that were removed.
- $removed_fields = $form_state->get('removed_fields');
- // If no fields have been removed yet we use an empty array.
- if ($removed_fields === NULL) {
- $form_state->set('removed_fields', []);
- $removed_fields = $form_state->get('removed_fields');
- }
-
- $form['#tree'] = TRUE;
- $form['names_fieldset'] = [
- '#type' => 'fieldset',
- '#title' => $this->t('People coming to picnic'),
- '#prefix' => '
',
- '#suffix' => '
',
- ];
-
- for ($i = 0; $i < $num_lines; $i++) {
- // Check if field was removed.
- if (in_array($i, $removed_fields)) {
- // Skip if field was removed and move to the next field.
- continue;
- }
-
- /* Create a new fieldset for each person
- * where we can add first and last name
- */
- // Fieldset title.
- $form['names_fieldset'][$i] = [
- '#type' => 'fieldset',
- '#title' => $this->t('Person') . ' ' . ($i + 1),
- ];
- // Date.
- $form['names_fieldset'][$i]['firstname'] = [
- '#type' => 'textfield',
- '#title' => $this->t('First name'),
- ];
- // Amount.
- $form['names_fieldset'][$i]['lastname'] = [
- '#type' => 'textfield',
- '#title' => $this->t('Last name'),
- ];
- $form['names_fieldset'][$i]['actions'] = [
- '#type' => 'submit',
- '#value' => $this->t('Remove'),
- '#name' => $i,
- '#submit' => ['::removeCallback'],
- '#ajax' => [
- 'callback' => '::addmoreCallback',
- 'wrapper' => 'names-fieldset-wrapper',
- ],
- ];
- }
-
- $form['names_fieldset']['actions'] = [
- '#type' => 'actions',
- ];
-
- $form['names_fieldset']['actions']['add_name'] = [
- '#type' => 'submit',
- '#value' => $this->t('Add one more'),
- '#submit' => ['::addOne'],
- '#ajax' => [
- 'callback' => '::addmoreCallback',
- 'wrapper' => 'names-fieldset-wrapper',
- ],
- ];
-
- $form['actions']['submit'] = [
- '#type' => 'submit',
- '#value' => $this->t('Submit'),
- ];
-
- return $form;
-
- }
-
- /**
- * Callback for both ajax-enabled buttons.
- *
- * Selects and returns the fieldset with the names in it.
- */
- public function addmoreCallback(array &$form, FormStateInterface $form_state) {
- return $form['names_fieldset'];
- }
-
- /**
- * Submit handler for the "add-one-more" button.
- *
- * Increments the max counter and causes a rebuild.
- */
- public function addOne(array &$form, FormStateInterface $form_state) {
- $num_field = $form_state->get('num_lines');
- $add_button = $num_field + 1;
- $form_state->set('num_lines', $add_button);
- $form_state->setRebuild();
- }
-
- /**
- * Submit handler for the "remove" button.
- *
- * Removes the corresponding line.
- */
- public function removeCallback(array &$form, FormStateInterface $form_state) {
- /*
- * We use the name of the remove button to find
- * the element we want to remove
- * Line 72: '#name' => $i,.
- */
- $trigger = $form_state->getTriggeringElement();
- $indexToRemove = $trigger['#name'];
-
- // Remove the fieldset from $form (the easy way)
- unset($form['names_fieldset'][$indexToRemove]);
-
- // Remove the fieldset from $form_state (the hard way)
- // First fetch the fieldset, then edit it, then set it again
- // Form API does not allow us to directly edit the field.
- $namesFieldset = $form_state->getValue('names_fieldset');
- unset($namesFieldset[$indexToRemove]);
- // $form_state->unsetValue('names_fieldset');
- $form_state->setValue('names_fieldset', $namesFieldset);
-
- // Keep track of removed fields so we can add new fields at the bottom
- // Without this they would be added where a value was removed.
- $removed_fields = $form_state->get('removed_fields');
- $removed_fields[] = $indexToRemove;
- $form_state->set('removed_fields', $removed_fields);
-
- // Rebuild form_state.
- $form_state->setRebuild();
- }
-
- /**
- * Required by FormBase.
- */
- public function validateForm(array &$form, FormStateInterface $form_state) {
-
- }
-
- /**
- * Required by FormBase.
- */
- public function submitForm(array &$form, FormStateInterface $form_state) {
-
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/AjaxColorForm.php b/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/AjaxColorForm.php
deleted file mode 100644
index 5861a14ee..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/AjaxColorForm.php
+++ /dev/null
@@ -1,147 +0,0 @@
- 'item',
- '#markup' => $this->t('This form example demonstrates functioning of an AJAX callback.'),
- ];
-
- // The #ajax attribute used in the temperature input element defines an ajax
- // callback that will invoke the 'updateColor' method on this form object.
- // Whenever the temperature element changes, it will invoke this callback
- // and replace the contents of the 'color_wrapper' container with the
- // results of this method call.
- $form['temperature'] = [
- '#title' => $this->t('Temperature'),
- '#type' => 'select',
- '#options' => $this->getColorTemperatures(),
- '#empty_option' => $this->t('- Select a color temperature -'),
- '#ajax' => [
- // Could also use [get_class($this), 'updateColor'].
- 'callback' => '::updateColor',
- 'wrapper' => 'color-wrapper',
- ],
- ];
-
- // Add a wrapper that can be replaced with new HTML by the ajax callback.
- // This is given the ID that was passed to the ajax callback in the '#ajax'
- // element above.
- $form['color_wrapper'] = [
- '#type' => 'container',
- '#attributes' => ['id' => 'color-wrapper'],
- ];
-
- // Add a color element to the color_wrapper container using the value
- // from temperature to determine which colors to include in the select
- // element.
- $temperature = $form_state->getValue('temperature');
- if (!empty($temperature)) {
- $form['color_wrapper']['color'] = [
- '#type' => 'select',
- '#title' => $this->t('Color'),
- '#options' => $this->getColorsByTemperature($temperature),
- ];
- }
-
- // Add a submit button that handles the submission of the form.
- $form['actions'] = [
- '#type' => 'actions',
- 'submit' => [
- '#type' => 'submit',
- '#value' => $this->t('Submit'),
- ],
- ];
-
- return $form;
- }
-
- /**
- * Ajax callback for the color dropdown.
- */
- public function updateColor(array $form, FormStateInterface $form_state) {
- return $form['color_wrapper'];
- }
-
- /**
- * Returns colors that correspond with the given temperature.
- *
- * @param string $temperature
- * The color temperature for which to return a list of colors. Can be either
- * 'warm' or 'cool'.
- *
- * @return array
- * An associative array of colors that correspond to the given color
- * temperature, suitable to use as form options.
- */
- protected function getColorsByTemperature($temperature) {
- return $this->getColors()[$temperature]['colors'];
- }
-
- /**
- * Returns a list of color temperatures.
- *
- * @return array
- * An associative array of color temperatures, suitable to use as form
- * options.
- */
- protected function getColorTemperatures() {
- return array_map(function ($color_data) {
- return $color_data['name'];
- }, $this->getColors());
- }
-
- /**
- * Returns an array of colors grouped by color temperature.
- *
- * @return array
- * An associative array of color data, keyed by color temperature.
- */
- protected function getColors() {
- return [
- 'warm' => [
- 'name' => $this->t('Warm'),
- 'colors' => [
- 'red' => $this->t('Red'),
- 'orange' => $this->t('Orange'),
- 'yellow' => $this->t('Yellow'),
- ],
- ],
- 'cool' => [
- 'name' => $this->t('Cool'),
- 'colors' => [
- 'blue' => $this->t('Blue'),
- 'purple' => $this->t('Purple'),
- 'green' => $this->t('Green'),
- ],
- ],
- ];
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/BuildDemo.php b/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/BuildDemo.php
deleted file mode 100644
index 2d893feac..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/BuildDemo.php
+++ /dev/null
@@ -1,158 +0,0 @@
-displayMethodInvocation('__construct');
- }
-
- /**
- * Update form processing information.
- *
- * Display the method being called and it's sequence in the form
- * processing.
- *
- * @param string $method_name
- * The method being invoked.
- */
- private function displayMethodInvocation($method_name) {
- self::$sequenceCounter++;
- $this->messenger()->addMessage(self::$sequenceCounter . ". $method_name");
- }
-
- /**
- * {@inheritdoc}
- */
- public function buildForm(array $form, FormStateInterface $form_state) {
-
- $form['description'] = [
- '#type' => 'item',
- '#markup' => $this->t('Demonstrates how submit, rebuild, form-rebuild and #ajax submit work.'),
- ];
-
- // Simple checkbox for ajax orders.
- $form['change'] = [
- '#type' => 'checkbox',
- '#title' => $this->t('Change Me'),
- '#ajax' => [
- 'callback' => '::ajaxSubmit',
- 'wrapper' => 'message-wrapper',
- ],
- ];
-
- $form['actions'] = [
- '#type' => 'actions',
- ];
-
- // Add a submit button that handles the submission of the form.
- $form['actions']['submit'] = [
- '#type' => 'submit',
- '#value' => 'Submit',
- ];
-
- // Add button handlers.
- $form['actions']['button'] = [
- '#type' => 'button',
- '#value' => 'Rebuild',
- ];
-
- $form['actions']['rebuild'] = [
- '#type' => 'submit',
- '#value' => 'Submit Rebuild',
- '#submit' => ['::rebuildFormSubmit'],
- ];
-
- $form['actions']['ajaxsubmit'] = [
- '#type' => 'submit',
- '#value' => 'Ajax Submit',
- '#ajax' => [
- 'callback' => '::ajaxSubmit',
- 'wrapper' => 'message-wrapper',
- ],
- ];
-
- $form['messages'] = [
- '#type' => 'container',
- '#attributes' => ['id' => 'message-wrapper'],
- ];
-
- return $form;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getFormId() {
- $this->displayMethodInvocation('getFormId');
- return 'form_api_example_build_form';
- }
-
- /**
- * {@inheritdoc}
- */
- public function validateForm(array &$form, FormStateInterface $form_state) {
- $this->displayMethodInvocation('validateForm');
- }
-
- /**
- * {@inheritdoc}
- */
- public function submitForm(array &$form, FormStateInterface $form_state) {
- $this->displayMethodInvocation('submitForm');
- }
-
- /**
- * Implements ajax submit callback.
- *
- * @param array $form
- * Form render array.
- * @param \Drupal\Core\Form\FormStateInterface $form_state
- * Current state of the form.
- */
- public function ajaxSubmit(array &$form, FormStateInterface $form_state) {
- $this->displayMethodInvocation('ajaxSubmit');
- $form['messages']['status'] = [
- '#type' => 'status_messages',
- ];
-
- return $form['messages'];
- }
-
- /**
- * Implements submit callback for Rebuild button.
- *
- * @param array $form
- * Form render array.
- * @param \Drupal\Core\Form\FormStateInterface $form_state
- * Current state of the form.
- */
- public function rebuildFormSubmit(array &$form, FormStateInterface $form_state) {
- $this->displayMethodInvocation('rebuildFormSubmit');
- $form_state->setRebuild(TRUE);
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/ContainerDemo.php b/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/ContainerDemo.php
deleted file mode 100644
index 503351916..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/ContainerDemo.php
+++ /dev/null
@@ -1,95 +0,0 @@
- 'item',
- '#markup' => $this->t('This form example demonstrates container elements: details, fieldset and container.'),
- ];
-
- // Details containers replace D7's collapsible field sets.
- $form['author'] = [
- '#type' => 'details',
- '#title' => 'Author Info (type = details)',
- ];
-
- $form['author']['name'] = [
- '#type' => 'textfield',
- '#title' => $this->t('Name'),
- ];
-
- $form['author']['pen_name'] = [
- '#type' => 'textfield',
- '#title' => $this->t('Pen Name'),
- ];
-
- // Conventional field set.
- $form['book'] = [
- '#type' => 'fieldset',
- '#title' => $this->t('Book Info (type = fieldset)'),
- ];
-
- $form['book']['title'] = [
- '#type' => 'textfield',
- '#title' => $this->t('Title'),
- ];
-
- $form['book']['publisher'] = [
- '#type' => 'textfield',
- '#title' => $this->t('Publisher'),
- ];
-
- // Containers have no visual display but wrap any contained elements in a
- // div tag.
- $form['accommodation'] = [
- '#type' => 'container',
- ];
-
- $form['accommodation']['title'] = [
- '#type' => 'html_tag',
- '#tag' => 'p',
- '#value' => $this->t('Special Accommodations (type = container)'),
- ];
-
- $form['accommodation']['diet'] = [
- '#type' => 'textfield',
- '#title' => $this->t('Dietary Restrictions'),
- ];
-
- $form['actions'] = ['#type' => 'actions'];
-
- $form['actions']['submit'] = [
- '#type' => 'submit',
- '#value' => $this->t('Submit'),
- ];
-
- return $form;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getFormId() {
- return 'form_api_example_container_demo';
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/DemoBase.php b/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/DemoBase.php
deleted file mode 100644
index 7b7d70db0..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/DemoBase.php
+++ /dev/null
@@ -1,46 +0,0 @@
-getValues();
- foreach ($values as $key => $value) {
- $label = isset($form[$key]['#title']) ? $form[$key]['#title'] : $key;
-
- // Many arrays return 0 for unselected values so lets filter that out.
- if (is_array($value)) {
- $value = array_filter($value);
- }
- // Only display for controls that have titles and values.
- if ($value) {
- $display_value = is_array($value) ? print_r($value, 1) : $value;
- $message = $this->t('Value for %title: %value', ['%title' => $label, '%value' => $display_value]);
- $this->messenger()->addMessage($message);
- }
- }
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/InputDemo.php b/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/InputDemo.php
deleted file mode 100644
index fcb8c3a48..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/InputDemo.php
+++ /dev/null
@@ -1,325 +0,0 @@
- 'item',
- '#markup' => $this->t('This example shows the use of all input-types.'),
- ];
-
- // CheckBoxes.
- $form['tests_taken'] = [
- '#type' => 'checkboxes',
- '#options' => ['SAT' => $this->t('SAT'), 'ACT' => $this->t('ACT')],
- '#title' => $this->t('What standardized tests did you take?'),
- '#description' => 'Checkboxes, #type = checkboxes',
- ];
-
- // Color.
- $form['color'] = [
- '#type' => 'color',
- '#title' => $this->t('Color'),
- '#default_value' => '#ffffff',
- '#description' => 'Color, #type = color',
- ];
-
- // Date.
- $form['expiration'] = [
- '#type' => 'date',
- '#title' => $this->t('Content expiration'),
- '#default_value' => ['year' => 2020, 'month' => 2, 'day' => 15],
- '#description' => 'Date, #type = date',
- ];
-
- // Date-time.
- $form['datetime'] = [
- '#type' => 'datetime',
- '#title' => 'Date Time',
- '#date_increment' => 1,
- '#date_timezone' => date_default_timezone_get(),
- '#default_value' => date_default_timezone_get(),
- '#description' => $this->t('Date time, #type = datetime'),
- ];
-
- // URL.
- $form['url'] = [
- '#type' => 'url',
- '#title' => $this->t('URL'),
- '#maxlength' => 255,
- '#size' => 30,
- '#description' => $this->t('URL, #type = url'),
- ];
-
- // Email.
- $form['email'] = [
- '#type' => 'email',
- '#title' => $this->t('Email'),
- '#description' => $this->t('Email, #type = email'),
- ];
-
- // Number.
- $form['quantity'] = [
- '#type' => 'number',
- '#title' => $this->t('Quantity'),
- '#description' => $this->t('Number, #type = number'),
- ];
-
- // Password.
- $form['password'] = [
- '#type' => 'password',
- '#title' => $this->t('Password'),
- '#description' => 'Password, #type = password',
- ];
-
- // Password Confirm.
- $form['password_confirm'] = [
- '#type' => 'password_confirm',
- '#title' => $this->t('New Password'),
- '#description' => $this->t('PasswordConfirm, #type = password_confirm'),
- ];
-
- // Range.
- $form['size'] = [
- '#type' => 'range',
- '#title' => $this->t('Size'),
- '#min' => 10,
- '#max' => 100,
- '#description' => $this->t('Range, #type = range'),
- ];
-
- // Radios.
- $form['settings']['active'] = [
- '#type' => 'radios',
- '#title' => $this->t('Poll status'),
- '#options' => [0 => $this->t('Closed'), 1 => $this->t('Active')],
- '#description' => $this->t('Radios, #type = radios'),
- ];
-
- // Search.
- $form['search'] = [
- '#type' => 'search',
- '#title' => $this->t('Search'),
- '#description' => $this->t('Search, #type = search'),
- ];
-
- // Select.
- $form['favorite'] = [
- '#type' => 'select',
- '#title' => $this->t('Favorite color'),
- '#options' => [
- 'red' => $this->t('Red'),
- 'blue' => $this->t('Blue'),
- 'green' => $this->t('Green'),
- ],
- '#empty_option' => $this->t('-select-'),
- '#description' => $this->t('Select, #type = select'),
- ];
-
- // Multiple values option elements.
- $form['select_multiple'] = [
- '#type' => 'select',
- '#title' => 'Select (multiple)',
- '#multiple' => TRUE,
- '#options' => [
- 'sat' => 'SAT',
- 'act' => 'ACT',
- 'none' => 'N/A',
- ],
- '#default_value' => ['sat'],
- '#description' => 'Select Multiple',
- ];
-
- // Tel.
- $form['phone'] = [
- '#type' => 'tel',
- '#title' => $this->t('Phone'),
- '#description' => $this->t('Tel, #type = tel'),
- ];
-
- // Details.
- $form['details'] = [
- '#type' => 'details',
- '#title' => $this->t('Details'),
- '#description' => $this->t('Details, #type = details'),
- ];
-
- // TableSelect.
- $options = [
- 1 => ['first_name' => 'Indy', 'last_name' => 'Jones'],
- 2 => ['first_name' => 'Darth', 'last_name' => 'Vader'],
- 3 => ['first_name' => 'Super', 'last_name' => 'Man'],
- ];
-
- $header = [
- 'first_name' => $this->t('First Name'),
- 'last_name' => $this->t('Last Name'),
- ];
-
- $form['table'] = [
- '#type' => 'tableselect',
- '#title' => $this->t('Users'),
- '#header' => $header,
- '#options' => $options,
- '#empty' => $this->t('No users found'),
- ];
-
- // Textarea.
- $form['text'] = [
- '#type' => 'textarea',
- '#title' => $this->t('Text'),
- '#description' => $this->t('Textarea, #type = textarea'),
- ];
-
- // Text format.
- $form['text_format'] = [
- '#type' => 'text_format',
- '#title' => 'Text format',
- '#format' => 'plain_text',
- '#expected_value' => [
- 'value' => 'Text value',
- 'format' => 'plain_text',
- ],
- '#textformat_value' => [
- 'value' => 'Testvalue',
- 'format' => 'filtered_html',
- ],
- '#description' => $this->t('Text format, #type = text_format'),
- ];
-
- // Textfield.
- $form['subject'] = [
- '#type' => 'textfield',
- '#title' => $this->t('Subject'),
- '#size' => 60,
- '#maxlength' => 128,
- '#description' => $this->t('Textfield, #type = textfield'),
- ];
-
- // Weight.
- $form['weight'] = [
- '#type' => 'weight',
- '#title' => $this->t('Weight'),
- '#delta' => 10,
- '#description' => $this->t('Weight, #type = weight'),
- ];
-
- // Group submit handlers in an actions element with a key of "actions" so
- // that it gets styled correctly, and so that other modules may add actions
- // to the form.
- $form['actions'] = [
- '#type' => 'actions',
- ];
-
- // Extra actions for the display.
- $form['actions']['extra_actions'] = [
- '#type' => 'dropbutton',
- '#links' => [
- 'simple_form' => [
- 'title' => $this->t('Simple Form'),
- 'url' => Url::fromRoute('form_api_example.simple_form'),
- ],
- 'demo' => [
- 'title' => $this->t('Build Demo'),
- 'url' => Url::fromRoute('form_api_example.build_demo'),
- ],
- ],
- ];
-
- // File.
- $form['file'] = [
- '#type' => 'file',
- '#title' => 'File',
- '#description' => $this->t('File, #type = file'),
- ];
-
- // Manage file.
- $form['managed_file'] = [
- '#type' => 'managed_file',
- '#title' => 'Managed file',
- '#description' => $this->t('Manage file, #type = managed_file'),
- ];
-
- // Image Buttons.
- $form['image_button'] = [
- '#type' => 'image_button',
- '#value' => 'Image button',
- '#src' => drupal_get_path('module', 'examples') . '/images/100x30.svg',
- '#description' => $this->t('image file, #type = image_button'),
- ];
-
- // Button.
- $form['button'] = [
- '#type' => 'button',
- '#value' => 'Button',
- '#description' => $this->t('Button, #type = button'),
- ];
-
- // Add a submit button that handles the submission of the form.
- $form['actions']['submit'] = [
- '#type' => 'submit',
- '#value' => $this->t('Submit'),
- '#description' => $this->t('Submit, #type = submit'),
- ];
-
- // Add a reset button that handles the submission of the form.
- $form['actions']['reset'] = [
- '#type' => 'button',
- '#button_type' => 'reset',
- '#value' => $this->t('Reset'),
- '#description' => $this->t('Submit, #type = button, #button_type = reset, #attributes = this.form.reset();return false'),
- '#attributes' => [
- 'onclick' => 'this.form.reset(); return false;',
- ],
- ];
-
- return $form;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getFormId() {
- return 'form_api_example_input_demo_form';
- }
-
- /**
- * {@inheritdoc}
- */
- public function submitForm(array &$form, FormStateInterface $form_state) {
- // Find out what was submitted.
- $values = $form_state->getValues();
- foreach ($values as $key => $value) {
- $label = isset($form[$key]['#title']) ? $form[$key]['#title'] : $key;
-
- // Many arrays return 0 for unselected values so lets filter that out.
- if (is_array($value)) {
- $value = array_filter($value);
- }
-
- // Only display for controls that have titles and values.
- if ($value && $label) {
- $display_value = is_array($value) ? preg_replace('/[\n\r\s]+/', ' ', print_r($value, 1)) : $value;
- $message = $this->t('Value for %title: %value', ['%title' => $label, '%value' => $display_value]);
- $this->messenger()->addMessage($message);
- }
- }
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/ModalForm.php b/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/ModalForm.php
deleted file mode 100644
index 7fbc4c660..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/ModalForm.php
+++ /dev/null
@@ -1,194 +0,0 @@
-setRequestStack($container->get('request_stack'));
- $form->setStringTranslation($container->get('string_translation'));
- $form->setMessenger($container->get('messenger'));
- return $form;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getFormId() {
- return 'form_api_example_modal_form';
- }
-
- /**
- * Helper method so we can have consistent dialog options.
- *
- * @return string[]
- * An array of jQuery UI elements to pass on to our dialog form.
- */
- protected static function getDataDialogOptions() {
- return [
- 'width' => '50%',
- ];
- }
-
- /**
- * {@inheritdoc}
- */
- public function buildForm(array $form, FormStateInterface $form_state, $nojs = NULL) {
- // Add the core AJAX library.
- $form['#attached']['library'][] = 'core/drupal.ajax';
-
- $form['description'] = [
- '#type' => 'item',
- '#markup' => $this->t('This example demonstrates a form that can work as a normal multi-request form, or as a modal dialog using AJAX.'),
- ];
- // Add a link to show this form in a modal dialog if we're not already in
- // one.
- if ($nojs == 'nojs') {
- $form['use_ajax_container'] = [
- '#type' => 'details',
- '#open' => TRUE,
- ];
- $form['use_ajax_container']['description'] = [
- '#type' => 'item',
- '#markup' => $this->t('In order to show a modal dialog by clicking on a link, that link has to have class use-ajax and data-dialog-type="modal". This link has those attributes.'),
- ];
- $form['use_ajax_container']['use_ajax'] = [
- '#type' => 'link',
- '#title' => $this->t('See this form as a modal.'),
- '#url' => Url::fromRoute('form_api_example.modal_form', ['nojs' => 'ajax']),
- '#attributes' => [
- 'class' => ['use-ajax'],
- 'data-dialog-type' => 'modal',
- 'data-dialog-options' => json_encode(static::getDataDialogOptions()),
- // Add this id so that we can test this form.
- 'id' => 'ajax-example-modal-link',
- ],
- ];
- }
-
- // This element is responsible for displaying form errors in the AJAX
- // dialog.
- if ($nojs == 'ajax') {
- $form['status_messages'] = [
- '#type' => 'status_messages',
- '#weight' => -999,
- ];
- }
-
- $form['title'] = [
- '#type' => 'textfield',
- '#title' => $this->t('Title'),
- '#required' => TRUE,
- ];
-
- // Group submit handlers in an actions element with a key of "actions" so
- // that it gets styled correctly, and so that other modules may add actions
- // to the form.
- $form['actions'] = [
- '#type' => 'actions',
- ];
-
- // Add a submit button that handles the submission of the form.
- $form['actions']['submit'] = [
- '#type' => 'submit',
- '#value' => $this->t('Submit'),
- '#ajax' => [
- 'callback' => '::ajaxSubmitForm',
- 'event' => 'click',
- ],
- ];
-
- // Set the form to not use AJAX if we're on a nojs path. When this form is
- // within the modal dialog, Drupal will make sure we're using an AJAX path
- // instead of a nojs one.
- if ($nojs == 'nojs') {
- unset($form['actions']['submit']['#ajax']);
- }
-
- return $form;
- }
-
- /**
- * {@inheritdoc}
- */
- public function submitForm(array &$form, FormStateInterface $form_state) {
- $title = $form_state->getValue('title');
- $this->messenger()->addMessage(
- $this->t('Submit handler: You specified a title of @title.', ['@title' => $title])
- );
- }
-
- /**
- * Implements the submit handler for the modal dialog AJAX call.
- *
- * @param array $form
- * Render array representing from.
- * @param \Drupal\Core\Form\FormStateInterface $form_state
- * Current form state.
- *
- * @return \Drupal\Core\Ajax\AjaxResponse
- * Array of AJAX commands to execute on submit of the modal form.
- */
- public function ajaxSubmitForm(array &$form, FormStateInterface $form_state) {
- // We begin building a new ajax reponse.
- $response = new AjaxResponse();
-
- // If the user submitted the form and there are errors, show them the
- // input dialog again with error messages. Since the title element is
- // required, the empty string wont't validate and there will be an error.
- if ($form_state->getErrors()) {
- // If there are errors, we can show the form again with the errors in
- // the status_messages section.
- $form['status_messages'] = [
- '#type' => 'status_messages',
- '#weight' => -10,
- ];
- $response->addCommand(new OpenModalDialogCommand($this->t('Errors'), $form, static::getDataDialogOptions()));
- }
- // If there are no errors, show the output dialog.
- else {
- // We don't want any messages that were added by submitForm().
- $this->messenger()->deleteAll();
- // We use FormattableMarkup to handle sanitizing the input.
- // @todo: There's probably a better way to do this.
- $title = new FormattableMarkup(':title', [':title' => $form_state->getValue('title')]);
- // This will be the contents for the modal dialog.
- $content = [
- '#type' => 'item',
- '#markup' => $this->t("Your specified title of '%title' appears in this modal dialog.", ['%title' => $title]),
- ];
- // Add the OpenModalDialogCommand to the response. This will cause Drupal
- // AJAX to show the modal dialog. The user can click the little X to close
- // the dialog.
- $response->addCommand(new OpenModalDialogCommand($title, $content, static::getDataDialogOptions()));
- }
-
- // Finally return our response.
- return $response;
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/MultistepForm.php b/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/MultistepForm.php
deleted file mode 100644
index 2c88f9efe..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/MultistepForm.php
+++ /dev/null
@@ -1,199 +0,0 @@
-has('page_num') && $form_state->get('page_num') == 2) {
- return $this->fapiExamplePageTwo($form, $form_state);
- }
-
- $form_state->set('page_num', 1);
-
- $form['description'] = [
- '#type' => 'item',
- '#title' => $this->t('A basic multistep form (page 1)'),
- ];
-
- $form['first_name'] = [
- '#type' => 'textfield',
- '#title' => $this->t('First Name'),
- '#description' => $this->t('Enter your first name.'),
- '#default_value' => $form_state->getValue('first_name', ''),
- '#required' => TRUE,
- ];
-
- $form['last_name'] = [
- '#type' => 'textfield',
- '#title' => $this->t('Last Name'),
- '#default_value' => $form_state->getValue('last_name', ''),
- '#description' => $this->t('Enter your last name.'),
- ];
-
- $form['birth_year'] = [
- '#type' => 'number',
- '#title' => $this->t('Birth Year'),
- '#default_value' => $form_state->getValue('birth_year', ''),
- '#description' => $this->t('Format is "YYYY" and value between 1900 and 2000'),
- ];
-
- // Group submit handlers in an actions element with a key of "actions" so
- // that it gets styled correctly, and so that other modules may add actions
- // to the form. This is not required, but is convention.
- $form['actions'] = [
- '#type' => 'actions',
- ];
-
- $form['actions']['next'] = [
- '#type' => 'submit',
- '#button_type' => 'primary',
- '#value' => $this->t('Next'),
- // Custom submission handler for page 1.
- '#submit' => ['::fapiExampleMultistepFormNextSubmit'],
- // Custom validation handler for page 1.
- '#validate' => ['::fapiExampleMultistepFormNextValidate'],
- ];
-
- return $form;
- }
-
- /**
- * {@inheritdoc}
- */
- public function submitForm(array &$form, FormStateInterface $form_state) {
- $page_values = $form_state->get('page_values');
-
- $this->messenger()->addMessage($this->t('The form has been submitted. name="@first @last", year of birth=@year_of_birth', [
- '@first' => $page_values['first_name'],
- '@last' => $page_values['last_name'],
- '@year_of_birth' => $page_values['birth_year'],
- ]));
-
- $this->messenger()->addMessage($this->t('And the favorite color is @color', ['@color' => $form_state->getValue('color')]));
- }
-
- /**
- * Provides custom validation handler for page 1.
- *
- * @param array $form
- * An associative array containing the structure of the form.
- * @param \Drupal\Core\Form\FormStateInterface $form_state
- * The current state of the form.
- */
- public function fapiExampleMultistepFormNextValidate(array &$form, FormStateInterface $form_state) {
- $birth_year = $form_state->getValue('birth_year');
-
- if ($birth_year != '' && ($birth_year < 1900 || $birth_year > 2000)) {
- // Set an error for the form element with a key of "birth_year".
- $form_state->setErrorByName('birth_year', $this->t('Enter a year between 1900 and 2000.'));
- }
- }
-
- /**
- * Provides custom submission handler for page 1.
- *
- * @param array $form
- * An associative array containing the structure of the form.
- * @param \Drupal\Core\Form\FormStateInterface $form_state
- * The current state of the form.
- */
- public function fapiExampleMultistepFormNextSubmit(array &$form, FormStateInterface $form_state) {
- $form_state
- ->set('page_values', [
- // Keep only first step values to minimize stored data.
- 'first_name' => $form_state->getValue('first_name'),
- 'last_name' => $form_state->getValue('last_name'),
- 'birth_year' => $form_state->getValue('birth_year'),
- ])
- ->set('page_num', 2)
- // Since we have logic in our buildForm() method, we have to tell the form
- // builder to rebuild the form. Otherwise, even though we set 'page_num'
- // to 2, the AJAX-rendered form will still show page 1.
- ->setRebuild(TRUE);
- }
-
- /**
- * Builds the second step form (page 2).
- *
- * @param array $form
- * An associative array containing the structure of the form.
- * @param \Drupal\Core\Form\FormStateInterface $form_state
- * The current state of the form.
- *
- * @return array
- * The render array defining the elements of the form.
- */
- public function fapiExamplePageTwo(array &$form, FormStateInterface $form_state) {
-
- $form['description'] = [
- '#type' => 'item',
- '#title' => $this->t('A basic multistep form (page 2)'),
- ];
-
- $form['color'] = [
- '#type' => 'textfield',
- '#title' => $this->t('Favorite color'),
- '#required' => TRUE,
- '#default_value' => $form_state->getValue('color', ''),
- ];
- $form['back'] = [
- '#type' => 'submit',
- '#value' => $this->t('Back'),
- // Custom submission handler for 'Back' button.
- '#submit' => ['::fapiExamplePageTwoBack'],
- // We won't bother validating the required 'color' field, since they
- // have to come back to this page to submit anyway.
- '#limit_validation_errors' => [],
- ];
- $form['submit'] = [
- '#type' => 'submit',
- '#button_type' => 'primary',
- '#value' => $this->t('Submit'),
- ];
-
- return $form;
- }
-
- /**
- * Provides custom submission handler for 'Back' button (page 2).
- *
- * @param array $form
- * An associative array containing the structure of the form.
- * @param \Drupal\Core\Form\FormStateInterface $form_state
- * The current state of the form.
- */
- public function fapiExamplePageTwoBack(array &$form, FormStateInterface $form_state) {
- $form_state
- // Restore values for the first step.
- ->setValues($form_state->get('page_values'))
- ->set('page_num', 1)
- // Since we have logic in our buildForm() method, we have to tell the form
- // builder to rebuild the form. Otherwise, even though we set 'page_num'
- // to 1, the AJAX-rendered form will still show page 2.
- ->setRebuild(TRUE);
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/SimpleForm.php b/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/SimpleForm.php
deleted file mode 100644
index 4c99bf510..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/SimpleForm.php
+++ /dev/null
@@ -1,114 +0,0 @@
- 'item',
- '#markup' => $this->t('This basic example shows a single text input element and a submit button'),
- ];
-
- $form['title'] = [
- '#type' => 'textfield',
- '#title' => $this->t('Title'),
- '#description' => $this->t('Title must be at least 5 characters in length.'),
- '#required' => TRUE,
- ];
-
- // Group submit handlers in an actions element with a key of "actions" so
- // that it gets styled correctly, and so that other modules may add actions
- // to the form. This is not required, but is convention.
- $form['actions'] = [
- '#type' => 'actions',
- ];
-
- // Add a submit button that handles the submission of the form.
- $form['actions']['submit'] = [
- '#type' => 'submit',
- '#value' => $this->t('Submit'),
- ];
-
- return $form;
- }
-
- /**
- * Getter method for Form ID.
- *
- * The form ID is used in implementations of hook_form_alter() to allow other
- * modules to alter the render array built by this form controller. It must be
- * unique site wide. It normally starts with the providing module's name.
- *
- * @return string
- * The unique ID of the form defined by this class.
- */
- public function getFormId() {
- return 'form_api_example_simple_form';
- }
-
- /**
- * Implements form validation.
- *
- * The validateForm method is the default method called to validate input on
- * a form.
- *
- * @param array $form
- * The render array of the currently built form.
- * @param \Drupal\Core\Form\FormStateInterface $form_state
- * Object describing the current state of the form.
- */
- public function validateForm(array &$form, FormStateInterface $form_state) {
- $title = $form_state->getValue('title');
- if (strlen($title) < 5) {
- // Set an error for the form element with a key of "title".
- $form_state->setErrorByName('title', $this->t('The title must be at least 5 characters long.'));
- }
- }
-
- /**
- * Implements a form submit handler.
- *
- * The submitForm method is the default method called for any submit elements.
- *
- * @param array $form
- * The render array of the currently built form.
- * @param \Drupal\Core\Form\FormStateInterface $form_state
- * Object describing the current state of the form.
- */
- public function submitForm(array &$form, FormStateInterface $form_state) {
- /*
- * This would normally be replaced by code that actually does something
- * with the title.
- */
- $title = $form_state->getValue('title');
- $this->messenger()->addMessage($this->t('You specified a title of %title.', ['%title' => $title]));
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/StateDemo.php b/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/StateDemo.php
deleted file mode 100644
index 51a0d4525..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/StateDemo.php
+++ /dev/null
@@ -1,103 +0,0 @@
- 'item',
- '#markup' => $this->t('This example demonstrates the #states property. #states makes an element visibility dependent on another.'),
- ];
-
- $form['needs_accommodation'] = [
- '#type' => 'checkbox',
- '#title' => 'Need Special Accommodations?',
- ];
-
- // The #states property used here binds the visibility of the
- // container element to the value of the needs_accommodation checkbox above.
- $form['accommodation'] = [
- '#type' => 'container',
- '#attributes' => [
- 'class' => 'accommodation',
- ],
- // #states is an associative array. Each key is the name of a state to
- // apply to the element, such as 'visible'. Each value is another array,
- // making a list of conditions that denote when the state should be
- // applied. Every condition is a key/value pair, whose key is a jQuery
- // selector that denotes another element on the page, and whose value is
- // an array of conditions, which must be met on in order for the state to
- // be applied.
- //
- // For additional documentation on the #states property including a list
- // of valid states and conditions see drupal_process_states().
- '#states' => [
- // The state being affected is "invisible".
- 'invisible' => [
- // Drupal will only apply this state when the element that satisfies
- // the selector input[name="needs_accommodation"] is un-checked.
- ':input[name="needs_accommodation"]' => ['checked' => FALSE],
- ],
- ],
- ];
-
- $form['accommodation']['diet'] = [
- '#type' => 'textfield',
- '#title' => $this->t('Dietary Restrictions'),
- ];
-
- // Add a submit button that handles the submission of the form.
- $form['actions']['submit'] = [
- '#type' => 'submit',
- '#value' => $this->t('Submit'),
- ];
-
- return $form;
- }
-
- /**
- * Getter method for Form ID.
- *
- * @inheritdoc
- */
- public function getFormId() {
- return 'form_api_example_state_demo';
- }
-
- /**
- * Implements submitForm callback.
- *
- * @inheritdoc
- */
- public function submitForm(array &$form, FormStateInterface $form_state) {
- // Find out what was submitted.
- $values = $form_state->getValues();
- if ($values['needs_accommodation']) {
- $this->messenger()->addMessage($this->t('Dietary Restriction Requested: %diet', ['%diet' => $values['diet']]));
- }
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/VerticalTabsDemo.php b/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/VerticalTabsDemo.php
deleted file mode 100644
index 314af0fba..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Form/VerticalTabsDemo.php
+++ /dev/null
@@ -1,76 +0,0 @@
- 'item',
- '#markup' => $this->t('This example demonstrates the use of vertical tabs to group elements.'),
- ];
-
- $form['information'] = [
- '#type' => 'vertical_tabs',
- '#default_tab' => 'edit-publication',
- ];
-
- $form['author'] = [
- '#type' => 'details',
- '#title' => 'Author',
- '#group' => 'information',
- ];
-
- $form['author']['name'] = [
- '#type' => 'textfield',
- '#title' => $this->t('Name'),
- ];
-
- $form['publication'] = [
- '#type' => 'details',
- '#title' => $this->t('Publication'),
- '#group' => 'information',
- ];
-
- $form['publication']['publisher'] = [
- '#type' => 'textfield',
- '#title' => $this->t('Publisher'),
- ];
-
- $form['actions'] = ['#type' => 'actions'];
- // Add a submit button that handles the submission of the form.
- $form['actions']['submit'] = [
- '#type' => 'submit',
- '#value' => $this->t('Submit'),
- ];
-
- return $form;
- }
-
- /**
- * Getter method for Form ID.
- *
- * @inheritdoc
- */
- public function getFormId() {
- return 'form_api_example_vertical_tabs_demo';
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Plugin/Block/SimpleFormBlock.php b/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Plugin/Block/SimpleFormBlock.php
deleted file mode 100644
index dd6cc41cc..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/src/Plugin/Block/SimpleFormBlock.php
+++ /dev/null
@@ -1,73 +0,0 @@
-formBuilder = $form_builder;
- }
-
- /**
- * {@inheritdoc}
- */
- public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
- return new static(
- $configuration,
- $plugin_id,
- $plugin_definition,
- $container->get('form_builder')
- );
- }
-
- /**
- * {@inheritdoc}
- */
- public function build() {
- $output = [
- 'description' => [
- '#markup' => $this->t('Using form provided by @classname', ['@classname' => SimpleForm::class]),
- ],
- ];
-
- // Use the form builder service to retrieve a form by providing the full
- // name of the class that implements the form you want to display. getForm()
- // will return a render array representing the form that can be used
- // anywhere render arrays are used.
- //
- // In this case the build() method of a block plugin is expected to return
- // a render array so we add the form to the existing output and return it.
- $output['form'] = $this->formBuilder->getForm(SimpleForm::class);
- return $output;
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/templates/description.html.twig b/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/templates/description.html.twig
deleted file mode 100644
index 445f4696f..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/templates/description.html.twig
+++ /dev/null
@@ -1,38 +0,0 @@
-{#
-
-Description text for the Form API Example.
-
-#}
-
-{{ attach_library('core/drupal.dialog.ajax') }}
-{% set simple_form = path('form_api_example.simple_form') %}
-{% set multistep_form = path('form_api_example.multistep_form') %}
-{% set input_demo = path('form_api_example.input_demo') %}
-{% set build_demo = path('form_api_example.build_demo') %}
-{% set container_demo = path('form_api_example.container_demo') %}
-{% set state_demo = path('form_api_example.state_demo') %}
-{% set vertical_tabs_demo = path('form_api_example.vertical_tabs_demo') %}
-{% set ajax_demo = path('form_api_example.ajax_color_demo') %}
-{% set ajax_addmore = path('form_api_example.ajax_addmore') %}
-{% set modal_form = path('form_api_example.modal_form', {'nojs': 'nojs'}) %}
-{% set block_admin = path('block.admin_display') %}
-
-{% trans %}
-
Form examples to demonstrate common UI solutions using the Drupal Form API
This module also provides a block, "Example: Display a form" that
- demonstrates how to display a form in a block. This same technique can be
- used whenever you need to display a form that is not the primary content of
- a page. You can enable it on your site using the
- block admin page.
-{% endtrans %}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/tests/src/Functional/FapiExampleTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/tests/src/Functional/FapiExampleTest.php
deleted file mode 100644
index bbcf529d6..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/tests/src/Functional/FapiExampleTest.php
+++ /dev/null
@@ -1,330 +0,0 @@
-doTestRoutes();
-
- $this->doTestAjaxAddMore();
- $this->doTestAjaxColorForm();
- $this->doTestBuildDemo();
- $this->doTestContainerDemoForm();
- $this->doTestInputDemoForm();
- $this->doTestModalForm();
- $this->doTestSimpleFormExample();
- $this->doTestStateDemoForm();
- $this->doTestVerticalTabsDemoForm();
- }
-
- /**
- * Tests links.
- */
- public function doTestRoutes() {
- $assertion = $this->assertSession();
-
- // Routes with menu links, and their form buttons.
- $routes = [
- 'form_api_example.description' => [],
- 'form_api_example.simple_form' => ['Submit'],
- 'form_api_example.input_demo' => ['Submit'],
- 'form_api_example.state_demo' => ['Submit'],
- 'form_api_example.container_demo' => ['Submit'],
- 'form_api_example.vertical_tabs_demo' => ['Submit'],
- // Modal form has a submit button, but requires input.
- 'form_api_example.modal_form' => [],
- 'form_api_example.ajax_color_demo' => ['Submit'],
- 'form_api_example.build_demo' => ['Submit'],
- 'form_api_example.ajax_addmore' => ['Submit'],
- // Multistep form has submit buttons, but requires input.
- 'form_api_example.multistep_form' => [],
- ];
-
- // Ensure the links appear in the tools menu sidebar.
- $this->drupalGet('');
- foreach (array_keys($routes) as $route) {
- $assertion->linkByHrefExists(Url::fromRoute($route)->getInternalPath());
- }
-
- // Go to all the routes and click all the buttons.
- foreach ($routes as $route => $buttons) {
- $path = Url::fromRoute($route);
- error_log($route);
- $this->drupalGet($path);
- $assertion->statusCodeEquals(200);
- foreach ($buttons as $button) {
- $this->drupalPostForm($path, [], $button);
- $assertion->statusCodeEquals(200);
- }
- }
- }
-
- /**
- * Test the ajax demo form.
- */
- public function doTestAjaxColorForm() {
- $assert = $this->assertSession();
-
- // Post the form.
- $edit = [
- 'temperature' => 'warm',
- ];
- $this->drupalPostForm(Url::fromRoute('form_api_example.ajax_color_demo'), $edit, 'Submit');
- $assert->statusCodeEquals(200);
- $assert->pageTextContains('Value for Temperature: warm');
- }
-
- /**
- * Test the build demo form.
- */
- public function doTestBuildDemo() {
- $assert = $this->assertSession();
- $build_demo_url = Url::fromRoute('form_api_example.build_demo');
-
- $edit = [
- 'change' => '1',
- ];
- $this->drupalPostForm($build_demo_url, $edit, 'Submit');
-
- $assert->pageTextContains('1. __construct');
- $assert->pageTextContains('2. getFormId');
- $assert->pageTextContains('3. validateForm');
- $assert->pageTextContains('4. submitForm');
-
- // Ensure the 'submit rebuild' action performs the rebuild.
- $this->drupalPostForm($build_demo_url, $edit, 'Submit Rebuild');
- $assert->pageTextContains('4. rebuildFormSubmit');
- }
-
- /**
- * Test the container demo form.
- */
- public function doTestContainerDemoForm() {
- $assert = $this->assertSession();
-
- // Post the form.
- $edit = [
- 'name' => 'Dave',
- 'pen_name' => 'DMan',
- 'title' => 'My Book',
- 'publisher' => 'me',
- 'diet' => 'vegan',
- ];
- $this->drupalPostForm(Url::fromRoute('form_api_example.container_demo'), $edit, 'Submit');
- $assert->pageTextContains('Value for name: Dave');
- $assert->pageTextContains('Value for pen_name: DMan');
- $assert->pageTextContains('Value for title: My Book');
- $assert->pageTextContains('Value for publisher: me');
- $assert->pageTextContains('Value for diet: vegan');
- }
-
- /**
- * Test the input demo form.
- */
- public function doTestInputDemoForm() {
- $assert = $this->assertSession();
-
- // Post the form.
- $edit = [
- 'tests_taken[SAT]' => TRUE,
- 'color' => '#2b49ff',
- 'expiration' => '2015-10-21',
- 'datetime[date]' => '2017-12-07 15:32:10',
- 'url' => 'https://www.drupal.org',
- 'email' => 'somebody@example.org',
- 'quantity' => '4',
- 'password' => 'letmein',
- 'password_confirm[pass1]' => 'letmein',
- 'password_confirm[pass2]' => 'letmein',
- 'size' => '76',
- 'active' => '1',
- 'search' => 'my search string',
- 'favorite' => 'blue',
- 'select_multiple[]' => ['act'],
- 'phone' => '555-555-5555',
- 'table[1]' => TRUE,
- 'table[3]' => TRUE,
- 'text' => 'This is a test of my form.',
- 'text_format[value]' => 'Examples for Developers',
- 'subject' => 'Form test',
- 'weight' => '3',
- ];
- $this->drupalPostForm(Url::fromRoute('form_api_example.input_demo'), $edit, 'Submit');
- $assert->statusCodeEquals(200);
-
- $assert->pageTextContains('Value for What standardized tests did you take?');
- $assert->pageTextContains('Value for Color: #2b49ff');
- $assert->pageTextContains('Value for Content expiration: 2015-10-21');
- $assert->pageTextContains('Value for Date Time: 2017-12-07 15:32:10');
- $assert->pageTextContains('Value for URL: https://www.drupal.org');
- $assert->pageTextContains('Value for Email: somebody@example.org');
- $assert->pageTextContains('Value for Quantity: 4');
- $assert->pageTextContains('Value for Password: letmein');
- $assert->pageTextContains('Value for New Password: letmein');
- $assert->pageTextContains('Value for Size: 76');
- $assert->pageTextContains('Value for active: 1');
- $assert->pageTextContains('Value for Search: my search string');
- $assert->pageTextContains('Value for Favorite color: blue');
- $assert->pageTextContains('Value for Select (multiple): Array ( [act] => act )');
- $assert->pageTextContains('Value for Phone: 555-555-5555');
- $assert->pageTextContains('Value for Users: Array ( [1] => 1 [3] => 3 )');
- $assert->pageTextContains('Value for Text: This is a test of my form.');
- $assert->pageTextContains('Value for Text format: Array ( [value] => Examples for Developers [format] => plain_text )');
- $assert->pageTextContains('Value for Subject: Form test');
- $assert->pageTextContains('Value for Weight: 3');
- }
-
- /**
- * Test the modal form.
- */
- public function doTestModalForm() {
- $assert = $this->assertSession();
-
- // Post the form.
- $edit = [
- 'title' => 'My Book',
- ];
- $this->drupalPostForm(Url::fromRoute('form_api_example.modal_form'), $edit, 'Submit');
- $assert->pageTextContains('Submit handler: You specified a title of My Book.');
- }
-
- /**
- * Check routes defined by form_api_example.
- */
- public function doTestSimpleFormExample() {
- $assert = $this->assertSession();
-
- // Post a title.
- $edit = ['title' => 'My Custom Title'];
- $this->drupalPostForm(Url::fromRoute('form_api_example.simple_form'), $edit, 'Submit');
- $assert->pageTextContains('You specified a title of My Custom Title.');
- }
-
- /**
- * Test the state demo form.
- */
- public function doTestStateDemoForm() {
- $assert = $this->assertSession();
-
- // Post the form.
- $edit = [
- 'needs_accommodation' => TRUE,
- 'diet' => 'vegan',
- ];
- $this->drupalPostForm(Url::fromRoute('form_api_example.state_demo'), $edit, 'Submit');
- $assert->pageTextContains('Dietary Restriction Requested: vegan');
- }
-
- /**
- * Test the vertical tabs demo form.
- */
- public function doTestVerticalTabsDemoForm() {
- $assert = $this->assertSession();
-
- // Post the form.
- $edit = [
- 'name' => 'Dave',
- 'publisher' => 'me',
- ];
- $this->drupalPostForm(Url::fromRoute('form_api_example.container_demo'), $edit, 'Submit');
- $assert->pageTextContains('Value for name: Dave');
- $assert->pageTextContains('Value for publisher: me');
- }
-
- /**
- * Test the Ajax Add More demo form.
- */
- public function doTestAjaxAddMore() {
- // XPath for the remove button. We have to use contains() here because the
- // ID will have a hash value at the end.
- $button_xpath = '//input[contains(@id,"edit-names-fieldset-actions-remove-name")]';
-
- $ajax_addmore_url = Url::fromRoute('form_api_example.ajax_addmore');
-
- // Verify that anonymous can access the ajax_add_more page.
- $this->drupalGet($ajax_addmore_url);
- $this->assertResponse(200);
- // Verify that there is no remove button.
- $this->assertEmpty($this->xpath($button_xpath));
-
- $name_one = 'John';
- $name_two = 'Smith';
-
- // Enter the value in field-1.
- // and click on 'Add one more' button.
- $edit = [];
- $edit['names_fieldset[name][0]'] = $name_one;
- $this->drupalPostForm($ajax_addmore_url, $edit, 'Add one more');
-
- // Verify field-2 gets added.
- // and value of field-1 should retained.
- $this->assertFieldsByValue($this->xpath('//input[@id = "edit-names-fieldset-name-0"]'), $name_one);
- $this->assertNotEmpty($this->xpath('//input[@id = "edit-names-fieldset-name-1"]'));
- // Verify that the remove button was added.
- $this->assertNotEmpty($this->xpath($button_xpath));
-
- // Enter the value in field-2
- // and click on 'Add one more' button.
- $edit['names_fieldset[name][1]'] = $name_two;
- $this->drupalPostForm(NULL, $edit, 'Add one more');
-
- // Verify field-3 gets added.
- // and value of field-1 and field-2 are retained.
- $this->assertFieldsByValue($this->xpath('//input[@id = "edit-names-fieldset-name-0"]'), $name_one);
- $this->assertFieldsByValue($this->xpath('//input[@id = "edit-names-fieldset-name-1"]'), $name_two);
- $this->assertNotEmpty($this->xpath('//input[@id = "edit-names-fieldset-name-2"]'));
-
- // Click on "Remove one" button to test remove button works.
- // and value of field-1 and field-2 are retained.
- $this->drupalPostForm(NULL, NULL, 'Remove one');
- $this->assertFieldsByValue($this->xpath('//input[@id = "edit-names-fieldset-name-0"]'), $name_one);
- $this->assertFieldsByValue($this->xpath('//input[@id = "edit-names-fieldset-name-1"]'), $name_two);
- $this->assertEmpty($this->xpath('//input[@id = "edit-names-fieldset-name-2"]'));
-
- // Submit the form and verify the results.
- $this->drupalPostForm(NULL, NULL, 'Submit');
- $this->assertText('These people are coming to the picnic: ' . $name_one . ', ' . $name_two);
-
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/tests/src/Functional/MultistepFormTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/tests/src/Functional/MultistepFormTest.php
deleted file mode 100644
index d2e2e0b92..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/tests/src/Functional/MultistepFormTest.php
+++ /dev/null
@@ -1,76 +0,0 @@
-drupalGet(Url::fromRoute('form_api_example.multistep_form'));
- $page = $this->getSession()->getPage();
- $h1 = $page->find('css', 'h1');
- $this->assertStringContainsString('Multistep form', $h1->getText());
- $desc = $page->find('css', '#edit-description label');
- $this->assertStringContainsString('page 1', $desc->getText());
- $this->submitForm([
- 'first_name' => 'Bozo',
- 'last_name' => 'Di Clown',
- 'birth_year' => 1980,
- ],
- 'Next');
-
- // Really new page?
- $page2 = $this->getSession()->getPage();
- $desc = $page2->find('css', '#edit-description label');
- $this->assertStringContainsString('page 2', $desc->getText());
-
- // Try the back button.
- $this->submitForm([], 'Back');
- $page1 = $this->getSession()->getPage();
- $desc = $page1->find('css', '#edit-description label');
- $this->assertStringContainsString('page 1', $desc->getText());
- // Is the form still filled out?
- $first_name = $page1->findField('first_name')->getValue();
- $this->assertEquals('Bozo', $first_name);
- $second_name = $page1->findField('last_name')->getValue();
- $this->assertEquals('Di Clown', $second_name);
- $birth_year = $page1->findField('birth_year')->getValue();
- $this->assertEquals('1980', $birth_year);
-
- // Back to the second page.
- $this->click('#edit-next');
- $page2 = $this->getSession()->getPage();
- $desc = $page2->find('css', '#edit-description label');
- $this->assertStringContainsString('page 2', $desc->getText());
- $this->submitForm(['color' => 'neon green'], 'Submit');
-
- // This should take us back to the first page with a status message.
- $messages = $this->getSession()->getPage()->find('css', 'ul.messages__list');
- $message_text = $messages->getHtml();
- $this->assertStringContainsString('Bozo Di Clown', $message_text);
- $this->assertStringContainsString('1980', $message_text);
- $this->assertStringContainsString('neon green', $message_text);
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/tests/src/Functional/SimpleFormBlockTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/tests/src/Functional/SimpleFormBlockTest.php
deleted file mode 100644
index 587139412..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/tests/src/Functional/SimpleFormBlockTest.php
+++ /dev/null
@@ -1,59 +0,0 @@
-assertSession();
-
- // Create user.
- $web_user = $this->drupalCreateUser(['administer blocks']);
- // Login the admin user.
- $this->drupalLogin($web_user);
-
- $theme_name = $this->config('system.theme')->get('default');
-
- // Place the block.
- $label = 'SimpleFormBlock-' . $this->randomString();
- $settings = [
- 'label' => $label,
- 'id' => 'form_api_example_simple_form_block',
- 'theme' => $theme_name,
- ];
- $this->drupalPlaceBlock('form_api_example_simple_form_block', $settings);
-
- // Verify the block is present.
- $this->drupalGet('');
- $assert->pageTextContains($label);
- $assert->fieldExists('title');
-
- // And that the form works.
- $edit = [];
- $edit['title'] = 'SimpleFormBlock title example';
- $this->drupalPostForm(NULL, $edit, t('Submit'));
- $assert->pageTextContains('You specified a title of SimpleFormBlock title example');
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/tests/src/FunctionalJavascript/AjaxColorFormTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/tests/src/FunctionalJavascript/AjaxColorFormTest.php
deleted file mode 100644
index 47d94ad95..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/tests/src/FunctionalJavascript/AjaxColorFormTest.php
+++ /dev/null
@@ -1,88 +0,0 @@
-drupalGet(Url::fromRoute('form_api_example.ajax_color_demo'));
-
- // Get Mink stuff.
- $assert = $this->assertSession();
- $page = $this->getSession()->getPage();
-
- // Before the color temperature dropdown is selected, we should not have a
- // color dropdown.
- $this->assertEmpty($page->find('css', 'select[name="color"]'));
-
- $color_matrix = [
- 'warm' => ['red', 'orange', 'yellow'],
- 'cool' => ['blue', 'purple', 'green'],
- ];
-
- foreach ($color_matrix as $temperature => $colors) {
- // Enter a color temperature.
- $this->assertNotEmpty(
- $color_temperature = $page->find('css', 'select[name="temperature"]')
- );
- $color_temperature->setValue($temperature);
- $assert->assertWaitOnAjaxRequest();
-
- // Find the color dropdown.
- $this->assertNotEmpty(
- $color_select = $page->find('css', 'select[name="color"]')
- );
-
- // Make sure all the correct color options are present.
- $this->assertNotEmpty(
- $color_options = $color_select->findAll('css', 'option')
- );
- $this->assertCount(count($colors), $color_options);
- foreach ($color_options as $color_element) {
- $this->assertContains($color_element->getValue(), $colors);
- }
-
- // Submit all the colors.
- foreach ($colors as $color) {
- $page->find('css', 'select[name="temperature"]')->setValue($temperature);
- $assert->assertWaitOnAjaxRequest();
- $page->find('css', 'select[name="color"]')->setValue($color);
- $page->findButton('Submit')->click();
- $assert->pageTextContains("Value for Temperature: $temperature");
- $assert->pageTextContains("Value for color: $color");
- }
- }
-
- // Finally, we can make sure that when we 'unset' the temperature dropdown,
- // the color dropdown goes away.
- $this->getSession()->getPage()->find('css', 'select[name="temperature"]')
- ->setValue('');
- $assert->assertWaitOnAjaxRequest();
- $this->assertEmpty($page->find('css', 'select[name="color"]'));
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/tests/src/FunctionalJavascript/ModalFormTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/tests/src/FunctionalJavascript/ModalFormTest.php
deleted file mode 100644
index dfd41de90..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/tests/src/FunctionalJavascript/ModalFormTest.php
+++ /dev/null
@@ -1,75 +0,0 @@
- 'nojs']);
- $this->drupalGet($modal_route_nojs);
-
- // Get Mink stuff.
- $assert = $this->assertSession();
- $session = $this->getSession();
- $page = $this->getSession()->getPage();
-
- // Click on 'see this form as a modal'.
- $this->clickLink('ajax-example-modal-link');
- $this->assertNotEmpty($assert->waitForElementVisible('css', '.ui-dialog'));
-
- // Enter a value.
- $this->assertNotEmpty($input = $page->find('css', 'div.ui-dialog input[name="title"]'));
- $input->setValue('test_title');
-
- // Click 'submit'.
- $this->assertNotEmpty($submit = $page->find('css', 'button.ui-button.form-submit'));
- $submit->click();
- $assert->assertWaitOnAjaxRequest();
-
- // Check that we have a result modal.
- $assert->elementContains('css', 'span.ui-dialog-title', 'test_title');
-
- // Click the close X.
- $this->assertNotEmpty($close = $page->find('css', 'button.ui-dialog-titlebar-close'));
- $close->click();
- $assert->assertWaitOnAjaxRequest();
-
- // Verify that the modal went away.
- $assert->pageTextNotContains('appears in this modal dialog.');
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/tests/src/FunctionalJavascript/StateDemoTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/tests/src/FunctionalJavascript/StateDemoTest.php
deleted file mode 100644
index cd5aa03ca..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/form_api_example/tests/src/FunctionalJavascript/StateDemoTest.php
+++ /dev/null
@@ -1,50 +0,0 @@
-drupalGet($route);
-
- // Get Mink stuff.
- $page = $this->getSession()->getPage();
-
- // Verify we can find the diet restrictions textfield, and that by default
- // it is not visible.
- $this->assertNotEmpty($checkbox = $page->find('css', 'input[name="diet"]'));
- $this->assertFalse($checkbox->isVisible(), 'Diet restrictions field is not visible.');
-
- // Check the needs special accommodation checkbox.
- $page->checkField('needs_accommodation');
-
- // Verify the textfield is visible now.
- $this->assertTrue($checkbox->isVisible(), 'Diet restrictions field is visible.');
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/hooks_example/hooks_example.api.php b/frontend/drupal9/web/modules/contrib/examples/modules/hooks_example/hooks_example.api.php
deleted file mode 100644
index e1c880cca..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/hooks_example/hooks_example.api.php
+++ /dev/null
@@ -1,53 +0,0 @@
-addMessage(t('This is the first time you have viewed the node %title.', ['%title' => $node->label()]));
- }
-}
-
-/**
- * @} End of "addtogroup hooks_example".
- */
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/hooks_example/hooks_example.info.yml b/frontend/drupal9/web/modules/contrib/examples/modules/hooks_example/hooks_example.info.yml
deleted file mode 100644
index e6c308d45..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/hooks_example/hooks_example.info.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-name: Hooks Example
-type: module
-description: Provides examples of implementing, defining, and invoking hooks.
-package: Example modules
-core_version_requirement: ^8.7.7 || ^9
-dependencies:
- - drupal:help
- - examples:examples
-
-# Information added by Drupal.org packaging script on 2021-10-07
-version: '3.0.3'
-project: 'examples'
-datestamp: 1633612832
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/hooks_example/hooks_example.links.menu.yml b/frontend/drupal9/web/modules/contrib/examples/modules/hooks_example/hooks_example.links.menu.yml
deleted file mode 100644
index be496bb67..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/hooks_example/hooks_example.links.menu.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-hooks_example.description:
- title: Hooks Example
- description: Hook examples using Drupal hooks.
- route_name: hooks_example.description
- expanded: TRUE
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/hooks_example/hooks_example.module b/frontend/drupal9/web/modules/contrib/examples/modules/hooks_example/hooks_example.module
deleted file mode 100644
index 7a0bb585c..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/hooks_example/hooks_example.module
+++ /dev/null
@@ -1,226 +0,0 @@
-' . t('This text is provided by the function hooks_example_help(), which is an implementation of hook hook_help(). To learn more about how this works checkout the code in hooks_example.module.') . '';
- }
-}
-
-/**
- * Implements hook_ENTITY_TYPE_view().
- *
- * Some hook names include additional tokens that need to be replaced when
- * implementing the hook. These hooks are dynamic in that when they are being
- * invoked a portion of their name is replaced with a dynamic value. This is
- * indicated by placing the token words in all caps. This pattern is often used
- * in situations where you want to allow modules to generically act on all
- * instances of a thing, or to act on only a specific subset.
- *
- * There are lots of different entity types in Drupal. Node, user, file, etc.
- * Using hook_entity_view() a module can act on a any entity that is being
- * viewed, regardless of type. If we wanted to count views of all entities,
- * regardless of type this would be a good choice. This variant is also useful
- * if you want to provide administrators with a form where they can choose from
- * a list of entity types which ones they want to count views for. The logic in
- * the generic hook implementation could then take that into account and act on
- * only a select set of entity types.
- *
- * If however, you know you only ever want to act on viewing of a node entity
- * you can instead implement hook_ENTITY_TYPE_view(). Where ENTITY_TYPE is a
- * token that can be replaced with any valid entity type name.
- *
- * @see hook_entity_view()
- * @see hook_ENTITY_TYPE_view()
- */
-function hooks_example_node_view(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display, $view_mode) {
- // This example hook implementation keeps track of the number of times a user
- // has viewed a specific node during their current session. Then displays that
- // information for them when they view a node.
- //
- // In addition, a hook is invoked that allows other modules to react when the
- // page view count is updated.
- //
- // Retrieve the active session from the current request object.
- $session = \Drupal::request()->getSession();
- $current_counts = $session->get('hooks_example.view_counts', []);
- if (!isset($current_counts[$entity->id()])) {
- // If this is the first time they've viewed the page we need to start the
- // counter.
- $current_counts[$entity->id()] = 1;
- }
- else {
- // If they have already viewed this page just increment the existing
- // counter.
- $current_counts[$entity->id()]++;
- }
-
- // Save the updated values.
- $session->set('hooks_example.view_counts', $current_counts);
-
- // Invoke a hook to alert other modules that the count was updated.
- //
- // Hooks are invoked via the `module_handler` service. Which is an instance of
- // \Drupal\Core\Extension\ModuleHandlerInterface.
- //
- // Hooks can be invoked in a few different ways:
- // - All at once using ModuleHandlerInterface::invokeAll() to call all
- // implementations of the specified hook provided by any enabled module.
- // - One at a time using ModuleHandlerInterface::invoke() to call only the
- // the specified module's implementation of a hook.
- // - Using ModuleHandlerInterface::alter() to pass alterable variables to
- // hook_TYPE_alter() implementations for all enabled modules. This method
- // should be used for instances where the calling module has assembled data
- // and would like to give other modules an opportunity to alter that data
- // before it's used. A common pattern is to use invokeAll() to first gather
- // input from other modules, the immediately afterwards call alter() to give
- // modules the opportunity to alter the aggregate data.
- $module_handler = \Drupal::moduleHandler();
-
- // Calling \Drupal\Core\Extension\ModuleHandlerInterface::invokeAll() will
- // call implementations of the hook in question for all enabled modules. The
- // method takes two arguments. The name of the hook to invoke, and an optional
- // array of arguments to pass to any functions implementing the hook.
- //
- // Hook names need to be unique. So when defining a new hook in your module it
- // is customary to prefix the hook name with the short name of your module
- // followed by the descriptive name of the hook itself. Because hooks names
- // are also PHP function names they should contain only lowercase alphanumeric
- // characters and underscores.
- //
- // The hook name parameter should have the "hook_" prefix removed. So if you
- // want to invoke hook_mymodule_do_something() the value used here would be
- // 'mymodule_do_something'.
- //
- // Hook implementations can optionally return a value, depending on the hook
- // definition. If they do, the invokeAll() method aggregates the responses
- // from all hooks in an array and returns the array.
- //
- // In this example we're invoking hook_hooks_example_count_incremented() and
- // passing all implementations the current view count for the node, and the
- // node object itself.
- $module_handler->invokeAll('hooks_example_count_incremented', [$current_counts[$entity->id()], $entity]);
-
- // Display the current number of pages the user has viewed along with the
- // node's content.
- $build['view_count'] = [
- '#markup' => '
' . t('You have viewed this node @total times this session.', ['@total' => $current_counts[$entity->id()]]) . '
',
- // In order for this example to work we disable caching for the content of
- // this node completely. This ensures that our hook is called every time the
- // node is viewed instead of using a cached version of the page for
- // subsequent requests.
- '#cache' => [
- 'max-age' => 0,
- ],
- ];
-}
-
-/**
- * Implements hook_form_alter().
- */
-function hooks_example_form_alter(&$form, FormStateInterface $form_state, $form_id) {
- // This is an example of what is known as an alter hook. The $form parameter
- // in this case represents an already complete Form API array and our hook
- // implementation is being given the opportunity to make changes to the
- // existing data structure before it's used. Inovking and alter hooks is a
- // common pattern anytime lists or complex data structures are assembled.
- // hook_form_alter(), which allows you to manipulate any form, is one of the
- // most commonly implemented hooks.
- //
- // @see hook_form_alter()
- // @see hook_form_FORM_ID_alter()
- //
- // If this is the user login form, change the description text of the username
- // field.
- if ($form_id === 'user_login_form') {
- $form['name']['#description'] = t('This text has been altered by hooks_example_form_alter().');
- }
-}
-
-/**
- * Implements hook_hooks_example_count_incremented().
- *
- * Hooks can be implemented by both the module that invokes them like we are
- * doing here, as well as by any other enabled module.
- */
-function hooks_example_hooks_example_count_incremented($current_count, NodeInterface $node) {
- if ($current_count === 1) {
- \Drupal::messenger()->addMessage(t('This is the first time you have viewed the node %title.', ['%title' => $node->label()]));
- }
-}
-
-/**
- * @} End of "defgroup hooks_example".
- */
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/hooks_example/hooks_example.routing.yml b/frontend/drupal9/web/modules/contrib/examples/modules/hooks_example/hooks_example.routing.yml
deleted file mode 100644
index e49167825..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/hooks_example/hooks_example.routing.yml
+++ /dev/null
@@ -1,8 +0,0 @@
-# hooks_example only has one route. It is to a page explaining the module.
-hooks_example.description:
- path: '/examples/hooks-example'
- defaults:
- _controller: '\Drupal\hooks_example\Controller\HooksExampleController::description'
- _title: 'Hooks Example'
- requirements:
- _permission: 'access content'
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/hooks_example/src/Controller/HooksExampleController.php b/frontend/drupal9/web/modules/contrib/examples/modules/hooks_example/src/Controller/HooksExampleController.php
deleted file mode 100644
index 548422a25..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/hooks_example/src/Controller/HooksExampleController.php
+++ /dev/null
@@ -1,23 +0,0 @@
-Implementing, defining, and invoking hooks
-
-
The code in this module implements a couple of new features which you can see
-in action.
-
-
Implements hook_help(): In
-hooks_example.module you'll find an implementation of the
-hook hook_help() which is used to add contents to this module's
-help overview. Visible at
-admin/help/hooks_example.
-
-
View counts:hooks_example_node_view() is an
-implementation of the hook hook_ENTITY_TYPE_view() that adds a
-basic page view counter. You can see this in action by navigating to any node on
-the site and looking for the the text telling you how many times you've viewed
-that page.
-
-
Don't have any nodes? Add some and look at
-their counters.
-
-
Implements hook_form_alter(): In
-hooks_example.module you'll find an implementation of
-hook_form_alter() which demonstrates the use of one of the most
-commonly used alter hooks. You can view the altered form at
-user/login.
-
-
To learn more about how to implement an existing hook, or how to define and
-invoke a new hook start by reading the @docblock comments in
-hooks_example.module.
-
-{% endtrans %}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/hooks_example/tests/src/Functional/HooksExampleTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/hooks_example/tests/src/Functional/HooksExampleTest.php
deleted file mode 100644
index 78b6c109f..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/hooks_example/tests/src/Functional/HooksExampleTest.php
+++ /dev/null
@@ -1,93 +0,0 @@
-createContentType(['type' => 'page']);
-
- $account = $this->drupalCreateUser(['access administration pages']);
- $this->drupalLogin($account);
- }
-
- /**
- * Test the output of the example page.
- */
- public function testHooksExample() {
- // Make sure our menus and links work.
- $this->drupalGet('');
- $this->assertSession()->linkExists('Hooks Example');
-
- // Test the description page at examples/hook-example returns a 200.
- $this->drupalGet('examples/hooks-example');
- $this->assertSession()->statusCodeEquals(200);
-
- // Test that our implementation of hook_help() works.
- $this->drupalGet('admin/help/hooks_example');
- $this->assertSession()->statusCodeEquals(200);
- $this->assertSession()->pageTextContains('This text is provided by the function hooks_example_help()');
-
- // Test that our implementation of hook_node_view() works.
- // Create a new node.
- $settings = [
- 'type' => 'page',
- 'title' => 'Hooks Example Testing Node',
- 'status' => 1,
- ];
- $node = $this->drupalCreateNode($settings);
-
- $this->drupalGet($node->toUrl());
-
- // Test that the output added to the page by hooks_example_node_view() is
- // present. Which also tests that our page view counting was initialized.
- $this->assertSession()->pageTextContains('You have viewed this node 1 times this session.');
- // Tests that the message set by
- // hooks_example_hooks_example_count_incremented() is displayed on the page.
- // Which also has the effect of testing to see wehther or not our custom
- // hook is being invoked.
- $this->assertSession()->pageTextContains('This is the first time you have viewed the node ' . $node->label() . '.');
-
- // Navigate to a new page, and then back and verify the counter was updated.
- $this->drupalGet('');
- $this->drupalGet($node->toUrl());
- $this->assertSession()->pageTextContains('You have viewed this node 2 times this session.');
- $this->assertSession()->pageTextNotContains('This is the first time you have viewed the node ' . $node->label() . '.');
-
- // Test our implementation of hook_form_alter().
- $this->drupalLogout();
- $this->drupalGet('user/login');
- $this->assertSession()->pageTextContains('This text has been altered by hooks_example_form_alter().');
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/css/accordion.css b/frontend/drupal9/web/modules/contrib/examples/modules/js_example/css/accordion.css
deleted file mode 100644
index 8dc9b6010..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/css/accordion.css
+++ /dev/null
@@ -1,74 +0,0 @@
-.accordionWrapper {
- background: #fff;
- float: left;
- width: 80%;
- box-sizing: border-box;
- box-shadow: 0 1.5em 85px 0 rgba(0, 0, 0, 0.2);
-}
-.accordionItem {
- float: left;
- display: block;
- width: 100%;
- box-sizing: border-box;
- font-family: 'Open-sans',Arial,sans-serif;
-}
-.accordionItemHeading {
- cursor: pointer;
- margin: 0 0 10px 0;
- padding: 10px;
- background: #2980b9;
- color: #fff;
- width: 100%;
- -webkit-border-radius: 3px;
- -moz-border-radius: 3px;
- border-radius: 3px;
- box-sizing: border-box;
-}
-.close .accordionItemContent {
- height: 0;
- transition: height 1s ease-out;
- -webkit-transform: scaleY(0);
- -o-transform: scaleY(0);
- -ms-transform: scaleY(0);
- transform: scaleY(0);
- float: left;
- display: block;
-}
-.open .accordionItemContent {
- padding: 20px;
- background-color: #fff;
- border: 1px solid #ddd;
- width: 100%;
- display: block;
- -webkit-transform: scaleY(1);
- -o-transform: scaleY(1);
- -ms-transform: scaleY(1);
- transform: scaleY(1);
- -webkit-transform-origin: top;
- -o-transform-origin: top;
- -ms-transform-origin: top;
- transform-origin: top;
- -webkit-transition: -webkit-transform 0.4s ease-out;
- -o-transition: -o-transform 0.4s ease;
- -ms-transition: -ms-transform 0.4s ease;
- transition: transform 0.4s ease;
- box-sizing: border-box;
-}
-
-.open .accordionItemHeading {
- margin: 0;
- -webkit-border-top-left-radius: 3px;
- -webkit-border-top-right-radius: 3px;
- -moz-border-radius-topleft: 3px;
- -moz-border-radius-topright: 3px;
- border-top-left-radius: 3px;
- border-top-right-radius: 3px;
- -webkit-border-bottom-right-radius: 0;
- -webkit-border-bottom-left-radius: 0;
- -moz-border-radius-bottomright: 0;
- -moz-border-radius-bottomleft: 0;
- border-bottom-right-radius: 0;
- border-bottom-left-radius: 0;
- background-color: #08447a;
- color: #ffffff;
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/css/jsweights.css b/frontend/drupal9/web/modules/contrib/examples/modules/js_example/css/jsweights.css
deleted file mode 100755
index 35bd23679..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/css/jsweights.css
+++ /dev/null
@@ -1,4 +0,0 @@
-.js-weights div {
- font-size: 20px;
- font-weight: bold;
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js/accordion.js b/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js/accordion.js
deleted file mode 100644
index 60d300d14..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js/accordion.js
+++ /dev/null
@@ -1,14 +0,0 @@
-var accItem = document.getElementsByClassName('accordionItem');
-var accHD = document.getElementsByClassName('accordionItemHeading');
-for (i = 0; i < accHD.length; i++) {
- accHD[i].addEventListener('click', toggleItem, false);
-}
-function toggleItem() {
- var itemClass = this.parentNode.className;
- for (i = 0; i < accItem.length; i++) {
- accItem[i].className = 'accordionItem close';
- }
- if (itemClass === 'accordionItem close') {
- this.parentNode.className = 'accordionItem open';
- }
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js/black.js b/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js/black.js
deleted file mode 100755
index 038ba8bb0..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js/black.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * @file
- * Contains the definition of the behaviour jsTestBlackWeight.
- */
-
-(function ($, Drupal, drupalSettings) {
-
- 'use strict';
-
- /**
- * Attaches the JS test behavior to to weight div.
- */
- Drupal.behaviors.jsTestBlackWeight = {
- attach: function (context, settings) {
- var weight = drupalSettings.js_example.js_weights.black;
- var newDiv = $('').css('color', 'black').html('I have a weight of ' + weight);
- $('#js-weights').append(newDiv);
- }
- };
-})(jQuery, Drupal, drupalSettings);
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js/blue.js b/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js/blue.js
deleted file mode 100755
index 88a2497ac..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js/blue.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * @file
- * Contains the definition of the behaviour jsTestBlueWeight.
- */
-
-(function ($, Drupal, drupalSettings) {
-
- 'use strict';
-
- /**
- * Attaches the JS test behavior to weight div.
- */
- Drupal.behaviors.jsTestBlueWeight = {
- attach: function (context, settings) {
- var weight = drupalSettings.js_example.js_weights.blue;
- var newDiv = $('').css('color', 'blue').html('I have a weight of ' + weight);
- $('#js-weights').append(newDiv);
- }
- };
-})(jQuery, Drupal, drupalSettings);
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js/brown.js b/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js/brown.js
deleted file mode 100755
index 9c25b3a7f..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js/brown.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * @file
- * Contains the definition of the behaviour jsTestBrownWeight.
- */
-
-(function ($, Drupal, drupalSettings) {
-
- 'use strict';
-
- /**
- * Attaches the JS test behavior to weight div.
- */
- Drupal.behaviors.jsTestBrownWeight = {
- attach: function (context, settings) {
- var weight = drupalSettings.js_example.js_weights.brown;
- var newDiv = $('').css('color', 'brown').html('I have a weight of ' + weight);
- $('#js-weights').append(newDiv);
- }
- };
-})(jQuery, Drupal, drupalSettings);
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js/green.js b/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js/green.js
deleted file mode 100755
index 2c88df4a9..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js/green.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * @file
- * Contains the definition of the behaviour jsTestGreenWeight.
- */
-
-(function ($, Drupal, drupalSettings) {
-
- 'use strict';
-
- /**
- * Attaches the JS test behavior to weight div.
- */
- Drupal.behaviors.jsTestGreenWeight = {
- attach: function (context, settings) {
- var weight = drupalSettings.js_example.js_weights.green;
- var newDiv = $('').css('color', 'green').html('I have a weight of ' + weight);
- $('#js-weights').append(newDiv);
- }
- };
-})(jQuery, Drupal, drupalSettings);
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js/purple.js b/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js/purple.js
deleted file mode 100755
index 5652ad341..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js/purple.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * @file
- * Contains the definition of the behaviour jsTestPurpleWeight.
- */
-
-(function ($, Drupal, drupalSettings) {
-
- 'use strict';
-
- /**
- * Attaches the JS test behavior to weight div.
- */
- Drupal.behaviors.jsTestPurpleWeight = {
- attach: function (context, settings) {
- var weight = drupalSettings.js_example.js_weights.purple;
- var newDiv = $('').css('color', 'purple').html('I have a weight of ' + weight);
- $('#js-weights').append(newDiv);
- }
- };
-})(jQuery, Drupal, drupalSettings);
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js/red.js b/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js/red.js
deleted file mode 100755
index 5dfc4274d..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js/red.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * @file
- * Contains the definition of the behaviour jsTestRedWeight.
- */
-
-(function ($, Drupal, drupalSettings) {
-
- 'use strict';
-
- /**
- * Attaches the JS test behavior to weight div.
- */
- Drupal.behaviors.jsTestRedWeight = {
- attach: function (context, settings) {
- var weight = drupalSettings.js_example.js_weights.red;
- var newDiv = $('').css('color', 'red').html('I have a weight of ' + weight);
- $('#js-weights').append(newDiv);
- }
- };
-})(jQuery, Drupal, drupalSettings);
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js_example.info.yml b/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js_example.info.yml
deleted file mode 100644
index 6ed87ef26..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js_example.info.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-name: JavaScript Example
-description: Demonstrates JavaScript features.
-type: module
-package: 'Example modules'
-core_version_requirement: ^8.7.7 || ^9
-dependencies:
- - drupal:node
- - examples:examples
-
-# Information added by Drupal.org packaging script on 2021-10-07
-version: '3.0.3'
-project: 'examples'
-datestamp: 1633612832
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js_example.libraries.yml b/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js_example.libraries.yml
deleted file mode 100644
index fdf3e585c..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js_example.libraries.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-# A pure JavaScript accordion modified form
-# https://codepen.io/sureshrkm/pen/ZbzBpr.
-js_example.accordion:
- js:
- js/accordion.js: {}
- css:
- component:
- css/accordion.css: {}
-
-# Show how weights work.
-js_example.weights:
- # Add css file.
- css:
- component:
- css/jsweights.css: {}
- # Add js files.
- js:
- # weight is used as example attribute, but please avoid it and instead use
- # dependencies for order loading.
- js/red.js: { weight: -4 }
- js/blue.js: { weight: -2 }
- js/green.js: { weight: -1 }
- js/brown.js: { weight: -2 }
- js/black.js: { weight: -1 }
- js/purple.js: { weight: -5 }
- dependencies:
- - core/jquery
- - core/drupalSettings
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js_example.links.menu.yml b/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js_example.links.menu.yml
deleted file mode 100644
index 38292809e..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js_example.links.menu.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-# Define default links for this module.
-js_example.info:
- title: JavaScript Example
- description: Some information about the JavaScript example.
- route_name: js_example.info
- expanded: TRUE
-
-js_example.weights:
- title: JavaScript weighting in action
- description: Show list weighting through JavaScript.
- route_name: js_example.weights
- parent: js_example.info
- weight: 10
-
-js_example.accordion:
- title: JavaScript accordion
- description: A pure JavaScript accordion demo.
- route_name: js_example.accordion
- parent: js_example.info
- weight: 1
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js_example.module b/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js_example.module
deleted file mode 100755
index e35b3680f..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js_example.module
+++ /dev/null
@@ -1,37 +0,0 @@
- [
- 'template' => 'accordion',
- 'variables' => ['title' => NULL],
- ],
- ];
-}
-
-/**
- * @} End of "defgroup js_example".
- */
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js_example.routing.yml b/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js_example.routing.yml
deleted file mode 100755
index 8525ffcfb..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/js_example.routing.yml
+++ /dev/null
@@ -1,23 +0,0 @@
-js_example.info:
- path: '/examples/js-example'
- defaults:
- _title: 'JavaScript Example Information'
- _controller: '\Drupal\js_example\Controller\JsExampleController::description'
- requirements:
- _permission: 'access content'
-
-js_example.weights:
- path: '/examples/js-example/weights'
- defaults:
- _title: 'JS Example: see weighting in action'
- _controller: '\Drupal\js_example\Controller\JsExampleController::getJsWeightImplementation'
- requirements:
- _permission: 'access content'
-
-js_example.accordion:
- path: '/examples/js-example/accordion'
- defaults:
- _title: 'JS Example: JavaScript Accordion'
- _controller: '\Drupal\js_example\Controller\JsExampleController::getJsAccordionImplementation'
- requirements:
- _permission: 'access content'
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/src/Controller/JsExampleController.php b/frontend/drupal9/web/modules/contrib/examples/modules/js_example/src/Controller/JsExampleController.php
deleted file mode 100755
index df5226da9..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/src/Controller/JsExampleController.php
+++ /dev/null
@@ -1,114 +0,0 @@
-weight array to drupalSettings, which is where Drupal
- * passes data out to JavaScript.
- *
- * Each of the color scripts (red.js, blue.js, etc) uses jQuery to find our
- * DIV, and then add some content to it. The order in which the color scripts
- * execute will end up being the order of the content.
- *
- * The 'weight' atttribute in libraries yml file determines the order in which
- * a script is output to the page. To see this in action:
- * - Uncheck the 'Aggregate Javascript files' setting at:
- * admin/config/development/performance.
- * - Load the page: examples/js_example/weights. Examine the page source.
- * You will see that the color js scripts have been added in the
- * element in weight order.
- *
- * To test further, change a weight in the $weights array below and in library
- * yml file, then rebuild cache and reload examples/js_example/weights.
- * Examine the new source to see the reordering.
- *
- * @return array
- * A renderable array.
- */
- public function getJsWeightImplementation() {
- // Create an array of items with random-ish weight values.
- $weights = [
- 'red' => -4,
- 'blue' => -2,
- 'green' => -1,
- 'brown' => -2,
- 'black' => -1,
- 'purple' => -5,
- ];
-
- // Start building the content.
- $build = [];
- // Main container DIV. We give it a unique ID so that the JavaScript can
- // find it using jQuery.
- $build['content'] = [
- '#markup' => '',
- ];
- // Attach library containing css and js files.
- $build['#attached']['library'][] = 'js_example/js_example.weights';
- // Attach the weights array to our JavaScript settings. This allows the
- // color scripts we just attached to discover their weight values, by
- // accessing drupalSettings.js_example.js_weights.*color*. The color scripts
- // only use this information for display to the user.
- $build['#attached']['drupalSettings']['js_example']['js_weights'] = $weights;
-
- return $build;
- }
-
- /**
- * Accordion page implementation.
- *
- * We're allowing a twig template to define our content in this case,
- * which isn't normally how things work, but it's easier to demonstrate
- * the JavaScript this way.
- *
- * @return array
- * A renderable array.
- */
- public function getJsAccordionImplementation() {
- $title = $this->t('Click sections to expand or collapse:');
- // Build using our theme. This gives us content, which is not a good
- // practice, but which allows us to demonstrate adding JavaScript here.
- $build['myelement'] = [
- '#theme' => 'js_example_accordion',
- '#title' => $title,
- ];
- // Add our script. It is tiny, but this demonstrates how to add it. We pass
- // our module name followed by the internal library name declared in
- // libraries yml file.
- $build['myelement']['#attached']['library'][] = 'js_example/js_example.accordion';
- // Return the renderable array.
- return $build;
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/templates/accordion.html.twig b/frontend/drupal9/web/modules/contrib/examples/modules/js_example/templates/accordion.html.twig
deleted file mode 100755
index 4af4f82d3..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/templates/accordion.html.twig
+++ /dev/null
@@ -1,36 +0,0 @@
-{#
-
-/**
- * @file
- * Template file for js_example module.
- */
-#}
-
-
-
About accordions
-
-
JavaScript accordions let you squeeze a lot of content into a small space in a Web page.
-
This simple accordion degrades gracefully in browsers that don't support JavaScript or CSS.
-
-
-
-
-
Accordion items
-
-
A JavaScript accordion is made up of a number of expandable/collapsible items. Only one item is ever shown at a time.
-
You can include any content you want inside an accordion item. Here's a bullet list:
-
-
List item #1
-
List item #2
-
List item #3
-
-
-
-
-
-
How to use a JavaScript accordion
-
-
Click an accordion item's heading to expand it. To collapse the item, click it again, or click another item heading.
-
-
-
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/templates/description.html.twig b/frontend/drupal9/web/modules/contrib/examples/modules/js_example/templates/description.html.twig
deleted file mode 100644
index 524acca16..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/templates/description.html.twig
+++ /dev/null
@@ -1,29 +0,0 @@
-{#
-
-Description text for the JavaScript Example.
-
-#}
-
-{% set js_weights = path('js_example.weights') %}
-{% set js_accordion = path('js_example.accordion') %}
-
-{% trans %}
-
-
Sorting according to numeric weight: This
- demonstrates attaching your own JavaScript code to individual page
- elements using Drupal rendering system.
-
-
-
-{% endtrans %}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/tests/src/Functional/JsExampleTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/js_example/tests/src/Functional/JsExampleTest.php
deleted file mode 100644
index 52b844a7e..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/js_example/tests/src/Functional/JsExampleTest.php
+++ /dev/null
@@ -1,46 +0,0 @@
-assertSession();
-
- $paths = [
- 'examples/js-example',
- 'examples/js-example/weights',
- 'examples/js-example/accordion',
- ];
- foreach ($paths as $path) {
- $this->drupalGet($path);
- $assert->statusCodeEquals(200);
- }
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/menu_example/menu_example.info.yml b/frontend/drupal9/web/modules/contrib/examples/modules/menu_example/menu_example.info.yml
deleted file mode 100644
index dbdaadd59..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/menu_example/menu_example.info.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-name: Menu Example
-type: module
-description: 'An example module showing the main steps to define and handling menu links'
-package: 'Example modules'
-core_version_requirement: ^8.7.7 || ^9
-dependencies:
- - drupal:examples
-
-# Information added by Drupal.org packaging script on 2021-10-07
-version: '3.0.3'
-project: 'examples'
-datestamp: 1633612832
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/menu_example/menu_example.links.menu.yml b/frontend/drupal9/web/modules/contrib/examples/modules/menu_example/menu_example.links.menu.yml
deleted file mode 100644
index bcfc9f185..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/menu_example/menu_example.links.menu.yml
+++ /dev/null
@@ -1,92 +0,0 @@
-# This file links a menu link with route_name.
-#
-# 'title' key is only key required.
-#
-# 'description' is is shown either as a tooltip on the item or in the admin UI
-# as the description of the option on the page/
-#
-# 'weight' is used to order the items (higher weights get placed towards the
-# end of the menu among items on the same level).
-#
-# 'route_name' is used to link menu link to corresponding route.
-#
-# 'parent' is used to put item into the menu hierarchy by referring to the
-# parent menu link name.
-#
-examples.menu_example:
- title: 'Menu Example'
- description: 'Simplest possible menu type, and the parent menu entry for others'
- expanded: 1
- route_name: examples.menu_example
-
-examples.menu_example.alternate_menu:
- title: 'Menu Example: Menu in alternate menu'
- #If menu_name is omitted, the "Tools" menu will be used.
- menu_name: 'main'
- route_name: examples.menu_example.alternate_menu
-
-examples.menu_example.permissioned:
- title: 'Permissioned Example'
- parent: examples.menu_example
- expanded: 1
- route_name: examples.menu_example.permissioned
- weight: 10
-
-examples.menu_example.permissioned_controlled:
- title: 'Permissioned Menu Item'
- parent: examples.menu_example.permissioned
- route_name: examples.menu_example.permissioned_controlled
- weight: 10
-
-examples.menu_example.custom_access:
- title: 'Custom Access Example'
- parent: examples.menu_example
- expanded: 1
- route_name: examples.menu_example.custom_access
- weight: -5
-
-examples.menu_example.custom_access_page:
- title: 'Custom Access Menu Item'
- parent: examples.menu_example.custom_access
- route_name: examples.menu_example.custom_access_page
-
-examples.menu_example.route_only:
- title: 'Route only example'
- parent: examples.menu_example
- route_name: examples.menu_example.route_only
- weight: 20
-
-examples.menu_example.tabs:
- title: 'Tabs'
- description: 'Shows how to create primary and secondary tabs'
- parent: examples.menu_example
- route_name: examples.menu_example.tabs
- weight: 30
-
-examples.menu_example.use_url_arguments:
- title: 'URL Arguments'
- description: 'The page callback can use the arguments provided after the path used as key'
- parent: examples.menu_example
- route_name: examples.menu_example.use_url_arguments
- weight: 40
-
-examples.menu_example.title_callbacks:
- title: 'Dynamic title'
- description: 'The title of this menu item is dynamically generated'
- parent: examples.menu_example
- route_name: examples.menu_example.title_callbacks
- weight: 50
-
-examples.menu_example.placeholder_argument:
- title: Placeholder Arguments
- description: ''
- parent: 'examples.menu_example'
- route_name: examples.menu_example.placeholder_argument
- weight: 60
-
-example.menu_example.path_override:
- title: Path Override
- description: ''
- parent: 'examples.menu_example'
- route_name: example.menu_example.path_override
- weight: 70
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/menu_example/menu_example.links.task.yml b/frontend/drupal9/web/modules/contrib/examples/modules/menu_example/menu_example.links.task.yml
deleted file mode 100644
index b50df555f..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/menu_example/menu_example.links.task.yml
+++ /dev/null
@@ -1,53 +0,0 @@
-# This file creates static local tasks (Tabs).
-# This file will be needed to place in module root.
-#
-# 'title' of the tab will show up on the user interface and tab.
-#
-# 'base_route' is the same as the name of the route where the "default" tab
-# appears. The base_route is used to group together related tabs.
-#
-# 'weight' is used to provide weights for the tabs if needed.
-# The tab whose route is the same as the base_route will by default
-# get a negative weight and appear on the left.
-#
-# 'parent_id' is used to create multi level of tabs.
-# To relate a tab to its parent use same name as parent_id as shown below in
-# examples.menu_example.tabs.secondary.
-#
-examples.menu_example.tabs:
- route_name: examples.menu_example.tabs
- title: Default primary tab
- base_route: examples.menu_example.tabs
-
-examples.menu_example.tabs_second:
- route_name: examples.menu_example.tabs_second
- title: Second
- base_route: examples.menu_example.tabs
- weight: 2
-
-examples.menu_example.tabs_third:
- route_name: examples.menu_example.tabs_third
- title: Third
- base_route: examples.menu_example.tabs
- weight: 3
-
-examples.menu_example.tabs_fourth:
- route_name: examples.menu_example.tabs_fourth
- title: Fourth
- base_route: examples.menu_example.tabs
- weight: 4
-
-examples.menu_example.tabs.secondary:
- route_name: examples.menu_example.tabs
- title: Default secondary tab
- parent_id: examples.menu_example.tabs
-
-examples.menu_example.tabs_default_second:
- route_name: examples.menu_example.tabs_default_second
- title: Second
- parent_id: examples.menu_example.tabs
-
-examples.menu_example.tabs_default_third:
- route_name: examples.menu_example.tabs_default_third
- title: Third
- parent_id: examples.menu_example.tabs
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/menu_example/menu_example.module b/frontend/drupal9/web/modules/contrib/examples/modules/menu_example/menu_example.module
deleted file mode 100644
index 05219715e..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/menu_example/menu_example.module
+++ /dev/null
@@ -1,43 +0,0 @@
-isAuthenticated());
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/menu_example/src/Controller/MenuExampleController.php b/frontend/drupal9/web/modules/contrib/examples/modules/menu_example/src/Controller/MenuExampleController.php
deleted file mode 100644
index 789bb4840..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/menu_example/src/Controller/MenuExampleController.php
+++ /dev/null
@@ -1,268 +0,0 @@
-description(),
- ];
- }
-
- /**
- * Show a menu link in a menu other than the default "Navigation" menu.
- */
- public function alternateMenu() {
- return [
- '#markup' => $this->t('This will be in the Main menu instead of the default Tools menu'),
- ];
-
- }
-
- /**
- * A menu entry with simple permissions using 'access protected menu example'.
- *
- * @throws \InvalidArgumentException
- */
- public function permissioned() {
- $url = Url::fromRoute('examples.menu_example.permissioned_controlled');
- return [
- '#markup' => $this->t('A menu item that requires the "access protected menu example" permission is at @link', [
- '@link' => Link::createFromRoute($url->getInternalPath(), $url->getRouteName())->toString(),
- ]),
- ];
- }
-
- /**
- * Only accessible when the user will be granted with required permission.
- *
- * The permission is defined in file menu_examples.permissions.yml.
- */
- public function permissionedControlled() {
- return [
- '#markup' => $this->t('This menu entry will not show and the page will not be accessible without the "access protected menu example" permission to current user.'),
- ];
- }
-
- /**
- * Demonstrates the use of custom access check in routes.
- *
- * @throws \InvalidArgumentException
- *
- * @see \Drupal\menu_example\Controller\MenuExampleController::customAccessPage()
- */
- public function customAccess() {
- $url = Url::fromRoute('examples.menu_example.custom_access_page');
- return [
- '#markup' => $this->t('A menu item that requires the user to posess a role of "authenticated" is at @link', [
- '@link' => Link::createFromRoute($url->getInternalPath(), $url->getRouteName())->toString(),
- ]),
- ];
- }
-
- /**
- * Content will be displayed only if access check is satisfied.
- *
- * @see \Drupal\menu_example\Controller\MenuExampleController::customAccess()
- */
- public function customAccessPage() {
- return [
- '#markup' => $this->t('This menu entry will not be visible and access will result
- in a 403 error unless the user has the "authenticated" role. This is
- accomplished with a custom access check plugin.'),
- ];
- }
-
- /**
- * Give the user a link to the route-only page.
- *
- * @throws \InvalidArgumentException
- */
- public function routeOnly() {
- $url = Url::fromRoute('examples.menu_example.route_only.callback');
- return [
- '#markup' => $this->t('A menu entry with no menu link is at @link', [
- '@link' => Link::createFromRoute($url->getInternalPath(), $url->getRouteName())->toString(),
- ]),
- ];
- }
-
- /**
- * Such callbacks can be user for creating web services in Drupal 8.
- */
- public function routeOnlyCallback() {
- return [
- '#markup' => $this->t('The route entry has no corresponding menu links entry, so it provides a route without a menu link, but it is the same in every other way to the simplest example.'),
- ];
- }
-
- /**
- * Uses the path and title to determine the page content.
- *
- * This controller is mapped dynamically based on the 'route_callbacks:' key
- * in the routing YAML file.
- *
- * @param string $path
- * Path/URL of menu item.
- * @param string $title
- * Title of menu item.
- *
- * @return array
- * Controller response.
- *
- * @see Drupal\menu_example\Routing\MenuExampleDynamicRoutes
- */
- public function tabsPage($path, $title) {
- $secondary = substr_count($path, '/') > 2 ? 'secondary ' : '';
- return [
- '#markup' => $this->t('This is the @secondary tab "@tabname" in the "basic tabs" example.', ['@secondary' => $secondary, '@tabname' => $title]),
- ];
- }
-
- /**
- * Demonstrates use of optional URL arguments in for menu item.
- *
- * @param string $arg1
- * First argument of URL.
- * @param string $arg2
- * Second argument of URL.
- *
- * @return array
- * Controller response.
- *
- * @see https://www.drupal.org/docs/8/api/routing-system/parameters-in-routes
- */
- public function urlArgument($arg1, $arg2) {
- // Perpare URL for single arguments.
- $url_single = Url::fromRoute('examples.menu_example.use_url_arguments', ['arg1' => 'one']);
-
- // Prepare URL for multiple arguments.
- $url_double = Url::fromRoute('examples.menu_example.use_url_arguments', ['arg1' => 'one', 'arg2' => 'two']);
-
- // Add these argument links to the page content.
- $markup = $this->t('This page demonstrates using arguments in the url. For example, access it with @link_single for single argument or @link_double for two arguments in URL', [
- '@link_single' => Link::createFromRoute($url_single->getInternalPath(), $url_single->getRouteName(), $url_single->getRouteParameters())->toString(),
- '@link_double' => Link::createFromRoute($url_double->getInternalPath(), $url_double->getRouteName(), $url_double->getRouteParameters())->toString(),
- ]);
-
- // Process the arguments if they're provided.
- if (!empty($arg1)) {
- $markup .= '
';
- }
-
- // Finally return the markup.
- return [
- '#markup' => $markup,
- ];
- }
-
- /**
- * Demonstrate generation of dynamic creation of page title.
- *
- * @see \Drupal\menu_example\Controller\MenuExampleController::backTitle()
- */
- public function titleCallbackContent() {
- return [
- '#markup' => $this->t('The title of this page is dynamically changed by the title callback for this route defined in menu_example.routing.yml.'),
- ];
- }
-
- /**
- * Generates title dynamically.
- *
- * @see \Drupal\menu_example\Controller\MenuExampleController::titleCallback()
- */
- public function titleCallback() {
- return [
- '#markup' => $this->t('The new title is your username: @name', [
- '@name' => $this->currentUser()->getDisplayName(),
- ]),
- ];
- }
-
- /**
- * Demonstrates how you can provide a placeholder url arguments.
- *
- * @throws \InvalidArgumentException
- *
- * @see \Drupal\menu_example\Controller\MenuExampleController::placeholderArgsDisplay()
- * @see https://www.drupal.org/docs/8/api/routing-system/using-parameters-in-routes
- */
- public function placeholderArgs() {
- $url = Url::fromRoute('examples.menu_example.placeholder_argument.display', ['arg' => 3343]);
- return [
- '#markup' => $this->t('Demonstrate placeholders by visiting @link', [
- '@link' => Link::createFromRoute($url->getInternalPath(), $url->getRouteName(), $url->getRouteParameters())->toString(),
- ]),
- ];
- }
-
- /**
- * Displays placeholder argument supplied in URL.
- *
- * @param int $arg
- * URL argument.
- *
- * @return array
- * URL argument.
- *
- * @see \Drupal\menu_example\Controller\MenuExampleController::placeholderArgs()
- */
- public function placeholderArgsDisplay($arg) {
- return [
- '#markup' => $arg,
- ];
-
- }
-
- /**
- * Demonstrate how one can alter the existing routes.
- */
- public function pathOverride() {
- return [
- '#markup' => $this->t('This menu item was created strictly to allow the RouteSubscriber class to have something to operate on. menu_example.routing.yml defined the path as examples/menu-example/menu-original-path. The alterRoutes() changes it to /examples/menu-example/menu-altered-path. You can try navigating to both paths and see what happens!'),
- ];
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/menu_example/src/Routing/MenuExampleDynamicRoutes.php b/frontend/drupal9/web/modules/contrib/examples/modules/menu_example/src/Routing/MenuExampleDynamicRoutes.php
deleted file mode 100644
index 3263641a8..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/menu_example/src/Routing/MenuExampleDynamicRoutes.php
+++ /dev/null
@@ -1,57 +0,0 @@
- 'Default primary tab',
- 'tabs/second' => 'Second',
- 'tabs/third' => 'Third',
- 'tabs/fourth' => 'Fourth',
- 'tabs/default/second' => 'Second',
- 'tabs/default/third' => 'Third',
- ];
-
- foreach ($tabs as $path => $title) {
- $machine_name = 'examples.menu_example.' . str_replace('/', '_', $path);
- $routes[$machine_name] = new Route(
- // Path to attach this route to:
- '/examples/menu-example/' . $path,
- // Route defaults:
- [
- '_controller' => '\Drupal\menu_example\Controller\MenuExampleController::tabsPage',
- '_title' => $title,
- 'path' => $path,
- 'title' => $title,
- ],
- // Route requirements:
- [
- '_access' => 'TRUE',
- ]
- );
- }
-
- return $routes;
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/menu_example/src/Routing/RouteSubscriber.php b/frontend/drupal9/web/modules/contrib/examples/modules/menu_example/src/Routing/RouteSubscriber.php
deleted file mode 100644
index 6f78dc615..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/menu_example/src/Routing/RouteSubscriber.php
+++ /dev/null
@@ -1,32 +0,0 @@
-get('example.menu_example.path_override');
- // Set the new path.
- $route->setPath('/examples/menu-example/menu-altered-path');
- // Change title to indicate changes.
- $route->setDefault('_title', 'Menu item altered by RouteSubscriber::alterRoutes');
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/menu_example/templates/description.html.twig b/frontend/drupal9/web/modules/contrib/examples/modules/menu_example/templates/description.html.twig
deleted file mode 100644
index 266fd0a83..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/menu_example/templates/description.html.twig
+++ /dev/null
@@ -1,34 +0,0 @@
-{#
-
-Description text for the Menu Example.
-
-#}
-
-{% set custom_access = path('examples.menu_example.custom_access') %}
-{% set permissioned = path('examples.menu_example.permissioned') %}
-{% set route_only = path('examples.menu_example.route_only') %}
-{% set tabs = path('examples.menu_example.tabs') %}
-{% set use_url_arguments = path('examples.menu_example.use_url_arguments') %}
-{% set title_callbacks = path('examples.menu_example.title_callbacks') %}
-{% set placeholder_argument = path('examples.menu_example.placeholder_argument') %}
-{% set path_override = path('example.menu_example.path_override') %}
-
-{% trans %}
-
-
This page is displayed by the simplest (and base) menu example. Note that
-the title of the page is the same as the link title. There are a number of
-examples here, from the most basic (like this one) to extravagant mappings of
-loaded placeholder arguments. Enjoy!
-
-{% endtrans %}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/menu_example/tests/src/Functional/MenuExampleTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/menu_example/tests/src/Functional/MenuExampleTest.php
deleted file mode 100644
index 862cd6179..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/menu_example/tests/src/Functional/MenuExampleTest.php
+++ /dev/null
@@ -1,121 +0,0 @@
-placeBlock('system_menu_block:main');
- }
-
- /**
- * Test all the routes.
- */
- public function testMenuExampleRoutes() {
- $assert = $this->assertSession();
- // Key is route, value is page contents.
- $routes = [
- 'examples.menu_example' => 'This page is displayed by the simplest (and base) menu example.',
- 'examples.menu_example.permissioned' => 'A menu item that requires the "access protected menu example" permission',
- 'examples.menu_example.custom_access' => 'A menu item that requires the user to posess',
- 'examples.menu_example.custom_access_page' => 'This menu entry will not be visible and access will result in a 403',
- 'examples.menu_example.route_only' => 'A menu entry with no menu link is',
- 'examples.menu_example.use_url_arguments' => 'This page demonstrates using arguments in the url',
- 'examples.menu_example.title_callbacks' => 'The title of this page is dynamically changed by the title callback',
- 'examples.menu_example.placeholder_argument' => 'Demonstrate placeholders by visiting',
- 'example.menu_example.path_override' => 'This menu item was created strictly to allow the RouteSubscriber',
- 'examples.menu_example.alternate_menu' => 'This will be in the Main menu instead of the default Tools menu',
- ];
- $this->drupalLogin($this->createUser());
- $this->drupalGet(Url::fromRoute(''));
- // Check that all the links appear in the tools menu.
- foreach (array_keys($routes) as $route) {
- $assert->linkByHrefExists(Url::fromRoute($route)->getInternalPath());
- }
-
- // Add routes that are not in the tools menu.
- $routes['examples.menu_example.route_only.callback'] = 'The route entry has no corresponding menu links entry';
- // Check that all the routes are reachable and contain content.
- foreach ($routes as $route => $content) {
- $this->drupalGet(Url::fromRoute($route));
- $assert->statusCodeEquals(200);
- $assert->pageTextContains($content);
- }
-
- // Check some special-case routes. First is the required argument path.
- $arg = 2377;
- $this->drupalGet(Url::fromRoute('examples.menu_example.placeholder_argument.display', ['arg' => $arg]));
- $assert->statusCodeEquals(200);
- $assert->pageTextContains($arg);
-
- // Check the generated route_callbacks tabs.
- $dynamic_routes = [
- 'examples.menu_example.tabs_second',
- 'examples.menu_example.tabs_third',
- 'examples.menu_example.tabs_fourth',
- 'examples.menu_example.tabs_default_second',
- 'examples.menu_example.tabs_default_third',
- ];
- $this->drupalGet(Url::fromRoute('examples.menu_example.tabs'));
- foreach ($dynamic_routes as $route) {
- $assert->linkByHrefExists(Url::fromRoute($route)->getInternalPath());
- }
- foreach ($dynamic_routes as $route) {
- $this->drupalGet(Url::fromRoute($route));
- $assert->statusCodeEquals(200);
- }
-
- // Check the special permission route.
- $this->drupalGet(Url::fromRoute('examples.menu_example.permissioned_controlled'));
- $assert->statusCodeEquals(403);
- $this->drupalLogin($this->createUser(['access protected menu example']));
- $this->drupalGet(Url::fromRoute('examples.menu_example.permissioned_controlled'));
- $assert->statusCodeEquals(200);
- $assert->pageTextContains('This menu entry will not show and the page will not be accessible');
-
- // We've already determined that the custom access route is reachable so now
- // we log out and make sure it tells us 403 because we're not authenticated.
- $this->drupalLogout();
- $this->drupalGet(Url::fromRoute('examples.menu_example.custom_access_page'));
- $assert->statusCodeEquals(403);
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/config/install/core.entity_form_display.node.basic_content_type.default.yml b/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/config/install/core.entity_form_display.node.basic_content_type.default.yml
deleted file mode 100644
index 8ccee39eb..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/config/install/core.entity_form_display.node.basic_content_type.default.yml
+++ /dev/null
@@ -1,65 +0,0 @@
-langcode: en
-status: true
-dependencies:
- config:
- - field.field.node.basic_content_type.body
- - node.type.basic_content_type
- module:
- - path
- - text
- enforced:
- module:
- - node_type_example
-id: node.basic_content_type.default
-targetEntityType: node
-bundle: basic_content_type
-mode: default
-content:
- title:
- type: string_textfield
- weight: 0
- settings:
- size: 60
- placeholder: ''
- third_party_settings: { }
- uid:
- type: entity_reference_autocomplete
- weight: 1
- settings:
- match_operator: CONTAINS
- match_limit: 10
- size: 60
- placeholder: ''
- third_party_settings: { }
- created:
- type: datetime_timestamp
- weight: 2
- settings: { }
- third_party_settings: { }
- promote:
- type: boolean_checkbox
- weight: 3
- settings:
- display_label: true
- third_party_settings: { }
- sticky:
- type: boolean_checkbox
- weight: 4
- settings:
- display_label: true
- third_party_settings: { }
- path:
- type: path
- weight: 5
- settings: { }
- third_party_settings: { }
- body:
- type: text_textarea_with_summary
- weight: 6
- settings:
- rows: 9
- summary_rows: 3
- placeholder: ''
- third_party_settings: { }
-hidden: { }
-third_party_settings: { }
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/config/install/core.entity_form_display.node.locked_content_type.default.yml b/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/config/install/core.entity_form_display.node.locked_content_type.default.yml
deleted file mode 100644
index 2f478a824..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/config/install/core.entity_form_display.node.locked_content_type.default.yml
+++ /dev/null
@@ -1,65 +0,0 @@
-langcode: en
-status: true
-dependencies:
- config:
- - field.field.node.locked_content_type.body
- - node.type.locked_content_type
- module:
- - path
- - text
- enforced:
- module:
- - node_type_example
-id: node.locked_content_type.default
-targetEntityType: node
-bundle: locked_content_type
-mode: default
-content:
- title:
- type: string_textfield
- weight: 0
- settings:
- size: 60
- placeholder: ''
- third_party_settings: { }
- uid:
- type: entity_reference_autocomplete
- weight: 1
- settings:
- match_operator: CONTAINS
- match_limit: 10
- size: 60
- placeholder: ''
- third_party_settings: { }
- created:
- type: datetime_timestamp
- weight: 2
- settings: { }
- third_party_settings: { }
- promote:
- type: boolean_checkbox
- weight: 3
- settings:
- display_label: true
- third_party_settings: { }
- sticky:
- type: boolean_checkbox
- weight: 4
- settings:
- display_label: true
- third_party_settings: { }
- path:
- type: path
- weight: 5
- settings: { }
- third_party_settings: { }
- body:
- type: text_textarea_with_summary
- weight: 6
- settings:
- rows: 9
- summary_rows: 3
- placeholder: ''
- third_party_settings: { }
-hidden: { }
-third_party_settings: { }
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/config/install/core.entity_view_display.node.basic_content_type.default.yml b/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/config/install/core.entity_view_display.node.basic_content_type.default.yml
deleted file mode 100644
index e5977fc90..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/config/install/core.entity_view_display.node.basic_content_type.default.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-langcode: en
-status: true
-dependencies:
- config:
- - field.field.node.basic_content_type.body
- - node.type.basic_content_type
- module:
- - text
- - user
- enforced:
- module:
- - node_type_example
-id: node.basic_content_type.default
-targetEntityType: node
-bundle: basic_content_type
-mode: default
-content:
- body:
- label: hidden
- type: text_default
- weight: 101
- settings: { }
- third_party_settings: { }
- links:
- weight: 100
-hidden: { }
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/config/install/core.entity_view_display.node.locked_content_type.default.yml b/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/config/install/core.entity_view_display.node.locked_content_type.default.yml
deleted file mode 100644
index b0e6b6a9a..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/config/install/core.entity_view_display.node.locked_content_type.default.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-langcode: en
-status: true
-dependencies:
- config:
- - field.field.node.locked_content_type.body
- - node.type.locked_content_type
- module:
- - text
- - user
- enforced:
- module:
- - node_type_example
-id: node.locked_content_type.default
-targetEntityType: node
-bundle: locked_content_type
-mode: default
-content:
- body:
- label: hidden
- type: text_default
- weight: 101
- settings: { }
- third_party_settings: { }
- links:
- weight: 100
-hidden: { }
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/config/install/field.field.node.basic_content_type.body.yml b/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/config/install/field.field.node.basic_content_type.body.yml
deleted file mode 100644
index d3d7f68b0..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/config/install/field.field.node.basic_content_type.body.yml
+++ /dev/null
@@ -1,25 +0,0 @@
-langcode: en
-status: true
-dependencies:
- config:
- - field.storage.node.body
- - node.type.basic_content_type
- module:
- - text
- enforced:
- module:
- - node_type_example
-id: node.basic_content_type.body
-field_name: body
-entity_type: node
-bundle: basic_content_type
-label: Body
-description: ''
-required: false
-translatable: true
-default_value: { }
-default_value_callback: ''
-settings:
- display_summary: true
-third_party_settings: { }
-field_type: text_with_summary
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/config/install/field.field.node.locked_content_type.body.yml b/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/config/install/field.field.node.locked_content_type.body.yml
deleted file mode 100644
index 4962e72b2..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/config/install/field.field.node.locked_content_type.body.yml
+++ /dev/null
@@ -1,25 +0,0 @@
-langcode: en
-status: true
-dependencies:
- config:
- - field.storage.node.body
- - node.type.locked_content_type
- module:
- - text
- enforced:
- module:
- - node_type_example
-id: node.locked_content_type.body
-field_name: body
-entity_type: node
-bundle: locked_content_type
-label: Body
-description: ''
-required: false
-translatable: true
-default_value: { }
-default_value_callback: ''
-settings:
- display_summary: true
-third_party_settings: { }
-field_type: text_with_summary
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/config/install/node.type.basic_content_type.yml b/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/config/install/node.type.basic_content_type.yml
deleted file mode 100644
index 8b8f33f6b..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/config/install/node.type.basic_content_type.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-langcode: en
-status: true
-dependencies:
- enforced:
- module:
- - node_type_example
-name: 'Example: Basic Content Type'
-type: basic_content_type
-description: 'This is a very basic content type.'
-help: ''
-new_revision: false
-preview_mode: 1
-display_submitted: true
-third_party_settings: { }
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/config/install/node.type.locked_content_type.yml b/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/config/install/node.type.locked_content_type.yml
deleted file mode 100644
index fb506be1f..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/config/install/node.type.locked_content_type.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-langcode: en
-status: true
-dependencies:
- enforced:
- module:
- - node_type_example
-name: 'Example: Locked Content Type'
-type: locked_content_type
-description: 'Demo of a locked content type. Locking must be done in code. You must uninstall this module before you can delete the content type.'
-help: ''
-new_revision: false
-preview_mode: 1
-display_submitted: true
-third_party_settings: { }
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/node_type_example.info.yml b/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/node_type_example.info.yml
deleted file mode 100644
index 08c031f18..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/node_type_example.info.yml
+++ /dev/null
@@ -1,15 +0,0 @@
-name: Node Type Example
-description: Demonstrates implementing a node content type in a module.
-package: Example modules
-type: module
-core_version_requirement: ^8.7.7 || ^9
-dependencies:
- - drupal:node
- - drupal:path
- - drupal:text
- - examples:examples
-
-# Information added by Drupal.org packaging script on 2021-10-07
-version: '3.0.3'
-project: 'examples'
-datestamp: 1633612832
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/node_type_example.install b/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/node_type_example.install
deleted file mode 100644
index c408989e4..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/node_type_example.install
+++ /dev/null
@@ -1,43 +0,0 @@
-get('node.type.locked');
- $locked['locked_content_type'] = 'locked_content_type';
- Drupal::state()->set('node.type.locked', $locked);
-}
-
-/**
- * Implements hook_uninstall().
- *
- * Our content types will live on in the Drupal installation, even after this
- * module is uninstalled. This is a good thing, since it allows the user to
- * make decisions about their fate. Therefore we should give the user the
- * option of deleting them.
- *
- * Since we told Drupal that our locked_content_type is locked, we now have
- * to tell it to unlock.
- *
- * @ingroup node_type_example
- */
-function node_type_example_uninstall() {
- // Allow locked_content_type to be deleted.
- $locked = Drupal::state()->get('node.type.locked');
- unset($locked['locked_content_type']);
- Drupal::state()->set('node.type.locked', $locked);
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/node_type_example.links.menu.yml b/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/node_type_example.links.menu.yml
deleted file mode 100644
index 476f03931..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/node_type_example.links.menu.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-node_type_example.description:
- title: Config Node Type Example
- route_name: config_node_type_example.description
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/node_type_example.module b/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/node_type_example.module
deleted file mode 100644
index 22c0ce626..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/node_type_example.module
+++ /dev/null
@@ -1,44 +0,0 @@
-Config Node Type Example is a basic example of defining a content type through configuration YAML files.
-
In this example we create two content types for Drupal 8, using only YAML files. Well, mostly only YAML files...
- One of our content types is locked, so the user can't delete it while the module is installed. For this we need
- a very tiny amount of support code.
The simplest way to author the per-type YAML files is to create the content types within Drupal and then take the
- YAML files from the configuration directory. Like this:
-
-
Install Drupal 8.
-
Create a new content type at {{ add_types }}. Let's call it 'Nifty Content Type'.
-
Export the configuration from admin/config/development/configuration. Specific steps depending
- on needs, and decisions made during Drupal 8 beta. You'll see a file called
- node.type.nifty_content_type.yml.
-
Copy or move that file to your module's config/install directory, along with associated field
- and form yml files.
-
Remove the uuid information from the configuration files.
-
-
You can see some of these YAML files in this module's config/install directory.
-
If you want to lock a content type created in this way, you'll have to implement hook_install() and
- hook_uninstall(). In hook_install(), you'll set the content type to be locked.
- In hook_uninstall() you'll set the content type to be unlocked.
-
Content types created in this way will remain available after the user has uninstalled the module.
- If you were to fail to set the content type as unlocked, the user would not be able to delete it.
-
-{% endtrans %}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/tests/src/Functional/NodeTypeExampleTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/tests/src/Functional/NodeTypeExampleTest.php
deleted file mode 100644
index d81b2d423..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/node_type_example/tests/src/Functional/NodeTypeExampleTest.php
+++ /dev/null
@@ -1,182 +0,0 @@
- link relationships to check for.
- * - The key is the path to the page where our link should appear.
- * - The value is the link that should appear on that page.
- */
- protected function providerMenuLinks() {
- return [
- '' => '/examples/node-type-example',
- ];
- }
-
- /**
- * Verify and validate that default menu links were loaded for this module.
- */
- public function testNodeTypeExample() {
- $assert = $this->assertSession();
- // Test that our page loads.
- $this->drupalGet('/examples/node-type-example');
- $assert->statusCodeEquals(200);
-
- // Test that our menu links were created.
- $links = $this->providerMenuLinks();
- foreach ($links as $page => $path) {
- $this->drupalGet($page);
- $assert->linkByHrefExists($path);
- }
- }
-
- /**
- * Test our new content types.
- *
- * Tests for the following:
- *
- * - That our content types appear in the user interface.
- * - That our unlocked content type is unlocked.
- * - That our locked content type is locked.
- * - That we can create content using the user interface.
- * - That our created content does appear in the database.
- */
- public function testNodeTypes() {
- $assert = $this->assertSession();
-
- // Log in an admin user.
- $admin_user = $this->drupalCreateUser(['administer content types']);
- $this->drupalLogin($admin_user);
-
- // Get a list of content types.
- $this->drupalGet('/admin/structure/types');
- // Verify that these content types show up in the user interface.
- $assert->pageTextContains('Example: Basic Content Type', 'Basic content type found.');
- $assert->pageTextContains('Example: Locked Content Type', 'Locked content type found.');
-
- // Check for the locked status of our content types.
- // $nodeType will be of type Drupal\node\NodeTypeInterface.
- $node_type = NodeType::load('basic_content_type');
- $this->assertInstanceOf(NodeTypeInterface::class, $node_type, 'basic_content_type exists.');
- if ($node_type) {
- $this->assertFalse($node_type->isLocked(), 'basic_content_type is not locked.');
- }
- $node_type = NodeType::load('locked_content_type');
- $this->assertInstanceOf(NodeTypeInterface::class, $node_type, 'locked_content_type exists.');
- if ($node_type) {
- $this->assertEquals('locked_content_type', $node_type->isLocked());
- }
-
- // Log in a content creator.
- $creator_user = $this->drupalCreateUser(['create basic_content_type content']);
- $this->drupalLogin($creator_user);
-
- // Create a node.
- $edit = [];
- $edit['title[0][value]'] = $this->randomMachineName(8);
- $edit['body[0][value]'] = $this->randomMachineName(16);
- $this->drupalPostForm('/node/add/basic_content_type', $edit, 'Save');
-
- // Check that the Basic page has been created.
- $assert->pageTextContains((string) new FormattableMarkup('@post @title has been created.', [
- '@post' => 'Example: Basic Content Type',
- '@title' => $edit['title[0][value]'],
- ]));
-
- // Check that the node exists in the database.
- $node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
- $this->assertInstanceOf(NodeInterface::class, $node, 'Node found in database.');
- }
-
- /**
- * Test that all fields are displayed when content is created.
- */
- public function testNodeCreation() {
- // Login content creator.
- $this->drupalLogin(
- $this->drupalCreateUser([
- 'create basic_content_type content',
- 'create locked_content_type content',
- ])
- );
-
- // Create random strings to insert data into fields.
- $title = 'Test title.';
- $body = 'Test body.';
- $edit = [];
- $edit['title[0][value]'] = $title;
- $edit['body[0][value]'] = $body;
-
- // Create a basic_content_type content.
- $this->drupalPostForm('/node/add/basic_content_type', $edit, 'Save');
- // Verify all fields and data of created content is shown.
- $this->assertText($title);
- $this->assertText($body);
-
- // Create a locked_content_type content.
- $this->drupalPostForm('/node/add/locked_content_type', $edit, 'Save');
- // Verify all fields and data of created content is shown.
- $this->assertText($title);
- $this->assertText($body);
- }
-
- /**
- * Verify that user can uninstall and then reinstall node_type_example.
- */
- public function testUninstallReinstall() {
- $session = $this->assertSession();
-
- // Uninstalling module.
- $module_installer = $this->container->get('module_installer');
- $module_installer->uninstall(['node_type_example']);
- $this->drupalGet('examples/node-type-example');
- $session->statusCodeEquals(404);
-
- // Re-installing module.
- $module_installer->install(['node_type_example']);
- $this->drupalGet('examples/node-type-example');
- $session->statusCodeEquals(200);
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/page_example/page_example.info.yml b/frontend/drupal9/web/modules/contrib/examples/modules/page_example/page_example.info.yml
deleted file mode 100644
index 7c1c9ab83..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/page_example/page_example.info.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-name: Page Example
-type: module
-description: 'Demonstrates how to display a page at a given URL.'
-package: Example modules
-core_version_requirement: ^8.7.7 || ^9
-dependencies:
- - drupal:node
- - examples:examples
-
-# Information added by Drupal.org packaging script on 2021-10-07
-version: '3.0.3'
-project: 'examples'
-datestamp: 1633612832
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/page_example/page_example.links.menu.yml b/frontend/drupal9/web/modules/contrib/examples/modules/page_example/page_example.links.menu.yml
deleted file mode 100644
index 753a34a0a..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/page_example/page_example.links.menu.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-page_example.description:
- title: Page Example
- route_name: page_example.description
- expanded: TRUE
-
-page_example.simple:
- title: Simple - no arguments
- route_name: page_example.simple
- parent: page_example.description
-
-# We can't define a menu link for the page_example_arguments route, because it
-# requires path arguments.
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/page_example/page_example.module b/frontend/drupal9/web/modules/contrib/examples/modules/page_example/page_example.module
deleted file mode 100644
index 58680c949..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/page_example/page_example.module
+++ /dev/null
@@ -1,60 +0,0 @@
- '
' . $this->t('Simple page: The quick brown fox jumps over the lazy dog.') . '
',
- ];
- }
-
- /**
- * A more complex _controller callback that takes arguments.
- *
- * This callback is mapped to the path
- * 'examples/page-example/arguments/{first}/{second}'.
- *
- * The arguments in brackets are passed to this callback from the page URL.
- * The placeholder names "first" and "second" can have any value but should
- * match the callback method variable names; i.e. $first and $second.
- *
- * This function also demonstrates a more complex render array in the returned
- * values. Instead of rendering the HTML with theme('item_list'), content is
- * left un-rendered, and the theme function name is set using #theme. This
- * content will now be rendered as late as possible, giving more parts of the
- * system a chance to change it if necessary.
- *
- * Consult @link http://drupal.org/node/930760 Render Arrays documentation
- * @endlink for details.
- *
- * @param string $first
- * A string to use, should be a number.
- * @param string $second
- * Another string to use, should be a number.
- *
- * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
- * If the parameters are invalid.
- */
- public function arguments($first, $second) {
- // Make sure you don't trust the URL to be safe! Always check for exploits.
- if (!is_numeric($first) || !is_numeric($second)) {
- // We will just show a standard "access denied" page in this case.
- throw new AccessDeniedHttpException();
- }
-
- $list[] = $this->t("First number was @number.", ['@number' => $first]);
- $list[] = $this->t("Second number was @number.", ['@number' => $second]);
- $list[] = $this->t('The total was @number.', ['@number' => $first + $second]);
-
- $render_array['page_example_arguments'] = [
- // The theme function to apply to the #items.
- '#theme' => 'item_list',
- // The list itself.
- '#items' => $list,
- '#title' => $this->t('Argument Information'),
- ];
- return $render_array;
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/page_example/templates/description.html.twig b/frontend/drupal9/web/modules/contrib/examples/modules/page_example/templates/description.html.twig
deleted file mode 100644
index 2f0b91052..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/page_example/templates/description.html.twig
+++ /dev/null
@@ -1,15 +0,0 @@
-{#
-/**
- * @file
- * Contains the text of the page_example explanation page
- */
-#}
-
-{% set page_example_simple = path('page_example.simple') %}
-{% set page_example_arguments = path('page_example.arguments', {'first': 23, 'second': 56}) %}
-
-{% trans %}
-
The Page example module provides two pages, "simple" and "arguments".
-
The simple page just returns a renderable array for display.
-
The arguments page takes two arguments and displays them, as in {{ page_example_arguments }}
-{% endtrans %}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/page_example/tests/src/Functional/PageExampleTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/page_example/tests/src/Functional/PageExampleTest.php
deleted file mode 100644
index de60349a0..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/page_example/tests/src/Functional/PageExampleTest.php
+++ /dev/null
@@ -1,182 +0,0 @@
-drupalGet($url);
- $this->assertSession()->statusCodeEquals(403);
- }
-
- /**
- * Data provider for testing menu links.
- *
- * @return array
- *
- * Array of page -> link relationships to check for, with the permissions
- * required to access them:
- * - Permission machine name. Empty string means no login.
- * - Array of link information:
- * - Key is path to the page where the link should appear.
- * - Value is the link that should appear on the page.
- */
- public function providerMenuLinks() {
- return [
- [
- '',
- ['' => '/examples/page-example'],
- ],
- [
- 'access simple page',
- ['/examples/page-example' => '/examples/page-example/simple'],
- ],
- ];
- }
-
- /**
- * Verify and validate that default menu links were loaded for this module.
- *
- * @dataProvider providerMenuLinks
- */
- public function testPageExampleLinks($permission, $links) {
- if ($permission) {
- $user = $this->drupalCreateUser([$permission]);
- $this->drupalLogin($user);
- }
- foreach ($links as $page => $path) {
- $this->drupalGet($page);
- $this->assertSession()->linkByHrefExists($path);
- }
- if ($permission) {
- $this->drupalLogout();
- }
- }
-
- /**
- * Main test.
- *
- * Login user, create an example node, and test page functionality through
- * the admin and user interfaces.
- */
- public function testPageExample() {
- $assert_session = $this->assertSession();
- // Verify that anonymous user can't access the pages created by
- // page_example module.
- $this->pageExampleVerifyNoAccess('examples/page-example/simple');
- $this->pageExampleVerifyNoAccess('examples/page-example/arguments/1/2');
-
- // Create a regular user and login.
- $this->webUser = $this->drupalCreateUser();
- $this->drupalLogin($this->webUser);
-
- // Verify that regular user can't access the pages created by
- // page_example module.
- $this->pageExampleVerifyNoAccess('examples/page-example/simple');
- $this->pageExampleVerifyNoAccess('examples/page-example/arguments/1/2');
-
- // Create a user with permissions to access 'simple' page and login.
- $this->webUser = $this->drupalCreateUser(['access simple page']);
- $this->drupalLogin($this->webUser);
-
- // Verify that user can access simple content.
- $this->drupalGet('/examples/page-example/simple');
- $assert_session->statusCodeEquals(200);
- $assert_session->pageTextContains('The quick brown fox jumps over the lazy dog.');
-
- // Check if user can't access arguments page.
- $this->pageExampleVerifyNoAccess('examples/page-example/arguments/1/2');
-
- // Create a user with permissions to access 'simple' page and login.
- $this->webUser = $this->drupalCreateUser(['access arguments page']);
- $this->drupalLogin($this->webUser);
-
- // Verify that user can access arguments content.
- $first = self::randomNumber(3);
- $second = self::randomNumber(3);
- $this->drupalGet('/examples/page-example/arguments/' . $first . '/' . $second);
- $assert_session->statusCodeEquals(200);
- // Verify argument usage.
- $assert_session->pageTextContains((string) new FormattableMarkup('First number was @number.', ['@number' => $first]));
- $assert_session->pageTextContains((string) new FormattableMarkup('Second number was @number.', ['@number' => $second]));
- $assert_session->pageTextContains((string) new FormattableMarkup('The total was @number.', ['@number' => $first + $second]));
-
- // Verify incomplete argument call to arguments content.
- $this->drupalGet('/examples/page-example/arguments/' . $first . '/');
- $assert_session->statusCodeEquals(404);
-
- // Verify 403 for invalid second argument.
- $this->drupalGet('/examples/page-example/arguments/' . $first . '/non-numeric-argument');
- $assert_session->statusCodeEquals(403);
-
- // Verify 403 for invalid first argument.
- $this->drupalGet('/examples/page-example/arguments/non-numeric-argument/' . $second);
- $assert_session->statusCodeEquals(403);
-
- // Check if user can't access simple page.
- $this->pageExampleVerifyNoAccess('examples/page-example/simple');
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/pager_example/pager_example.info.yml b/frontend/drupal9/web/modules/contrib/examples/modules/pager_example/pager_example.info.yml
deleted file mode 100644
index e2d234d4c..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/pager_example/pager_example.info.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-name: Pager Example
-type: module
-description: Demonstrates how to use table and render page elements to create paginated tables.
-package: Example modules
-core_version_requirement: ^8.7.7 || ^9
-dependencies:
- - drupal:node
- - examples:examples
-
-# Information added by Drupal.org packaging script on 2021-10-07
-version: '3.0.3'
-project: 'examples'
-datestamp: 1633612832
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/pager_example/pager_example.links.menu.yml b/frontend/drupal9/web/modules/contrib/examples/modules/pager_example/pager_example.links.menu.yml
deleted file mode 100644
index c34a73d32..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/pager_example/pager_example.links.menu.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-pager_example.page:
- title: Pager Example
- route_name: pager_example.page
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/pager_example/pager_example.module b/frontend/drupal9/web/modules/contrib/examples/modules/pager_example/pager_example.module
deleted file mode 100644
index f9591fbf8..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/pager_example/pager_example.module
+++ /dev/null
@@ -1,33 +0,0 @@
- [
- 'template' => 'description',
- 'variables' => [],
- ],
- ];
-}
-
-/**
- * @} End of "defgroup pager_example".
- */
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/pager_example/pager_example.routing.yml b/frontend/drupal9/web/modules/contrib/examples/modules/pager_example/pager_example.routing.yml
deleted file mode 100644
index 27eae63fb..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/pager_example/pager_example.routing.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-pager_example.page:
- path: '/examples/pager-example'
- defaults:
- _title: 'Pager Example'
- _controller: '\Drupal\pager_example\Controller\PagerExamplePage::getContent'
- requirements:
- _permission: 'access content'
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/pager_example/src/Controller/PagerExamplePage.php b/frontend/drupal9/web/modules/contrib/examples/modules/pager_example/src/Controller/PagerExamplePage.php
deleted file mode 100644
index 78056049a..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/pager_example/src/Controller/PagerExamplePage.php
+++ /dev/null
@@ -1,138 +0,0 @@
-nodeStorage = $node_storage;
- $this->currentUser = $current_user;
- }
-
- /**
- * {@inheritdoc}
- */
- public static function create(ContainerInterface $container) {
- $controller = new static(
- $container->get('entity_type.manager')->getStorage('node'),
- $container->get('current_user')
- );
- $controller->setStringTranslation($container->get('string_translation'));
- return $controller;
- }
-
- /**
- * Content callback for the pager_example.page route.
- */
- public function getContent() {
- // First we'll tell the user what's going on. This content can be found
- // in the twig template file: templates/description.html.twig. It will be
- // inserted by the theming function pager_example_description().
- $build = [
- 'description' => [
- '#theme' => 'pager_example_description',
- '#description' => $this->t('description'),
- '#attributes' => [],
- ],
- ];
-
- // Ensure that this page's cache is invalidated when nodes have been
- // published, unpublished, added or deleted; and when user permissions
- // change.
- $build['#cache']['tags'][] = 'node_list';
- $build['#cache']['contexts'][] = 'user.permissions';
-
- // Now we want to get our tabular data. We select nodes from node storage
- // limited by 2 per page and sort by nid DESC because we want to show newest
- // node first. Additionally, we check that the user has permission to
- // view the node.
- $query = $this->nodeStorage->getQuery()
- ->sort('nid', 'DESC')
- ->addTag('node_access')
- ->pager(2);
-
- // The node_access tag does not trigger a check on whether a user has the
- // ability to view unpublished content. The 'bypass node access' permission
- // is really more than we need. But, there is no separate permission for
- // viewing unpublished content. There is a permission to 'view own
- // unpublished content', but we don't have a good way of using that in this
- // query. So, unfortunately this query will incorrectly eliminate even those
- // unpublished nodes that the user may, in fact, be allowed to view.
- if (!$this->currentUser->hasPermission('bypass node access')) {
- $query->condition('status', 1);
- }
- $entity_ids = $query->execute();
-
- $nodes = $this->nodeStorage->loadMultiple($entity_ids);
-
- // We are going to output the results in a table so we set up the rows.
- $rows = [];
- foreach ($nodes as $node) {
- // There are certain things (besides unpublished nodes) that the
- // node_access tag won't prevent from being seen. The only way to get at
- // those is by explicitly checking for (view) access on a node-by-node
- // basis. In order to prevent the pager from looking strange, we will
- // "mask" these nodes that should not be accessible. If we don't do this
- // masking, it's possible that we'd have lots of pages that don't show any
- // content.
- $rows[] = [
- 'nid' => $node->access('view') ? $node->id() : $this->t('XXXXXX'),
- 'title' => $node->access('view') ? $node->getTitle() : $this->t('Redacted'),
- ];
- }
-
- // Build a render array which will be themed as a table with a pager.
- $build['pager_example'] = [
- '#type' => 'table',
- '#header' => [$this->t('NID'), $this->t('Title')],
- '#rows' => $rows,
- '#empty' => $this->t('There are no nodes to display. Please create a node.', [
- ':url' => Url::fromRoute('node.add', ['node_type' => 'page'])->toString(),
- ]),
- ];
- // Add our pager element so the user can choose which pagination to see.
- // This will add a '?page=1' fragment to the links to subsequent pages.
- $build['pager'] = [
- '#type' => 'pager',
- '#weight' => 10,
- ];
-
- return $build;
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/pager_example/templates/description.html.twig b/frontend/drupal9/web/modules/contrib/examples/modules/pager_example/templates/description.html.twig
deleted file mode 100644
index 0d3acbefa..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/pager_example/templates/description.html.twig
+++ /dev/null
@@ -1,21 +0,0 @@
-{#
-/**
- * @file
- * Contains the text of the pager_example explanation page
- */
-#}
-
-
-{% trans %}
-
The Pager Example shows you how to create a paginated table. It uses
- an Entity Query to retrieve nodes and the query checks that
- the user has access to the nodes. You may test the access checking
- feature by unpublishing some of your nodes and then viewing the
- example as a user that is not allowed to see unpublished content.
-
In order to see this in action, make sure there are some nodes present in
- your site. You can use the
- devel module to add
- some if needed, or just create them.
-
The table on this page will show you two nodes per page.
-{% endtrans %}
-
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/pager_example/tests/src/Functional/PagerExampleTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/pager_example/tests/src/Functional/PagerExampleTest.php
deleted file mode 100644
index 7c059d67a..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/pager_example/tests/src/Functional/PagerExampleTest.php
+++ /dev/null
@@ -1,73 +0,0 @@
-drupalCreateUser();
- $this->drupalLogin($normalUser);
- }
-
- /**
- * Confirms nodes paging works correctly on page "pager_example".
- */
- public function testPagerExamplePage() {
- $assert = $this->assertSession();
-
- $nodes = [];
- $nodes[] = $this->drupalCreateNode();
-
- $this->drupalGet('examples/pager-example');
- $assert->linkNotExists('Next');
- $assert->linkNotExists('Previous');
-
- // Create 5 new nodes.
- for ($i = 1; $i <= 5; $i++) {
- $nodes[] = $this->drupalCreateNode([
- 'title' => "Node number $i",
- ]);
- }
-
- // The pager pages are cached, so flush to see the 5 more nodes.
- drupal_flush_all_caches();
-
- // Check 'Next' link on first page.
- $this->drupalGet('examples/pager-example');
- $assert->statusCodeEquals(200);
- $assert->linkByHrefExists('?page=1');
- $assert->pageTextContains($nodes[5]->getTitle());
-
- // Check the last page.
- $this->drupalGet('examples/pager-example', ['query' => ['page' => 2]]);
- $assert->statusCodeEquals(200);
- $assert->linkNotExists('Next');
- $assert->linkByHrefExists('?page=1');
- $assert->pageTextContains($nodes[1]->getTitle());
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/phpunit_example/phpunit_example.info.yml b/frontend/drupal9/web/modules/contrib/examples/modules/phpunit_example/phpunit_example.info.yml
deleted file mode 100644
index 0f7da8ebf..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/phpunit_example/phpunit_example.info.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-name: PHPUnit Example
-type: module
-description: Demontrates how to use PHPUnit-based tests.
-package: Example modules
-core_version_requirement: ^8.7.7 || ^9
-dependencies:
- - drupal:node
- - examples:examples
-
-# Information added by Drupal.org packaging script on 2021-10-07
-version: '3.0.3'
-project: 'examples'
-datestamp: 1633612832
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/phpunit_example/phpunit_example.links.menu.yml b/frontend/drupal9/web/modules/contrib/examples/modules/phpunit_example/phpunit_example.links.menu.yml
deleted file mode 100644
index ce6805a91..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/phpunit_example/phpunit_example.links.menu.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-phpunit_example.description:
- title: PHPUnit Example
- route_name: phpunit_example.description
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/phpunit_example/phpunit_example.module b/frontend/drupal9/web/modules/contrib/examples/modules/phpunit_example/phpunit_example.module
deleted file mode 100644
index b02383de5..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/phpunit_example/phpunit_example.module
+++ /dev/null
@@ -1,17 +0,0 @@
-items[$item->getDisplayName()] = $item;
- }
-
- /**
- * A count of how many items exist.
- *
- * @return int
- * The number of items that exist.
- */
- public function countDisplayableItems() {
- return count($this->items);
- }
-
- /**
- * All displayable items.
- *
- * @return array
- * The displayable items.
- */
- public function displayableItems() {
- return $this->items;
- }
-
- /**
- * Find an item by its name.
- *
- * @param string $name
- * The name to find.
- *
- * @return DisplayInfoInterface|null
- * The found item, or NULL if none is found.
- */
- public function item($name) {
- if (isset($this->items[$name])) {
- return $this->items[$name];
- }
- return NULL;
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/phpunit_example/src/ProtectedPrivates.php b/frontend/drupal9/web/modules/contrib/examples/modules/phpunit_example/src/ProtectedPrivates.php
deleted file mode 100644
index 24278ba26..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/phpunit_example/src/ProtectedPrivates.php
+++ /dev/null
@@ -1,59 +0,0 @@
-add($a, $b);
- }
-
- // phpcs:disable
- /**
- * A simple addition method with validity checking.
- *
- * @param int|float $a
- * A number to add.
- * @param int|float $b
- * Another number to add.
- *
- * @return int|float
- * The sum of $a and $b.
- *
- * @throws \InvalidArgumentException
- * If either $a or $b is non-numeric, we can't add, so we throw.
- */
- private function privateAdd($a, $b) {
- $adder = new AddClass();
- return $adder->add($a, $b);
- }
- // phpcs:enable
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/phpunit_example/templates/description.html.twig b/frontend/drupal9/web/modules/contrib/examples/modules/phpunit_example/templates/description.html.twig
deleted file mode 100644
index 249068771..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/phpunit_example/templates/description.html.twig
+++ /dev/null
@@ -1,55 +0,0 @@
-{#
-
-Description text for the PHPUnit Example.
-
-#}
-
-{% trans %}
-
PHPUnit for Drupal: A very basic how-to.
-
-
How to use this example module
-
You really should be reading the various docblocks in the test files.
-
-
How To:
-
-
PHPUnit tests belong in their own directory, so they won't be loaded
- by the autoloader during normal bootstrap. This means you should have a
- /tests/src directory in the root of your module directory.
-
-
-
Your tests should be in the Drupal\Tests\[your_module]\Unit
- namespace. Under Drupal's PSR-4 system, this means your PHPUnit-based
- tests should go in a [your_module]/tests/src/Unit
- directory.
-
-
Your test case should subclass Drupal\Tests\UnitTestCase.
-
-
-
-
You can run PHPUnit-based tests from within Drupal 8 by enabling the
- Testing module and then selecting the PHPUnit group from the testing page.
- As of this writing, this method doesn't provide any useful output.
-
-
-
-
-
Standard PHPUnit Practices
-
You can (and really, should) run PHPUnit from the command line.
-
On unix-based systems this means you need to cd core and then
-
./vendor/bin/phpunit
-
-
On Windows-based systems, assuming you have php in your path,
-
Also, you should mark your tests as belonging to a group, so they can be run
- independently. You do this by annotating your test classes with
- @group group_name. You should have a @group for
- your module name, and you should also have a @group for
- integrations, such as views.
-
-
So, for instance, to run all of the PHPUnit example tests, you would type
-
./vendor/bin/phpunit --group phpunit_example
-
-
As you can see, including a @group annotation is a good idea.
-
-{% endtrans %}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/phpunit_example/tests/src/Functional/PHPUnitExampleMenuTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/phpunit_example/tests/src/Functional/PHPUnitExampleMenuTest.php
deleted file mode 100644
index ab8f9c135..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/phpunit_example/tests/src/Functional/PHPUnitExampleMenuTest.php
+++ /dev/null
@@ -1,64 +0,0 @@
-drupalLogin($this->createUser(['access content']));
- $assert = $this->assertSession();
- $links = [
- '' => Url::fromRoute('phpunit_example.description'),
- ];
- // Go to the page and see if the link appears on it.
- foreach ($links as $page => $path) {
- $this->drupalGet($page);
- $assert->linkByHrefExists($path->getInternalPath());
- }
- // Visit all the links and make sure they return 200.
- foreach ($links as $path) {
- $this->drupalGet($path);
- $assert->statusCodeEquals(200);
- }
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/phpunit_example/tests/src/Unit/AddClassTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/phpunit_example/tests/src/Unit/AddClassTest.php
deleted file mode 100644
index aad3b19a7..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/phpunit_example/tests/src/Unit/AddClassTest.php
+++ /dev/null
@@ -1,179 +0,0 @@
-assertEquals($sut->add(2, 3), 5);
- }
-
- /**
- * Test AddClass::add() with a data provider method.
- *
- * This method is very similar to testAdd(), but uses a data provider method
- * to test with a wider range of data.
- *
- * You can tell PHPUnit which method is the data provider using the
- * '@dataProvider' annotation.
- *
- * The data provider method just returns a big array of arrays of arguments.
- * That is, for each time you want this test method run, the data provider
- * should create an array of arguments for this method. In this case, it's
- * $expected, $a, and $b. So one set of arguments would look a bit like this
- * pseudocode:
- *
- * @code
- * array( valueForExpected, valueForA, valueForB )
- * @endcode
- *
- * It would then wrap this up in a higher-level array, so that PHPUnit can
- * loop through them, like this pseudocode:
- *
- * @code
- * return array( array(first, set), array (next, set) );
- * @endcode
- *
- * This test has a better methodology than testAdd(), because it can easily
- * be adapted by other developers, and because it tries more than one data
- * set. This test is much better than testAdd(), although it still only
- * tests 'good' data. When combined with testAddWithBadDataProvider(),
- * we get a better picture of the behavior of the method under test.
- *
- * @dataProvider addDataProvider
- *
- * @see self::addDataProvider()
- */
- public function testAddWithDataProvider($expected, $a, $b) {
- $sut = new AddClass();
- $this->assertEquals($expected, $sut->add($a, $b));
- }
-
- /**
- * Test AddClass::add() with data that should throw an exception.
- *
- * This method is similar to testAddWithDataProvider(), but the data
- * provider gives us data that should throw an exception.
- *
- * This test uses the setExpectedException() method to tell PHPUnit that
- * a thrown exception should pass the test. You specify a
- * fully-qualified exception class name. If you specify \Exception, PHPUnit
- * will pass any exception, whereas a more specific subclass of \Exception
- * will require that exception type to be thrown.
- *
- * Alternately, you can use try and catch blocks with assertions in order
- * to test exceptions. We won't demonstrate that here; it's a much better
- * idea to test your exceptions with setExpectedException().
- *
- * @dataProvider addBadDataProvider
- *
- * @see self::addBadDataProvider()
- */
- public function testAddWithBadDataProvider($a, $b) {
- $sut = new AddClass();
- $this->expectException(\InvalidArgumentException::class);
- $sut->add($a, $b);
- }
-
- /**
- * Data provider for testAddWithDataProvider().
- *
- * Data provider methods take no arguments and return an array of data
- * to use for tests. Each element of the array is another array, which
- * corresponds to the arguments in the test method's signature.
- *
- * Note also that PHPUnit tries to run tests using methods that begin
- * with 'test'. This means that data provider method names should not
- * begin with 'test'. Also, by convention, they should end with
- * 'DataProvider'.
- *
- * @return array
- * Nested arrays of values to check:
- * - $a
- * - $b
- * - $expected
- *
- * @see self::testAddWithDataProvider()
- */
- public function addDataProvider() {
- return [
- [5, 2, 3],
- [50, 20, 30],
- ];
- }
-
- /**
- * Data provider for testAddWithBadDataProvider().
- *
- * Since AddClass::add() can throw exceptions, it's time
- * to give it some data that will cause these exceptions.
- *
- * add() should throw exceptions if either of it's arguments are
- * not numeric, and we will generate some test data to prove that
- * this is what it actually does.
- *
- * @see self::testAddWithBadDataProvider()
- */
- public function addBadDataProvider() {
- $bad_data = [];
- // Set up an array with data that should cause add()
- // to throw an exception.
- $bad_data_types = ['string', FALSE, ['foo'], new \stdClass()];
- // Create some data where both $a and $b are bad types.
- foreach ($bad_data_types as $bad_datum_a) {
- foreach ($bad_data_types as $bad_datum_b) {
- $bad_data[] = [$bad_datum_a, $bad_datum_b];
- }
- }
- // Create some data where $a is good and $b is bad.
- foreach ($bad_data_types as $bad_datum_b) {
- $bad_data[] = [1, $bad_datum_b];
- }
- // Create some data where $b is good and $a is bad.
- foreach ($bad_data_types as $bad_datum_a) {
- $bad_data[] = [$bad_datum_a, 1];
- }
- return $bad_data;
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/phpunit_example/tests/src/Unit/DisplayManagerTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/phpunit_example/tests/src/Unit/DisplayManagerTest.php
deleted file mode 100644
index a879ab503..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/phpunit_example/tests/src/Unit/DisplayManagerTest.php
+++ /dev/null
@@ -1,58 +0,0 @@
-getMockBuilder(DisplayInfoInterface::class)
- ->getMockForAbstractClass();
- // Here we're illustrating that the mock object belongs to
- // our interface.
- $this->assertTrue($mock instanceof DisplayInfoInterface);
- // 'Program' our mock object to return a value for getDisplayName().
- // expects($this->any()) tells the mock to return this value any time
- // the method is called.
- $mock->expects($this->any())
- ->method('getDisplayName')
- ->will($this->returnValue('the display name'));
-
- // Create a DisplayManager, the class we're actually testing here.
- $dm = new DisplayManager();
- // Give it the mocked info object.
- $dm->addDisplayableItem($mock);
- // Assert that our DisplayManager has exactly one display object (our mock).
- $this->assertEquals(1, $dm->countDisplayableItems());
- // Assert that the DisplayManager can find our mocked info object.
- $this->assertSame($mock, $dm->item('the display name'));
- // Assert that the DisplayManager can't find an info object
- // that it shouldn't have.
- $this->assertNull($dm->item('nonexistant'));
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/phpunit_example/tests/src/Unit/ProtectedPrivatesTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/phpunit_example/tests/src/Unit/ProtectedPrivatesTest.php
deleted file mode 100644
index 7632c2843..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/phpunit_example/tests/src/Unit/ProtectedPrivatesTest.php
+++ /dev/null
@@ -1,147 +0,0 @@
-getMethod($method_name);
- $method->setAccessible(TRUE);
- return $method;
- }
-
- /**
- * Good data provider.
- */
- public function addDataProvider() {
- return [
- [5, 2, 3],
- ];
- }
-
- /**
- * Test ProtectedPrivate::privateAdd().
- *
- * We want to test a private method on a class. This is problematic
- * because, by design, we don't have access to this method. However,
- * we do have a tool available to help us out with this problem:
- * We can override the accessibility of a method using reflection.
- *
- * @dataProvider addDataProvider
- */
- public function testPrivateAdd($expected, $a, $b) {
- // Get a reflected, accessible version of the privateAdd() method.
- $private_method = $this->getAccessibleMethod(
- 'Drupal\phpunit_example\ProtectedPrivates',
- 'privateAdd'
- );
- // Create a new ProtectedPrivates object.
- $pp = new ProtectedPrivates();
- // Use the reflection to invoke on the object.
- $sum = $private_method->invokeArgs($pp, [$a, $b]);
- // Make an assertion.
- $this->assertEquals($expected, $sum);
- }
-
- /**
- * Bad data provider.
- */
- public function addBadDataProvider() {
- return [
- ['string', []],
- ];
- }
-
- /**
- * Test ProtectedPrivate::privateAdd() with bad data.
- *
- * This is essentially the same test as testPrivateAdd(), but using
- * non-numeric data. This lets us test the exception-throwing ability
- * of this private method.
- *
- * @dataProvider addBadDataProvider
- */
- public function testPrivateAddBadData($a, $b) {
- // Get a reflected, accessible version of the privateAdd() method.
- $private_method = $this->getAccessibleMethod(
- 'Drupal\phpunit_example\ProtectedPrivates',
- 'privateAdd');
- // Create a new ProtectedPrivates object.
- $pp = new ProtectedPrivates();
- // Use the reflection to invoke on the object.
- // This should throw an exception.
- $this->expectException(\InvalidArgumentException::class);
- $private_method->invokeArgs($pp, [$a, $b]);
- }
-
- /**
- * Test ProtectedPrivates::protectedAdd() using a stub class.
- *
- * We could use the same reflection technique to test protected
- * methods, just like we did with private ones.
- *
- * But sometimes it might make more sense to use a stub class
- * which will have access to the protected method. That's what
- * we'll demonstrate here.
- *
- * @dataProvider addDataProvider
- */
- public function testProtectedAdd($expected, $a, $b) {
- $stub = new ProtectedPrivatesSubclass();
- $this->assertEquals($expected, $stub->subclassProtectedAdd($a, $b));
- }
-
- /**
- * Test ProtectedPrivates::protectedAdd() with bad data using a stub class.
- *
- * This test is similar to testProtectedAdd(), but expects an exception.
- *
- * @dataProvider addBadDataProvider
- */
- public function testProtectedAddBadData($a, $b) {
- $stub = new ProtectedPrivatesSubclass();
- $this->expectException(\InvalidArgumentException::class);
- $stub->subclassProtectedAdd($a, $b);
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/phpunit_example/tests/src/Unit/Subclasses/ProtectedPrivatesSubclass.php b/frontend/drupal9/web/modules/contrib/examples/modules/phpunit_example/tests/src/Unit/Subclasses/ProtectedPrivatesSubclass.php
deleted file mode 100644
index a4b5bcb7e..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/phpunit_example/tests/src/Unit/Subclasses/ProtectedPrivatesSubclass.php
+++ /dev/null
@@ -1,30 +0,0 @@
-protectedAdd($a, $b);
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/plugin_type_example.api.php b/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/plugin_type_example.api.php
deleted file mode 100644
index 676d0bedb..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/plugin_type_example.api.php
+++ /dev/null
@@ -1,24 +0,0 @@
- $plugin_definition) {
- $sandwich_plugin_info[$plugin_id]['foobar'] = t('We have altered this in the alter hook');
- }
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/plugin_type_example.info.yml b/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/plugin_type_example.info.yml
deleted file mode 100644
index 5c5dc4986..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/plugin_type_example.info.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-name: Plugin Type Example
-type: module
-description: Provides an example of defining a plugin type.
-package: Example modules
-core_version_requirement: ^8.7.7 || ^9
-dependencies:
- - drupal:node
- - examples:examples
-
-# Information added by Drupal.org packaging script on 2021-10-07
-version: '3.0.3'
-project: 'examples'
-datestamp: 1633612832
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/plugin_type_example.links.menu.yml b/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/plugin_type_example.links.menu.yml
deleted file mode 100644
index c607e3627..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/plugin_type_example.links.menu.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-plugin_type_example.description:
- title: Plugin Type Example
- route_name: plugin_type_example.description
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/plugin_type_example.module b/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/plugin_type_example.module
deleted file mode 100644
index ae14ec0a2..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/plugin_type_example.module
+++ /dev/null
@@ -1,71 +0,0 @@
- $plugin_definition) {
- // Always uppercase the word rocket in sandwich descriptions.
- $sandwich_plugin_info[$plugin_id]['description'] = str_replace(t('rocket'), t('ROCKET'), $sandwich_plugin_info[$plugin_id]['description']);
- }
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/plugin_type_example.routing.yml b/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/plugin_type_example.routing.yml
deleted file mode 100644
index 35d6acfde..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/plugin_type_example.routing.yml
+++ /dev/null
@@ -1,8 +0,0 @@
-# This defines our example page's path to the routing system.
-plugin_type_example.description:
- path: '/examples/plugin-type-example'
- defaults:
- _controller: '\Drupal\plugin_type_example\Controller\PluginTypeExampleController::description'
- _title: 'Plugin Type Example'
- requirements:
- _permission: 'access content'
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/plugin_type_example.services.yml b/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/plugin_type_example.services.yml
deleted file mode 100644
index db658ff56..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/plugin_type_example.services.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-# This declares the plugin manager to the service container. For background
-# information on the service container, see https://www.drupal.org/node/2133171.
-# Changes here require that the cache be cleared in order to have Drupal notice
-# them.
-services:
- # The machine name of the service. This is the string that must be passed to
- # Drupal::service() to get the instantiated plugin manager.
- plugin.manager.sandwich:
- # This tells the service container the name of our plugin manager class.
- class: Drupal\plugin_type_example\SandwichPluginManager
- parent: default_plugin_manager
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/src/Annotation/Sandwich.php b/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/src/Annotation/Sandwich.php
deleted file mode 100644
index 29a7f65ce..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/src/Annotation/Sandwich.php
+++ /dev/null
@@ -1,47 +0,0 @@
-sandwichManager = $sandwich_manager;
- }
-
- /**
- * Displays a page with an overview of our plugin type and plugins.
- *
- * Lists all the Sandwich plugin definitions by using methods on the
- * \Drupal\plugin_type_example\SandwichPluginManager class. Lists out the
- * description for each plugin found by invoking methods defined on the
- * plugins themselves. You can find the plugins we have defined in the
- * \Drupal\plugin_type_example\Plugin\Sandwich namespace.
- *
- * @return array
- * Render API array with content for the page at
- * /examples/plugin_type_example.
- */
- public function description() {
- $build = [];
-
- $build['intro'] = [
- '#markup' => $this->t("This page lists the sandwich plugins we've created. The sandwich plugin type is defined in Drupal\\plugin_type_example\\SandwichPluginManager. The various plugins are defined in the Drupal\\plugin_type_example\\Plugin\\Sandwich namespace."),
- ];
-
- // Get the list of all the sandwich plugins defined on the system from the
- // plugin manager. Note that at this point, what we have is *definitions* of
- // plugins, not the plugins themselves.
- $sandwich_plugin_definitions = $this->sandwichManager->getDefinitions();
-
- // Let's output a list of the plugin definitions we now have.
- $items = [];
- foreach ($sandwich_plugin_definitions as $sandwich_plugin_definition) {
- // Here we use various properties from the plugin definition. These values
- // are defined in the annotation at the top of the plugin class: see
- // \Drupal\plugin_type_example\Plugin\Sandwich\ExampleHamSandwich.
- $items[] = $this->t("@id (calories: @calories, description: @description )", [
- '@id' => $sandwich_plugin_definition['id'],
- '@calories' => $sandwich_plugin_definition['calories'],
- '@description' => $sandwich_plugin_definition['description'],
- ]);
- }
-
- // Add our list to the render array.
- $build['plugin_definitions'] = [
- '#theme' => 'item_list',
- '#title' => 'Sandwich plugin definitions',
- '#items' => $items,
- ];
-
- // If we want just a single plugin definition, we can use getDefinition().
- // This requires us to know the ID of the plugin we want. This is set in the
- // annotation on the plugin class: see
- // \Drupal\plugin_type_example\Plugin\Sandwich\ExampleHamSandwich.
- $ham_sandwich_plugin_definition = $this->sandwichManager->getDefinition('meatball_sandwich');
-
- // To get an instance of a plugin, we call createInstance() on the plugin
- // manager, passing the ID of the plugin we want to load. Let's output a
- // list of the plugins by loading an instance of each plugin definition and
- // collecting the description from each.
- $items = [];
- // The array of plugin definitions is keyed by plugin id, so we can just use
- // that to load our plugin instances.
- foreach ($sandwich_plugin_definitions as $plugin_id => $sandwich_plugin_definition) {
- // We now have a plugin instance. From here on it can be treated just as
- // any other object; have its properties examined, methods called, etc.
- $plugin = $this->sandwichManager->createInstance($plugin_id, ['of' => 'configuration values']);
- $items[] = $plugin->description();
- }
-
- $build['plugins'] = [
- '#theme' => 'item_list',
- '#title' => 'Sandwich plugins',
- '#items' => $items,
- ];
-
- return $build;
- }
-
- /**
- * {@inheritdoc}
- *
- * Override the parent method so that we can inject our sandwich plugin
- * manager service into the controller.
- *
- * For more about how dependency injection works read
- * https://www.drupal.org/node/2133171
- *
- * @see container
- */
- public static function create(ContainerInterface $container) {
- // Inject the plugin.manager.sandwich service that represents our plugin
- // manager as defined in the plugin_type_example.services.yml file.
- return new static($container->get('plugin.manager.sandwich'));
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/src/Plugin/Sandwich/ExampleHamSandwich.php b/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/src/Plugin/Sandwich/ExampleHamSandwich.php
deleted file mode 100644
index f9749cfc7..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/src/Plugin/Sandwich/ExampleHamSandwich.php
+++ /dev/null
@@ -1,51 +0,0 @@
-t() for string translations in our plugin.
- use StringTranslationTrait;
-
- /**
- * The day the sandwich is ordered.
- *
- * Since meatball sandwiches have a special behavior on Sundays, and since we
- * want to test that behavior on days other than Sunday, we have to store the
- * day as a property so we can test it.
- *
- * This is the string representation of the day of the week you get from
- * date('D').
- *
- * @var string
- */
- protected $day;
-
- /**
- * {@inheritdoc}
- */
- public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
- // This class needs to translate strings, so we need to inject the string
- // translation service from the container. This means our plugin class has
- // to implement ContainerFactoryPluginInterface. This requires that we make
- // this create() method, and use it to inject services from the container.
- // @see https://www.drupal.org/node/2012118
- $sandwich = new static(
- $configuration,
- $plugin_id,
- $plugin_definition,
- $container->get('string_translation')
- );
- return $sandwich;
- }
-
- /**
- * {@inheritdoc}
- */
- public function __construct(array $configuration, $plugin_id, $plugin_definition, TranslationInterface $translation) {
- // Store the translation service.
- $this->setStringTranslation($translation);
- // Store the day so we can generate a special description on Sundays.
- $this->day = date('D');
- // Pass the other parameters up to the parent constructor.
- parent::__construct($configuration, $plugin_id, $plugin_definition);
- }
-
- /**
- * {@inheritdoc}
- */
- public function order(array $extras) {
- $ingredients = ['meatballs', 'irresistible marinara sauce'];
- $sandwich = array_merge($ingredients, $extras);
- return 'You ordered an ' . implode(', ', $sandwich) . ' sandwich. Enjoy!';
- }
-
- /**
- * {@inheritdoc}
- */
- public function description() {
- // We override the description() method in order to change the description
- // text based on the date. On Sunday we only have day old bread.
- if ($this->day == 'Sun') {
- return $this->t("Italian style meatballs drenched in irresistible marinara sauce, served on day old bread.");
- }
- return parent::description();
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/src/SandwichBase.php b/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/src/SandwichBase.php
deleted file mode 100644
index 8a1cfc844..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/src/SandwichBase.php
+++ /dev/null
@@ -1,53 +0,0 @@
-pluginDefinition['description'];
- }
-
- /**
- * {@inheritdoc}
- */
- public function calories() {
- // Retrieve the @calories property from the annotation and return it.
- return (float) $this->pluginDefinition['calories'];
- }
-
- /**
- * {@inheritdoc}
- */
- abstract public function order(array $extras);
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/src/SandwichInterface.php b/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/src/SandwichInterface.php
deleted file mode 100644
index e8a5fe3ef..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/src/SandwichInterface.php
+++ /dev/null
@@ -1,54 +0,0 @@
-alterInfo('sandwich_info');
-
- // This sets the caching method for our plugin definitions. Plugin
- // definitions are discovered by examining the $subdir defined above, for
- // any classes with an $plugin_definition_annotation_name. The annotations
- // are read, and then the resulting data is cached using the provided cache
- // backend. For our Sandwich plugin type, we've specified the @cache.default
- // service be used in the plugin_type_example.services.yml file. The second
- // argument is a cache key prefix. Out of the box Drupal with the default
- // cache backend setup will store our plugin definition in the cache_default
- // table using the sandwich_info key. All that is implementation details
- // however, all we care about it that caching for our plugin definition is
- // taken care of by this call.
- $this->setCacheBackend($cache_backend, 'sandwich_info', ['sandwich_info']);
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/tests/src/Functional/PluginTypeExampleTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/tests/src/Functional/PluginTypeExampleTest.php
deleted file mode 100644
index 8473c360d..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/plugin_type_example/tests/src/Functional/PluginTypeExampleTest.php
+++ /dev/null
@@ -1,87 +0,0 @@
-container->get('plugin.manager.sandwich');
-
- $sandwich_plugin_definitions = $manager->getDefinitions();
-
- $this->assertCount(2, $sandwich_plugin_definitions, 'There are not two sandwich plugins defined.');
-
- // Check some of the properties of the ham sandwich plugin definition.
- $sandwich_plugin_definition = $sandwich_plugin_definitions['ham_sandwich'];
- $this->assertEquals(426, $sandwich_plugin_definition['calories'], 'The ham sandwich plugin definition\'s calories property is not set.');
-
- // Create an instance of the ham sandwich plugin to check it works.
- $plugin = $manager->createInstance('ham_sandwich', ['of' => 'configuration values']);
-
- $this->assertInstanceOf(ExampleHamSandwich::class, $plugin);
-
- // Create a meatball sandwich so we can check it's special behavior on
- // Sundays.
- /* @var $meatball \Drupal\plugin_type_example\SandwichInterface */
- $meatball = $manager->createInstance('meatball_sandwich');
- // Set the $day property to 'Sun'.
- $ref_day = new \ReflectionProperty($meatball, 'day');
- $ref_day->setAccessible(TRUE);
- $ref_day->setValue($meatball, 'Sun');
- // Check the special description on Sunday.
- $this->assertEqual($meatball->description(), 'Italian style meatballs drenched in irresistible marinara sauce, served on day old bread.');
- }
-
- /**
- * Test the output of the example page.
- */
- public function testPluginExamplePage() {
- $assert = $this->assertSession();
-
- $this->drupalGet('examples/plugin-type-example');
- $assert->statusCodeEquals(200);
-
- // Check we see the plugin id.
- $assert->pageTextContains('ham_sandwich', 'The plugin ID was not output.');
-
- // Check we see the plugin description.
- $assert->pageTextContains('Ham, mustard, rocket, sun-dried tomatoes.', 'The plugin description was not output.');
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/queue_example/queue_example.info.yml b/frontend/drupal9/web/modules/contrib/examples/modules/queue_example/queue_example.info.yml
deleted file mode 100644
index 21d355dd8..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/queue_example/queue_example.info.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-name: Queue Example
-type: module
-description: Examples of using the Drupal Queue API.
-package: Example modules
-core_version_requirement: ^8.7.7 || ^9
-dependencies:
- - examples:examples
-
-# Information added by Drupal.org packaging script on 2021-10-07
-version: '3.0.3'
-project: 'examples'
-datestamp: 1633612832
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/queue_example/queue_example.links.menu.yml b/frontend/drupal9/web/modules/contrib/examples/modules/queue_example/queue_example.links.menu.yml
deleted file mode 100644
index 23bb181a1..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/queue_example/queue_example.links.menu.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-queue_example.form:
- title: Queue Example
- route_name: queue_example.form
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/queue_example/queue_example.module b/frontend/drupal9/web/modules/contrib/examples/modules/queue_example/queue_example.module
deleted file mode 100644
index b3b0712b4..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/queue_example/queue_example.module
+++ /dev/null
@@ -1,37 +0,0 @@
-queueFactory = $queue_factory;
- $this->queueType = $settings->get('queue_default', 'queue.database');
- $this->database = $database;
- $this->cron = $cron;
- }
-
- /**
- * {@inheritdoc}
- */
- public static function create(ContainerInterface $container) {
- $form = new static($container->get('queue'), $container->get('database'), $container->get('cron'), $container->get('settings'));
- $form->setMessenger($container->get('messenger'));
- return $form;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getFormId() {
- // Return a string that is the unique ID of our form. Best practice here is
- // to namespace the form based on your module's name.
- return 'queue_example';
- }
-
- /**
- * {@inheritdoc}
- */
- public function buildForm(array $form, FormStateInterface $form_state) {
- // Simple counter that makes it possible to put auto-incrementing default
- // string into the string to insert.
- if (empty($form_state->get('insert_counter'))) {
- $form_state->set('insert_counter', 1);
- }
-
- $queue_name = $form_state->getValue('queue_name') ?: 'queue_example_first_queue';
- $items = $this->retrieveQueue($queue_name);
-
- $form['help'] = [
- '#type' => 'markup',
- '#markup' => '
' . $this->t('This page is an interface on the Drupal queue API. You can add new items to the queue, "claim" one (retrieve the next item and keep a lock on it), and delete one (remove it from the queue). Note that claims are not expired until cron runs, so there is a special button to run cron to perform any necessary expirations.') . '
' . $this->t('Note: the example works only with the default queue implementation, which is not currently configured!!') . '
',
- '#access' => (!$this->doesQueueUseDB()),
- ];
-
- $queue_names = ['queue_example_first_queue', 'queue_example_second_queue'];
- $form['queue_name'] = [
- '#type' => 'select',
- '#title' => $this->t('Choose queue to examine'),
- '#options' => array_combine($queue_names, $queue_names),
- '#default_value' => $queue_name,
- ];
-
- $form['queue_show'] = [
- '#type' => 'submit',
- '#value' => $this->t('Show queue'),
- '#submit' => ['::submitShowQueue'],
- ];
-
- $form['status_fieldset'] = [
- '#type' => 'fieldset',
- '#title' => $this->t('Queue status for @name', ['@name' => $queue_name]),
- '#collapsible' => TRUE,
- ];
-
- if (count($items) > 0) {
- $form['status_fieldset']['status'] = [
- '#theme' => 'table',
- '#header' => [
- $this->t('Item ID'),
- $this->t('Claimed/Expiration'),
- $this->t('Created'),
- $this->t('Content/Data'),
- ],
- '#rows' => array_map([$this, 'processQueueItemForTable'], $items),
- ];
- }
- else {
- $form['status_fieldset']['status'] = [
- '#type' => 'markup',
- '#markup' => $this->t('There are no items in the queue.'),
- ];
- }
-
- $form['insert_fieldset'] = [
- '#type' => 'fieldset',
- '#title' => $this->t('Insert into @name', ['@name' => $queue_name]),
- ];
-
- $form['insert_fieldset']['string_to_add'] = [
- '#type' => 'textfield',
- '#size' => 10,
- '#default_value' => $this->t('item @counter', ['@counter' => $form_state->get('insert_counter')]),
- ];
-
- $form['insert_fieldset']['add_item'] = [
- '#type' => 'submit',
- '#value' => $this->t('Insert into queue'),
- '#submit' => ['::submitAddQueueItem'],
- ];
-
- $form['claim_fieldset'] = [
- '#type' => 'fieldset',
- '#title' => $this->t('Claim from queue'),
- '#collapsible' => TRUE,
- ];
-
- $form['claim_fieldset']['claim_time'] = [
- '#type' => 'radios',
- '#title' => $this->t('Claim time, in seconds'),
- '#options' => [
- 0 => $this->t('none'),
- 5 => $this->t('5 seconds'),
- 60 => $this->t('60 seconds'),
- ],
- '#description' => $this->t('This time is only valid if cron runs during this time period. You can run cron manually below.'),
- '#default_value' => $form_state->getValue('claim_time') ?: 5,
- ];
-
- $form['claim_fieldset']['claim_item'] = [
- '#type' => 'submit',
- '#value' => $this->t('Claim the next item from the queue'),
- '#submit' => ['::submitClaimItem'],
- ];
-
- $form['claim_fieldset']['claim_and_delete_item'] = [
- '#type' => 'submit',
- '#value' => $this->t('Claim the next item and delete it'),
- '#submit' => ['::submitClaimDeleteItem'],
- ];
-
- $form['claim_fieldset']['run_cron'] = [
- '#type' => 'submit',
- '#value' => $this->t('Run cron manually to expire claims'),
- '#submit' => ['::submitRunCron'],
- ];
-
- $form['delete_queue'] = [
- '#type' => 'submit',
- '#value' => $this->t('Delete the queue and items in it'),
- '#submit' => ['::submitDeleteQueue'],
- ];
-
- return $form;
- }
-
- /**
- * {@inheritdoc}
- */
- public function submitForm(array &$form, FormStateInterface $form_state) {
- }
-
- /**
- * Retrieves the queue from the database for display purposes only.
- *
- * It is not recommended to access the database directly, and this is only
- * here so that the user interface can give a good idea of what's going on
- * in the queue.
- *
- * @param string $queue_name
- * The name of the queue from which to fetch items.
- *
- * @return array
- * An array of item arrays.
- */
- public function retrieveQueue($queue_name) {
- $items = [];
-
- // This example requires the default queue implementation to work,
- // so we bail if some other queue implementation has been installed.
- if (!$this->doesQueueUseDb()) {
- return $items;
- }
-
- // Make sure there are queue items available. The queue will not create our
- // database table if there are no items.
- if ($this->queueFactory->get($queue_name)->numberOfItems() >= 1) {
- $result = $this->database->query('SELECT item_id, data, expire, created FROM {' . DatabaseQueue::TABLE_NAME . '} WHERE name = :name ORDER BY item_id',
- [':name' => $queue_name],
- ['fetch' => \PDO::FETCH_ASSOC]
- );
- foreach ($result as $item) {
- $items[] = $item;
- }
- }
-
- return $items;
- }
-
- /**
- * Check if we are using the default database queue.
- *
- * @return bool
- * TRUE if we are using the default database queue implementation.
- */
- protected function doesQueueUseDb() {
- return $this->queueType == 'queue.database';
- }
-
- /**
- * Submit function for the show-queue button.
- *
- * @param array $form
- * Form definition array.
- * @param \Drupal\Core\Form\FormStateInterface $form_state
- * Form state object.
- */
- public function submitShowQueue(array &$form, FormStateInterface $form_state) {
- $queue = $this->queueFactory->get($form_state->getValue('queue_name'));
- // There is no harm in trying to recreate existing.
- $queue->createQueue();
-
- // Get the number of items.
- $count = $queue->numberOfItems();
-
- // Update the form item counter.
- $form_state->set('insert_counter', $count + 1);
-
- // Unset the string_to_add textbox.
- $form_state->unsetValue('string_to_add');
-
- $form_state->setRebuild();
- }
-
- /**
- * Submit function for the insert-into-queue button.
- *
- * @param array $form
- * Form definition array.
- * @param \Drupal\Core\Form\FormStateInterface $form_state
- * Form state object.
- */
- public function submitAddQueueItem(array &$form, FormStateInterface $form_state) {
- // Get a queue (of the default type) called 'queue_example_queue'.
- // If the default queue class is SystemQueue this creates a queue that
- // stores its items in the database.
- $queue = $this->queueFactory->get($form_state->getValue('queue_name'));
- // There is no harm in trying to recreate existing.
- $queue->createQueue();
-
- // Queue the string.
- $queue->createItem($form_state->getValue('string_to_add'));
- $count = $queue->numberOfItems();
- $this->messenger()->addMessage($this->t('Queued your string (@string_to_add). There are now @count items in the queue.', ['@count' => $count, '@string_to_add' => $form_state->getValue('string_to_add')]));
- // Allows us to keep information in $form_state.
- $form_state->setRebuild();
-
- // Unsetting the string_to_add allows us to set the incremented default
- // value for the user so they don't have to type anything.
- $form_state->unsetValue('string_to_add');
- $form_state->set('insert_counter', $count + 1);
- }
-
- /**
- * Submit function for the "claim" button.
- *
- * Claims (retrieves) an item from the queue and reports the results.
- *
- * @param array $form
- * Form definition array.
- * @param \Drupal\Core\Form\FormStateInterface $form_state
- * Form state object.
- */
- public function submitClaimItem(array &$form, FormStateInterface $form_state) {
- $queue = $this->queueFactory->get($form_state->getValue('queue_name'));
- // There is no harm in trying to recreate existing.
- $queue->createQueue();
- $item = $queue->claimItem($form_state->getValue('claim_time'));
- $count = $queue->numberOfItems();
- if (!empty($item)) {
- $this->messenger()->addMessage($this->t('Claimed item id=@item_id string=@string for @seconds seconds. There are @count items in the queue.', [
- '@count' => $count,
- '@item_id' => $item->item_id,
- '@string' => $item->data,
- '@seconds' => $form_state->getValue('claim_time'),
- ]));
- }
- else {
- $this->messenger()->addMessage($this->t('There were no items in the queue available to claim. There are @count items in the queue.', ['@count' => $count]));
- }
- $form_state->setRebuild();
- }
-
- /**
- * Submit function for "Claim and delete" button.
- *
- * @param array $form
- * Form definition array.
- * @param \Drupal\Core\Form\FormStateInterface $form_state
- * Form state object.
- */
- public function submitClaimDeleteItem(array &$form, FormStateInterface $form_state) {
- $queue = $this->queueFactory->get($form_state->getValue('queue_name'));
- // There is no harm in trying to recreate existing.
- $queue->createQueue();
- $count = $queue->numberOfItems();
- $item = $queue->claimItem(60);
- if (!empty($item)) {
- $this->messenger()->addMessage($this->t('Claimed and deleted item id=@item_id string=@string for @seconds seconds. There are @count items in the queue.', [
- '@count' => $count,
- '@item_id' => $item->item_id,
- '@string' => $item->data,
- '@seconds' => $form_state->getValue('claim_time'),
- ]));
- $queue->deleteItem($item);
- $count = $queue->numberOfItems();
- $this->messenger()->addMessage($this->t('There are now @count items in the queue.', ['@count' => $count]));
- }
- else {
- $count = $queue->numberOfItems();
- $this->messenger()->addMessage($this->t('There were no items in the queue available to claim/delete. There are currently @count items in the queue.', ['@count' => $count]));
- }
- $form_state->setRebuild();
- }
-
- /**
- * Submit function for "run cron" button.
- *
- * Runs cron (to release expired claims) and reports the results.
- *
- * @param array $form
- * Form definition array.
- * @param \Drupal\Core\Form\FormStateInterface $form_state
- * Form state object.
- */
- public function submitRunCron(array &$form, FormStateInterface $form_state) {
- $this->cron->run();
- $queue = $this->queueFactory->get($form_state->getValue('queue_name'));
- // @see https://www.drupal.org/node/2705809
- if ($queue instanceof QueueGarbageCollectionInterface) {
- $queue->garbageCollection();
- }
- // There is no harm in trying to recreate existing.
- $queue->createQueue();
- $count = $queue->numberOfItems();
- $this->messenger()->addMessage($this->t('Ran cron. If claimed items expired, they should be expired now. There are now @count items in the queue', ['@count' => $count]));
- $form_state->setRebuild();
- }
-
- /**
- * Submit handler for clearing/deleting the queue.
- *
- * @param array $form
- * Form definition array.
- * @param \Drupal\Core\Form\FormStateInterface $form_state
- * Form state object.
- */
- public function submitDeleteQueue(array &$form, FormStateInterface $form_state) {
- $queue = $this->queueFactory->get($form_state->getValue('queue_name'));
- $queue->deleteQueue();
- $this->messenger()->addMessage($this->t('Deleted the @queue_name queue and all items in it', ['@queue_name' => $form_state->getValue('queue_name')]));
- }
-
- /**
- * Helper method to format a queue item for display in a summary table.
- *
- * @param array $item
- * Queue item array with keys for item_id, expire, created, and data.
- *
- * @return array
- * An array with the queue properties in the right order for display in a
- * summary table.
- */
- private function processQueueItemForTable(array $item) {
- if ($item['expire'] > 0) {
- $item['expire'] = $this->t('Claimed: expires %expire', ['%expire' => date('r', $item['expire'])]);
- }
- else {
- $item['expire'] = $this->t('Unclaimed');
- }
- $item['created'] = date('r', $item['created']);
- $item['content'] = Html::escape(unserialize($item['data']));
- unset($item['data']);
-
- return $item;
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/queue_example/tests/src/Functional/QueueExampleTest.php b/frontend/drupal9/web/modules/contrib/examples/modules/queue_example/tests/src/Functional/QueueExampleTest.php
deleted file mode 100644
index 727935171..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/queue_example/tests/src/Functional/QueueExampleTest.php
+++ /dev/null
@@ -1,78 +0,0 @@
-drupalGet('examples/queue_example');
- // Load the queue with 5 items.
- for ($i = 1; $i <= 5; $i++) {
- $edit = ['queue_name' => 'queue_example_first_queue', 'string_to_add' => 'boogie' . $i];
- $this->drupalPostForm(NULL, $edit, 'Insert into queue');
- $this->assertText((string) new FormattableMarkup('There are now @number items in the queue', ['@number' => $i]));
- }
- // Claim each of the 5 items with a claim time of 0 seconds.
- for ($i = 1; $i <= 5; $i++) {
- $edit = ['queue_name' => 'queue_example_first_queue', 'claim_time' => 0];
- $this->drupalPostForm(NULL, $edit, 'Claim the next item from the queue');
- $this->assertPattern((string) new FormattableMarkup('%Claimed item id=.*string=@string for 0 seconds.%', ['@string' => 'boogie' . $i]));
- }
- $edit = ['queue_name' => 'queue_example_first_queue', 'claim_time' => 0];
- $this->drupalPostForm(NULL, $edit, 'Claim the next item from the queue');
- $this->assertText('There were no items in the queue available to claim');
-
- // Sleep a second so we can make sure that the timeouts actually time out.
- // Local systems work fine with this but apparently the PIFR server is so
- // fast that it needs a sleep before the cron run.
- sleep(1);
-
- // Run cron to release expired items.
- $this->drupalPostForm(NULL, [], 'Run cron manually to expire claims');
-
- // Claim and delete each of the 5 items which should now be available.
- for ($i = 1; $i <= 5; $i++) {
- $edit = ['queue_name' => 'queue_example_first_queue', 'claim_time' => 0];
- $this->drupalPostForm(NULL, $edit, 'Claim the next item and delete it');
- $this->assertPattern((string) new FormattableMarkup('%Claimed and deleted item id=.*string=@string for 0 seconds.%', ['@string' => 'boogie' . $i]));
- }
- // Verify that nothing is left to claim.
- $edit = ['queue_name' => 'queue_example_first_queue', 'claim_time' => 0];
- $this->drupalPostForm(NULL, $edit, 'Claim the next item from the queue');
- $this->assertText('There were no items in the queue available to claim');
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/render_example/config/install/render_example.settings.yml b/frontend/drupal9/web/modules/contrib/examples/modules/render_example/config/install/render_example.settings.yml
deleted file mode 100644
index f1df3324b..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/render_example/config/install/render_example.settings.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-show_block: false
-show_page: false
-note_about_render_arrays: false
-move_breadcrumbs: false
-reverse_sidebar: false
-wrap_blocks: false
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/render_example/config/schema/render_example.schema.yml b/frontend/drupal9/web/modules/contrib/examples/modules/render_example/config/schema/render_example.schema.yml
deleted file mode 100644
index ca8b19ce1..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/render_example/config/schema/render_example.schema.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-render_example.settings:
- type: config_object
- label: 'Render Example Settings'
- mapping:
- show_block:
- type: boolean
- show_page:
- type: boolean
- note_about_render_arrays:
- type: boolean
- move_breadcrumbs:
- type: boolean
- reverse_sidebar:
- type: boolean
- wrap_blocks:
- type: boolean
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/render_example/css/render_example.css b/frontend/drupal9/web/modules/contrib/examples/modules/render_example/css/render_example.css
deleted file mode 100644
index 3f7912056..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/render_example/css/render_example.css
+++ /dev/null
@@ -1,15 +0,0 @@
-.render_example--array {
- border-bottom: 2px solid #000;
- margin-top: 10px;
- padding-left: 5px;
- padding-top: 5px;
-}
-
-.render_example--code {
- background: #f1f1f1;
- border: 1px solid #000;
- display: block;
- max-height: 300px;
- overflow: scroll;
- padding: 10px;
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/render_example/render_example.info.yml b/frontend/drupal9/web/modules/contrib/examples/modules/render_example/render_example.info.yml
deleted file mode 100644
index 214414580..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/render_example/render_example.info.yml
+++ /dev/null
@@ -1,15 +0,0 @@
-name: Render Example
-type: module
-description: Provides examples demonstrating Drupal's Render API.
-package: Example modules
-core_version_requirement: ^8.7.7 || ^9
-dependencies:
- - drupal:block
- - drupal:node
- - drupal:user
- - examples:examples
-
-# Information added by Drupal.org packaging script on 2021-10-07
-version: '3.0.3'
-project: 'examples'
-datestamp: 1633612832
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/render_example/render_example.libraries.yml b/frontend/drupal9/web/modules/contrib/examples/modules/render_example/render_example.libraries.yml
deleted file mode 100644
index 785ea4363..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/render_example/render_example.libraries.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-# Define a new asset library which includes the CSS used to style the page
-# at examples/render_example/arrays. See how asset libraries are attached to
-# render arrays by reading the example code in
-# Drupal\render_example\Controller\RenderExampleController::arrays().
-render-example.library:
- version: 1.x
- css:
- theme:
- css/render_example.css: {}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/render_example/render_example.links.menu.yml b/frontend/drupal9/web/modules/contrib/examples/modules/render_example/render_example.links.menu.yml
deleted file mode 100644
index 854be91a3..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/render_example/render_example.links.menu.yml
+++ /dev/null
@@ -1,19 +0,0 @@
-render_example.description:
- title: Render Example
- description: Examples of building and altering render arrays.
- route_name: render_example.description
- expanded: TRUE
-
-render_example.arrays:
- title: Building render arrays
- description: Building render arrays in controllers.
- route_name: render_example.arrays
- parent: render_example.description
- weight: -9
-
-render_example.altering:
- title: Altering render arrays
- description: Using hooks and callbacks to alter render arrays.
- route_name: render_example.altering
- parent: render_example.description
- weight: -8
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/render_example/render_example.module b/frontend/drupal9/web/modules/contrib/examples/modules/render_example/render_example.module
deleted file mode 100644
index 048672ed9..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/render_example/render_example.module
+++ /dev/null
@@ -1,193 +0,0 @@
- ['render element' => 'element'],
- 'render_array' => ['render element' => 'element'],
- // This is used in combination with \Drupal\render_example\Element\Marquee
- // to define a new custom render element type that allows for the use of
- // '#type' => 'marquee' elements in a render array.
- 'render_example_marquee' => [
- 'variables' => [
- 'content' => '',
- 'attributes' => [],
- ],
- ],
- ];
-}
-
-/**
- * Implements hook_preprocess_page().
- *
- * Demonstrates using a preprocess function to alter the renderable array that
- * represents the page currently being viewed.
- */
-function render_example_preprocess_page(&$variables) {
- // Only modify the 'altering' page.
- if (\Drupal::routeMatch()->getRouteName() !== 'render_example.altering') {
- return;
- }
-
- $config = \Drupal::config('render_example.settings');
-
- // Preprocess hooks are invoked by the theme layer, and are used to give
- // modules a chance to manipulate the variables that are going to be made
- // available to a specific template file. Since content is still defined as
- // renderable arrays at this point you can do quite a bit to manipulate the
- // eventual output by altering these arrays.
- //
- // The $page variable in this case contains the complete content of the page
- // including all regions, and the blocks placed within each region.
- //
- // The actual process of converting a renderable array to HTML is started when
- // this variable is printed out within a Twig template. Drupal's Twig
- // extension provides a wrapper around the Twig code that prints out variables
- // which checks to see if the variable being printed is a renderable array and
- // passes it through \Drupal\Core\Render\RendererInterface::render() before
- // printing it to the screen.
- $page = &$variables['page'];
-
- // Move the breadcrumbs into the content area.
- if ($config->get('move_breadcrumbs') && !empty($page['breadcrumb']) && !empty($page['content'])) {
- $page['content']['breadcrumb'] = $page['breadcrumb'];
- unset($page['breadcrumb']);
- $page['content']['breadcrumb']['#weight'] = -99999;
-
- // Force the content to be re-sorted.
- $page['content']['#sorted'] = FALSE;
- }
-
- // Re-sort the contents of the sidebar in reverse order.
- if ($config->get('reverse_sidebar') && !empty($page['sidebar_first'])) {
- $page['sidebar_first'] = array_reverse($page['sidebar_first']);
- foreach (Element::children($page['sidebar_first']) as $element) {
- // Reverse the weights if they exist.
- if (!empty($page['sidebar_first'][$element]['#weight'])) {
- $page['sidebar_first'][$element]['#weight'] *= -1;
- }
- }
- // This forces the sidebar to be re-sorted.
- $page['sidebar_first']['#sorted'] = FALSE;
- }
-
- // Show the render array used to build the current page.
- // This relies on the Devel module's variable dumper service.
- // https://wwww.drupal.org/project/devel
- if (Drupal::moduleHandler()->moduleExists('devel') && $config->get('show_page')) {
- $page['content']['page_render_array'] = [
- '#type' => 'markup',
- '#prefix' => '
' . t('The page render array') . '
',
- // The devel.dumper service is provided by the devel module and makes for
- // and easier to read var_dump(). Especially if the companion Kint module
- // is enabled.
- 'dump' => \Drupal::service('devel.dumper')->exportAsRenderable($page, '$page'),
- '#weight' => -99999,
- ];
-
- $page['content']['#sorted'] = FALSE;
- }
-}
-
-/**
- * Implements hook_preprocess_block().
- */
-function render_example_preprocess_block(&$variables) {
- // Only modify the 'altering' page.
- if (\Drupal::routeMatch()->getRouteName() !== 'render_example.altering') {
- return;
- }
-
- $config = \Drupal::config('render_example.settings');
-
- // This example shows how you can manipulate an existing renderable array. In
- // this case by adding #prefix and #suffix properties to the block in order to
- // wrap a
around it.
- if ($config->get('wrap_blocks')) {
- $variables['content']['#prefix'] = '
';
- }
-
- // Show the render array used to build each block if the Devel module is
- // installed and the feature is enabled.
- if (Drupal::moduleHandler()->moduleExists('devel') && $config->get('show_block')) {
- $variables['content']['block_render_array'] = [
- '#type' => 'markup',
- '#prefix' => '
',
- 'dump' => \Drupal::service('devel.dumper')->exportAsRenderable($variables, $variables['plugin_id']),
- ];
- }
-}
-
-/**
- * @} End of "defgroup render_example".
- */
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/render_example/render_example.routing.yml b/frontend/drupal9/web/modules/contrib/examples/modules/render_example/render_example.routing.yml
deleted file mode 100644
index 64ff7956b..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/render_example/render_example.routing.yml
+++ /dev/null
@@ -1,21 +0,0 @@
-render_example.description:
- path: '/examples/render-example'
- defaults:
- _controller: '\Drupal\render_example\Controller\RenderExampleController::description'
- requirements:
- _permission: 'access content'
-
-render_example.altering:
- path: '/examples/render-example/altering'
- defaults:
- _form: '\Drupal\render_example\Form\RenderExampleDemoForm'
- _title: 'Alter pages and blocks'
- requirements:
- _permission: 'access content'
-
-render_example.arrays:
- path: '/examples/render-example/arrays'
- defaults:
- _controller: '\Drupal\render_example\Controller\RenderExampleController::arrays'
- requirements:
- _permission: 'access content'
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/render_example/src/Controller/RenderExampleController.php b/frontend/drupal9/web/modules/contrib/examples/modules/render_example/src/Controller/RenderExampleController.php
deleted file mode 100644
index 673378be7..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/render_example/src/Controller/RenderExampleController.php
+++ /dev/null
@@ -1,559 +0,0 @@
-currentUser = $current_user;
- }
-
- /**
- * {@inheritdoc}
- */
- public static function create(ContainerInterface $container) {
- return new static(
- $container->get('current_user')
- );
- }
-
- /**
- * {@inheritdoc}
- */
- protected function getModuleName() {
- return 'render_example';
- }
-
- /**
- * Examples of defining content using renderable arrays.
- *
- * Methods on a controller that are the target of a route should return a
- * renderable array which contains any content to display for that route.
- */
- public function arrays() {
- // The core structure of the Render API is the render array, which is a
- // hierarchical associative array containing data to be rendered and
- // properties describing how the data should be rendered. Whenever a module
- // needs to output content it should do so be defining that content as a
- // renderable array. Below we'll look at some common examples of how render
- // arrays can be used to define content.
- $build = [];
-
- // CSS and JavaScript libraries can be attached to elements in a renderable
- // array. This way, if the element ends up being rendered and displayed you
- // know for sure the CSS/JavaScript will also be included. But, if for
- // some reason the element isn't ever rendered then Drupal can skip the
- // unnecessary extra files.
- //
- // Learn more about attaching CSS and JavaScript libraries with the
- // #attached property here:
- // https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Render%21theme.api.php/group/theme_render/#sec_attached
- $build['#attached'] = [
- 'library' => [
- 'render_example/render-example.library',
- ],
- ];
-
- // Renderable arrays have two kinds of key/value pairs: properties and
- // children. Properties have keys starting with '#' and their values
- // influence how the array will be translated to a string. Children are all
- // elements whose keys do not start with a '#'. Their values should be
- // renderable arrays themselves.
- //
- // This example defines a new element, 'simple', that contains two
- // properties; '#markup' and '#description'. This is the quickest way to
- // output a string of HTML.
- $build['simple'] = [
- '#markup' => '
' . $this->t('This page contains examples of various content elements described using render arrays. Read the code and comments in \Drupal\render_example\Controller\RenderExampleController::arrays() for more information.') . '
',
- '#description' => $this->t('Example of using #markup'),
- ];
-
- // Additional properties can be used to further define the content. In this
- // case '#prefix' and '#suffix' are being used to provide strings to add
- // before, and after, the main content. This is useful because now the tag
- // being used to wrap the block of content can be easily changed without
- // having to worry about the content. Or, the tag can easily be left out
- // during rendering if for example the content is being output as JSON.
- //
- // There is a set of common properties that can be used for all elements in
- // a render array. These are defined by
- // \Drupal\Core\Render\Element\RenderElement. Most elements also have
- // additional element type specific properties.
- //
- // Figuring out what additional properties are available requires first
- // determining what sort of render element you're dealing with. Look for the
- // presence of one of these properties to start:
- // - #markup, or #plain_text: These are the simplest render arrays, and are
- // used to display simple strings of text. In addition to the common set
- // of properties available for all elements #markup elements can use the
- // #allowed_tags property, an array of additional tags to allow when the
- // HTML string is run through \Drupal\Component\Utility\Xss::filterAdmin()
- // to strip out possible XSS vectors.
- // - #theme: The presence of #theme indicates that the array contains data
- // to be themed by a particular theme hook. The available properties will
- // depend on the specific theme hook. See the example below for more about
- // determining what properties to use.
- // - #type: The presence of #type indicates that the array contains data and
- // options for a particular type of "render element" (for example, 'form',
- // 'textfield', 'submit', for HTML form element types; 'table', for a
- // table with rows, columns, and headers). The additional properties will
- // depend on the render element type, and are documented on the class that
- // defines the element type.
- //
- $build['simple_extras'] = [
- '#description' => $this->t('Example of using #prefix and #suffix'),
- // Note the addition of '#type' => 'markup' in this example compared to
- // the one above. Because #markup is such a commonly used element type you
- // can exclude the '#type' => 'markup' line and it will be assumed
- // automatically if the '#markup' property is present.
- '#type' => 'markup',
- '#markup' => '
' . $this->t('This one adds a prefix and suffix, which put a blockqoute tag around the item.') . '
',
- '#prefix' => '
',
- '#suffix' => '
',
- ];
-
- // In addition to #markup, you can also use #plain_text to output, you
- // guessed it, strings of plain text. This indicates that the array contains
- // text which should be escaped before it is displayed.
- $build['simple_text'] = [
- '#plain_text' => 'This is escaped',
- '#description' => $this->t('Example of using #plain_text'),
- ];
-
- // Using the '#theme' property for an element specifies that the array
- // contains data to be themed by a particular theme hook. Essentially using
- // a Twig template to generate the HTML for an element. Modules define theme
- // hooks by implementing hook_theme(), which specifies the input "variables"
- // used to provide data and options; if a hook_theme() implementation
- // specifies variable 'separator', then in a render array, you would provide
- // this data using the '#separator' property.
- //
- // @see hook_theme()
- $build['theme_element'] = [
- // The '#theme' property can be set to any valid theme hook. For more
- // information about theme hooks, and to discover available theme hooks
- // that you can use when creating render arrays see the documentation for
- // hook_theme().
- //
- // Many of the most commonly used theme hooks are defined in
- // drupal_common_theme().
- '#theme' => 'item_list',
- '#title' => $this->t('Example of using #theme'),
- // The #items property is specific to the 'item_list' theme hook, and
- // corresponds to the variable {{ items }} in the item-list.twig.html
- // template file.
- '#items' => [
- $this->t('This is an item in the list'),
- $this->t('This is some more text that we need in the list'),
- ],
- ];
-
- // Using the '#type' property for an element specifies that the array
- // contains data and options for a particular type of "render element".
- // Render element types can be thought of as prepackaged render arrays that
- // provide default values for a set of properties as well as code that
- // will perform additional processing on the array before it is rendered.
- //
- // As an example take a look at the code in
- // \Drupal\Core\Render\Element\Table::getInfo(). Notice that it is defining
- // values for #theme, and #process? These values will be merged with
- // whatever properties you define in your code.
- //
- // In addition, most render element types have type specific properties. A
- // table for example has #header, and #rows properties. The easiest way to
- // determine what element type specific properties exist is to read the
- // documentation for the class that defines the element type. Don't forget
- // that it will also inherit properties used by any class it is extending.
- //
- // There are two types of render element types:
- // - Generic elements: Generic render element types encapsulate logic for
- // generating HTML and attaching relevant CSS and JavaScript to the page.
- // These include things like link, table, and drop button elements.
- // - Form elements: Most of the render element types provided by core
- // represent the various widgets you might use on a form. Text fields,
- // password fields, and file upload buttons for example. These elements
- // are intended to be used in conjunction with a form controller class
- // and have additional properties such as `#required`, and
- // `#element_validate`, related to their use as part of a form. For more
- // on form elements check out the fapi_example module.
- $build['table'] = [
- // The value used for #type is the ID of the plugin that implements the
- // element type you want to use. This can be inferred from the annotation
- // for the element.
- // You can also find a list of element types provided by Drupal core here
- // https://api.drupal.org/api/drupal/elements.
- '#type' => 'table',
- '#caption' => $this->t('Our favorite colors.'),
- '#header' => [$this->t('Name'), $this->t('Favorite color')],
- '#rows' => [
- [$this->t('Amber'), $this->t('teal')],
- [$this->t('Addi'), $this->t('green')],
- [$this->t('Blake'), $this->t('#063')],
- [$this->t('Enid'), $this->t('indigo')],
- [$this->t('Joe'), $this->t('green')],
- ],
- '#description' => $this->t('Example of using #type.'),
- ];
-
- // Render arrays can be nested any level deep. This allows you to group
- // like things together. A great example of this is the $page array used in
- // conjunction with the page.html.twig template. The top level contains all
- // the regions, each of which contain the blocks placed in that region,
- // which in turn contain their own content. In fact, when this array is
- // ultimately displayed on a page it will be as part of the $page array.
- $build['nested_example'] = [
- '#description' => $this->t('Example of nesting elements'),
- '#markup' => '
' . $this->t('Render arrays can contain any number of nested elements. During rendering, the innermost elements are rendered first, and their output is incorporated into the parent element.') . '
',
- 'nested_child_element' => [
- // An un-ordered list of links.
- // See /core/modules/system/templates/item-list.html.twig.
- '#theme' => 'item_list',
- '#title' => $this->t('Links'),
- '#list_type' => 'ol',
- '#items' => [
- Link::fromTextAndUrl($this->t('Drupal'), Url::fromUri('https://www.drupal.org')),
- Link::fromTextAndUrl($this->t('Not Drupal'), Url::fromUri('https://wordpress.org/')),
- ],
- ],
- ];
-
- // Example of adding a link using the #link element type.
- $build['nested_example']['another_nested_child'] = [
- // See \Drupal\Core\Render\Element\Link.
- '#type' => 'link',
- '#title' => $this->t('A link to example.com'),
- '#url' => Url::fromUri('https://example.com'),
- ];
-
- // The #theme_wrappers property can be used to provide an array of theme
- // hooks which provide the envelope or "wrapper" of a set of child elements.
- // The theme function finds its element children (the sub-arrays) already
- // rendered in '#children'.
- $build['theme_wrappers demonstration'] = [
- '#description' => $this->t('Example of using #theme_wrappers'),
- 'child1' => ['#markup' => $this->t('Markup for child1')],
- 'child2' => ['#markup' => $this->t('Markup for child2')],
- '#theme_wrappers' => [
- 'render_example_add_div',
- ],
- ];
-
- // Use the #access property to control who can see what content. If an
- // element in an render array has its #access property set to FALSE it will
- // be removed from the array before rendering. And thus not visible.
- $build['access_example'] = [
- '#description' => $this->t('Example of using #access to control visibility'),
- '#markup' => $this->t('This text is only visible to authenticated users.'),
- '#access' => $this->currentUser->isAuthenticated(),
- ];
-
- // Some properties define callbacks, which are callable functions or methods
- // that are triggered at specific points during the rendering pipeline.
- $build['pre_render_and_post_render'] = [
- '#description' => $this->t('Example of using #pre_render and #post_render'),
- '#markup' => '
' . $this->t('markup for pre_render and post_render example') . '
',
- // #pre_render callbacks are triggered early in the rendering process,
- // they get access to the element in the array where the callback is
- // named, and all of its children. They can be used to do things like
- // conditionally alter the value of a property prior to the array being
- // rendered to HTML.
- '#pre_render' => [static::class . '::preRenderAddSuffix'],
- // #post_render callbacks are triggered after the array has been rendered
- // and can operate on the rendered HTML. They also have access to the
- // original array for context.
- '#post_render' => [static::class . '::postRenderAddPrefix'],
- ];
-
- // Properties that contain callbacks can also reference methods on a class
- // in addition to functions. See
- // \Drupal\render_example\Controller\RenderExampleController::preRender()
- // @todo: This doesn't work, we need to fix it.
- // https://www.drupal.org/project/examples/issues/2986435
- // $build['#pre_render'] = [static::class, 'preRender'];.
- // Caching is an important part of the Render API, converting an array to a
- // string of HTML can be an expensive process, and therefore whenever
- // possible the Render API will cache the results of rendering an array in
- // order to improve performance.
- //
- // When defining a render array you should use the #cache property to define
- // the cachability of an element.
- $build['cache_demonstration'] = [
- '#description' => $this->t('#cache demonstration'),
- // This string contains information that is specific to the user who is
- // currently viewing the page. We can cache it, and re-use the string any
- // time the same user views the page again. However, if the user changes,
- // or if the user changes their name, we need to expire the cached data
- // and rebuild it so that it is accurate.
- '#markup' => $this->t('Hello @name, welcome to the #cache example.', ['@name' => $this->currentUser->getAccountName()]),
- // The #cache property is used to provide metadata about the element being
- // cached, and the conditions under which it should be expired. This can
- // be time based, or context based. You can read more about caching
- // render arrays here
- // https://www.drupal.org/docs/8/api/render-api/cacheability-of-render-arrays
- '#cache' => [
- // The "current user" is used above, which depends on the request, so
- // we tell Drupal to vary by the 'user' cache context.
- 'contexts' => [
- 'user',
- ],
- ],
- ];
-
- // A #lazy_builder callback can be used to build a highly dynamic section of
- // a render array from scratch. This, combined with the use of placeholders,
- // allows the renderer to cache some, but not all, portions of a render
- // array. Without #lazy_builders, if any element in the render tree is
- // uncacheable the whole tree would need to be re-rendered every time.
- //
- // The general rendering flow is as follows:
- // - Check for cached version of output from previous rendering, if it
- // exists replace any placeholders in the rendered output with their
- // dynamic content as generated by the #lazy_builder callback, and return
- // the resulting HTML.
- // - If no cached version exists render the array to HTML, when an element
- // that can be placeholdered is encountered insert a placeholder, cache
- // the HTML after rendering for next time, replace the placeholders with
- // their dynamic content, and return the resulting HTML.
- //
- // This is especially noticeable when used in conjunction with modules like
- // Big Pipe which do rendering of a page in multiple passes vs. the default
- // single flush renderer.
- //
- // See \Drupal\block\BlockViewBuilder::viewMultiple() for an example from
- // core.
- $build['lazy_builder'] = [
- // Set the value of the #lazy_builder property to an array, the first key
- // of the array is the method, service, or function, to call in oder to
- // generate the dynamic data. The second argument is an array of any
- // arguments to pass to the callback. Arguments can be only primitive
- // types (string, bool, int, float, NULL).
- '#lazy_builder' => [
- static::class . '::lazyBuilder',
- [$this->currentUser->id(), 'Y-m-d'],
- ],
- // #lazy_builder callbacks can be used in conjunction with
- // #create_placeholder to tell the renderer that instead of simply calling
- // the #lazy_builder code right away, to instead insert a placeholder and
- // delay execution of the #lazy_builder code until it's needed.
- //
- // This is somewhat analogous to the way Drupal uses the PSR-4 autoloading
- // standard to "lazy" load PHP files that contain the definition of a
- // class only if, and when, that class is used.
- //
- // To force a element to use a placeholder set #create_placeholder to
- // TRUE.
- //
- // Alternatively you could include #cache metadata (see above) and allow
- // the Render API to use that metadata to automatically determine based on
- // the existence of high-cardinality cache contexts in the subtree whether
- // or not the element should use a placeholder.
- '#create_placeholder' => TRUE,
- ];
-
- // Example of the marquee element type defined by
- // \Drupal\render_example\Element\Marquee.
- $build['marquee'] = [
- '#description' => $this->t('Example custom element type'),
- '#type' => 'markup',
- 'marquee_element' => [
- '#type' => 'marquee',
- '#content' => $this->t('Hello world!'),
- ],
- ];
-
- $output = [];
- // We are going to create a new output render array that pairs each
- // example with a set of helper render arrays. These are used to display
- // the description as a title and the unrendered content alongside the
- // examples.
- foreach (Element::children($build) as $key) {
- if (isset($build[$key])) {
- $output[$key] = [
- '#theme' => 'render_array',
- 'description' => [
- '#type' => 'markup',
- '#markup' => $build[$key]['#description'] ?? '',
- ],
- 'rendered' => $build[$key],
- 'unrendered' => [
- '#type' => 'markup',
- '#markup' => htmlentities(Variable::export($build[$key])),
- ],
- ];
- }
- }
-
- foreach (Element::properties($build) as $key) {
- $output[$key] = $build[$key];
- }
-
- return $output;
- }
-
- /**
- * A #pre_render callback, expand array to include additional example info.
- *
- * This method is called during the process of rendering the array generated
- * by \Drupal\render_example\Controller\RenderExampleController::arrays().
- *
- * This also demonstrates how a #pre_render callback could be used to expand
- * a relatively simple array into multiple individual renderable elements
- * based on application logic.
- *
- * @param array $element
- * Pre render methods (and functions) get a single argument that is the
- * render API array representing the element where the #pre_render property
- * was defined, and all of it's children.
- *
- * @return array
- * Pre render methods (and functions) should return the modified render
- * array.
- */
- public static function preRender(array $element) {
- // For each first level child element lets add some additional helpful
- // output. \Drupal\Core\Render\Element::children() is a utility method that
- // allows you to quickly identify all children of a render array. That is
- // those key/value pairs whose key does not start with a '#'.
- foreach (Element::children($element) as $key) {
- $child = $element[$key];
- unset($element[$key]);
- if (isset($child['#description'])) {
- $element[$key] = [
- // The value from the #description property will be used as a title
- // for this element in the final output.
- 'description' => [
- '#markup' => $child['#description'],
- ],
- // Move the original element to 'rendered'. The rendering process is
- // recursive so this will still be located, and rendered to HTML.
- 'rendered' => $child,
- // Export the element definition as a string of text so we can display
- // the array that was used to create the rendered output just below
- // the output.
- 'unrendered' => [
- '#markup' => htmlentities(Variable::export($child)),
- ],
- '#theme' => 'render_array',
- ];
- }
- }
-
- // Return our modified version of the original $element.
- return $element;
- }
-
- /**
- * Example #lazy_builder callback.
- *
- * Demonstrates the use of a #lazy_builder callback to build out a render
- * array that can be substituted into the parent array wherever the cacheable
- * placeholder exists.
- *
- * This method is called during the process of rendering the array generated
- * by \Drupal\render_example\Controller\RenderExampleController::arrays().
- *
- * @param string $date_format
- * Date format to use with \Drupal\Core\Datetime\DateFormatter::format().
- *
- * @return array
- * A renderable array with content to replace the #lazy_builder placeholder.
- */
- public static function lazyBuilder($date_format) {
- $build = [
- 'lazy_builder_time' => [
- '#markup' => '
' . \Drupal::translation()->translate('The current time is @time', [
- '@time' => \Drupal::service('date.formatter')->format(REQUEST_TIME, 'long'),
- ]) . '
',
- ],
- ];
-
- return $build;
- }
-
- /**
- * Example '#post_render' callback function.
- *
- * Post render callbacks are triggered after an element has been rendered to
- * HTML and can act upon the final rendered string.
- *
- * This function is used as a post render callback in
- * Drupal\render_example\Controller\RenderExampleController::arrays().
- *
- * @param string $markup
- * The rendered element.
- * @param array $element
- * The element which was rendered (for reference)
- *
- * @return string
- * Markup altered as necessary. In this case we add a little postscript.
- *
- * @see \Drupal\render_example\Controller\RenderExampleController::arrays()
- */
- public static function postRenderAddPrefix($markup, array $element) {
- $markup .= '
This markup was added after rendering by a #post_render callback.
';
- return $markup;
- }
-
- /**
- * Example '#pre_render' function.
- *
- * Pre render callbacks are triggered prior to rendering an element to HTML
- * and are given the chance to manipulate the renderable array. Any changes
- * they make will be reflected in the final rendered HTML.
- *
- * We need to wrap suffix in a Markup object.
- * Otherwise, style attribute will be removed by Xss
- * @see \Drupal\Component\Utility\Xss::filter()
- *
- * This function is used as a post render callback in
- * \Drupal\render_example\Controller\RenderExampleController::arrays().
- *
- * @param array $element
- * The element which will be rendered.
- *
- * @return array
- * The altered element. In this case we add a #prefix to it.
- *
- * @see \Drupal\render_example\Controller\RenderExampleController::arrays()
- */
- public static function preRenderAddSuffix(array $element) {
- $element['#suffix'] = Markup::create('
'
- . t('This #suffix was added by a #pre_render callback.') . '
');
- return $element;
- }
-
- /**
- * {@inheritDoc}
- */
- public static function trustedCallbacks() {
- return ['postRenderAddPrefix', 'preRenderAddSuffix', 'lazyBuilder'];
- }
-
-}
diff --git a/frontend/drupal9/web/modules/contrib/examples/modules/render_example/src/Element/Marquee.php b/frontend/drupal9/web/modules/contrib/examples/modules/render_example/src/Element/Marquee.php
deleted file mode 100644
index 1a5c30140..000000000
--- a/frontend/drupal9/web/modules/contrib/examples/modules/render_example/src/Element/Marquee.php
+++ /dev/null
@@ -1,92 +0,0 @@
- 'marquee',
- * '#content' => 'Whoa cools, a marquee!',
- * ];
- * @endcode
- *
- * View an example of this custom element in use in
- * \Drupal\render_example\Controller\RenderExampleController::arrays().
- *
- * @see plugin_api
- * @see render_example_theme()
- *
- * @RenderElement("marquee")
- */
-class Marquee extends RenderElement {
-
- /**
- * {@inheritdoc}
- */
- public function getInfo() {
-
- // Returns an array of default properties that will be merged with any
- // properties defined in a render array when using this element type.
- // You can use any standard render array property here, and you can also
- // custom properties that are specific to your new element type.
- return [
- // See render_example_theme() where this new theme hook is declared.
- '#theme' => 'render_example_marquee',
- // Define a default #pre_render method. We will use this to handle
- // additional processing for the custom attributes we add below.
- '#pre_render' => [
- [self::class, 'preRenderMarquee'],
- ],
- // This is a custom property for our element type. We set it to blank by
- // default. The expectation is that a user will add the content that they
- // would like to see inside the marquee tag. This custom property is
- // accounted for in the associated template file.
- '#content' => '',
- '#attributes' => [
- 'direction' => 'left',
- 'loop' => -1,
- 'scrollamount' => 'random',
- ],
- ];
- }
-
- /**
- * Pre-render callback; Process custom attribute options.
- *
- * @param array $element
- * The renderable array representing the element with '#type' => 'marquee'
- * property set.
- *
- * @return array
- * The passed in element with changes made to attributes depending on
- * context.
- */
- public static function preRenderMarquee(array $element) {
- // Normal attributes for a