From 7c598a49b23dc0d91cd59115d3b84dfb45335208 Mon Sep 17 00:00:00 2001 From: bcweaver <brianweaver@gmail.com> Date: Tue, 23 Oct 2018 17:29:04 -0400 Subject: [PATCH] Removing unused 'ds' package --- composer.json | 1 - composer.lock | 76 +- vendor/composer/installed.json | 76 - web/modules/ds/LICENSE.txt | 339 ---- web/modules/ds/README.txt | 41 - web/modules/ds/composer.json | 29 - web/modules/ds/config/install/ds.settings.yml | 8 - .../schema/ds.entity_display.schema.yml | 107 -- .../ds/config/schema/ds.field.schema.yml | 65 - .../config/schema/ds.field_plugin.schema.yml | 56 - .../schema/ds.field_template.schema.yml | 121 -- web/modules/ds/config/schema/ds.schema.yml | 37 - .../ds/config/schema/ds.views.schema.yml | 74 - web/modules/ds/css/ds-2col-fluid.css | 28 - web/modules/ds/css/ds-2col-stacked-fluid.css | 32 - web/modules/ds/css/ds-2col-stacked.css | 26 - web/modules/ds/css/ds-2col.css | 22 - web/modules/ds/css/ds-3col-equal-width.css | 31 - .../ds/css/ds-3col-stacked-equal-width.css | 39 - web/modules/ds/css/ds-3col-stacked-fluid.css | 47 - web/modules/ds/css/ds-3col-stacked.css | 39 - web/modules/ds/css/ds-3col.css | 31 - web/modules/ds/css/ds-4col.css | 40 - web/modules/ds/css/ds.admin.css | 88 - web/modules/ds/drush/ExampleField.php | 54 - web/modules/ds/drush/ds.drush.inc | 290 ---- .../ds/drush/example_layout/README.txt | 2 - .../example_layout/example-layout.html.twig | 31 - .../drush/example_layout/example_layout.css | 22 - .../drush/example_layout/example_layout.inc | 23 - .../drush/example_layout/example_layout.png | 3 - web/modules/ds/ds.api.php | 197 --- web/modules/ds/ds.info.yml | 17 - web/modules/ds/ds.install | 97 -- web/modules/ds/ds.layouts.yml | 194 --- web/modules/ds/ds.libraries.yml | 61 - web/modules/ds/ds.links.action.yml | 15 - web/modules/ds/ds.links.menu.yml | 5 - web/modules/ds/ds.links.task.yml | 48 - web/modules/ds/ds.module | 1116 ------------- web/modules/ds/ds.permissions.yml | 10 - web/modules/ds/ds.routing.yml | 110 -- web/modules/ds/ds.services.yml | 12 - web/modules/ds/images/arrow.png | 12 - web/modules/ds/images/ds-1col-wrapper.png | 3 - web/modules/ds/images/ds-1col.png | 3 - web/modules/ds/images/ds-2col-fluid.png | 6 - .../ds/images/ds-2col-stacked-fluid.png | 5 - web/modules/ds/images/ds-2col-stacked.png | 4 - web/modules/ds/images/ds-2col.png | 3 - web/modules/ds/images/ds-3col-equal-width.png | 4 - .../ds/images/ds-3col-stacked-equal-width.png | 3 - .../ds/images/ds-3col-stacked-fluid.png | 4 - web/modules/ds/images/ds-3col-stacked.png | 5 - web/modules/ds/images/ds-3col.png | 3 - web/modules/ds/images/ds-4col.png | 3 - web/modules/ds/images/ds-reset.png | 6 - web/modules/ds/images/preview.png | 6 - web/modules/ds/includes/field_ui.inc | 1417 ----------------- web/modules/ds/js/ds.admin.js | 26 - .../ds/modules/ds_devel/ds_devel.info.yml | 14 - .../modules/ds_devel/ds_devel.links.task.yml | 3 - .../ds/modules/ds_devel/ds_devel.module | 18 - .../ds/modules/ds_devel/ds_devel.services.yml | 6 - .../src/Controller/DsDevelController.php | 117 -- .../Plugin/Derivative/DsDevelLocalTask.php | 74 - .../ds_devel/src/Routing/RouteSubscriber.php | 75 - web/modules/ds/modules/ds_extras/README.txt | 11 - .../config/install/ds_extras.settings.yml | 9 - .../core.entity_view_mode.node.revision.yml | 10 - .../config/schema/ds_extras.schema.yml | 46 - .../ds/modules/ds_extras/ds_extras.info.yml | 14 - .../ds/modules/ds_extras/ds_extras.install | 39 - .../modules/ds_extras/ds_extras.libraries.yml | 15 - .../ds/modules/ds_extras/ds_extras.module | 436 ----- .../ds_extras/ds_extras.permissions.yml | 2 - .../modules/ds_extras/ds_extras.routing.yml | 7 - .../modules/ds_extras/ds_extras.services.yml | 5 - .../modules/ds_extras/js/ds_extras.admin.js | 38 - .../src/Controller/DsExtrasController.php | 84 - .../src/EventSubscriber/RouteSubscriber.php | 37 - .../ds_extras/src/ExtrasPermissions.php | 65 - .../src/Plugin/Block/DsRegionBlock.php | 36 - .../src/Plugin/Derivative/DsRegionBlock.php | 33 - .../src/Plugin/DsField/SwitchField.php | 187 --- .../ds_switch_view_mode.info.yml | 13 - .../ds_switch_view_mode.module | 158 -- .../ds_switch_view_mode.permissions.yml | 5 - .../ds_switch_view_mode/src/Permissions.php | 36 - web/modules/ds/src/Annotation/DsField.php | 46 - .../ds/src/Annotation/DsFieldTemplate.php | 37 - .../ds/src/Controller/DsController.php | 158 -- .../ds/src/Controller/FieldController.php | 137 -- web/modules/ds/src/Ds.php | 210 --- web/modules/ds/src/DsAttribute.php | 34 - .../ds/src/Form/BlockFieldConfigForm.php | 145 -- web/modules/ds/src/Form/BlockFieldForm.php | 117 -- web/modules/ds/src/Form/ChangeLayoutForm.php | 247 --- web/modules/ds/src/Form/ClassesForm.php | 81 - web/modules/ds/src/Form/CopyFieldForm.php | 77 - web/modules/ds/src/Form/EmergencyForm.php | 188 --- web/modules/ds/src/Form/FieldDeleteForm.php | 117 -- web/modules/ds/src/Form/FieldFormBase.php | 251 --- web/modules/ds/src/Form/SettingsForm.php | 210 --- web/modules/ds/src/Form/TokenFieldForm.php | 85 - .../ds/src/Plugin/Derivative/BundleField.php | 78 - .../ds/src/Plugin/Derivative/DsEntityRow.php | 108 -- .../ds/src/Plugin/Derivative/DsLocalTask.php | 73 - .../Plugin/Derivative/DynamicBlockField.php | 19 - .../Plugin/Derivative/DynamicCopyField.php | 19 - .../ds/src/Plugin/Derivative/DynamicField.php | 60 - .../Plugin/Derivative/DynamicTokenField.php | 19 - .../Plugin/DsField/Block/BlockDescription.php | 105 -- .../ds/src/Plugin/DsField/BlockBase.php | 146 -- .../Plugin/DsField/Book/BookNavigation.php | 44 - .../ds/src/Plugin/DsField/BundleField.php | 60 - .../Plugin/DsField/Comment/CommentAuthor.php | 26 - .../DsField/Comment/CommentChangedDate.php | 26 - .../DsField/Comment/CommentPostDate.php | 26 - .../Plugin/DsField/Comment/CommentTitle.php | 26 - .../Plugin/DsField/Comment/CommentUser.php | 77 - .../DsField/Comment/CommentUserSignature.php | 43 - web/modules/ds/src/Plugin/DsField/Date.php | 90 -- .../ds/src/Plugin/DsField/DsFieldBase.php | 181 --- .../src/Plugin/DsField/DsFieldInterface.php | 126 -- .../src/Plugin/DsField/DynamicBlockField.php | 64 - .../src/Plugin/DsField/DynamicCopyField.php | 96 -- .../src/Plugin/DsField/DynamicTokenField.php | 31 - web/modules/ds/src/Plugin/DsField/Entity.php | 116 -- web/modules/ds/src/Plugin/DsField/Field.php | 93 -- web/modules/ds/src/Plugin/DsField/Link.php | 82 - web/modules/ds/src/Plugin/DsField/Markup.php | 44 - .../ds/src/Plugin/DsField/Node/NodeAuthor.php | 73 - .../Plugin/DsField/Node/NodeChangedDate.php | 26 - .../ds/src/Plugin/DsField/Node/NodeLink.php | 19 - .../ds/src/Plugin/DsField/Node/NodeLinks.php | 19 - .../src/Plugin/DsField/Node/NodePostDate.php | 26 - .../Plugin/DsField/Node/NodeSubmittedBy.php | 85 - .../ds/src/Plugin/DsField/Node/NodeTitle.php | 36 - .../DsField/Taxonomy/TaxonomyTermLink.php | 19 - .../DsField/Taxonomy/TaxonomyTermTitle.php | 26 - .../ds/src/Plugin/DsField/ThemePluginBase.php | 29 - web/modules/ds/src/Plugin/DsField/Title.php | 83 - .../ds/src/Plugin/DsField/TokenBase.php | 73 - .../ds/src/Plugin/DsField/User/User.php | 78 - .../src/Plugin/DsField/User/UserSignature.php | 50 - .../ds/src/Plugin/DsField/User/Username.php | 26 - .../Plugin/DsFieldTemplate/DefaultField.php | 16 - .../DsFieldTemplate/DsFieldTemplateBase.php | 132 -- .../DsFieldTemplateInterface.php | 78 - .../ds/src/Plugin/DsFieldTemplate/Expert.php | 261 --- .../ds/src/Plugin/DsFieldTemplate/Minimal.php | 16 - .../ds/src/Plugin/DsFieldTemplate/Reset.php | 49 - .../Plugin/DsFieldTemplatePluginManager.php | 32 - web/modules/ds/src/Plugin/DsLayout.php | 218 --- web/modules/ds/src/Plugin/DsPluginManager.php | 32 - .../Render/ConfigurableLanguageRenderer.php | 46 - .../Entity/Render/CurrentLanguageRenderer.php | 21 - .../Entity/Render/DefaultLanguageRenderer.php | 27 - .../views/Entity/Render/RendererBase.php | 174 -- .../Render/TranslationLanguageRenderer.php | 65 - .../ds/src/Plugin/views/row/EntityRow.php | 217 --- .../ds/src/Routing/RouteSubscriber.php | 78 - .../ds/src/Tests/BlockFieldPluginTest.php | 169 -- web/modules/ds/src/Tests/BlockTest.php | 106 -- web/modules/ds/src/Tests/CacheTagsTest.php | 54 - web/modules/ds/src/Tests/CommentTest.php | 156 -- web/modules/ds/src/Tests/DsTestTrait.php | 227 --- .../ds/src/Tests/DynamicFieldPluginTest.php | 170 -- web/modules/ds/src/Tests/EntitiesTest.php | 210 --- web/modules/ds/src/Tests/ExportablesTest.php | 86 - web/modules/ds/src/Tests/FastTestBase.php | 180 --- web/modules/ds/src/Tests/FieldGroupTest.php | 68 - .../ds/src/Tests/FieldPermissionsTest.php | 64 - web/modules/ds/src/Tests/FieldPluginTest.php | 90 -- .../ds/src/Tests/FieldTemplateTest.php | 582 ------- web/modules/ds/src/Tests/HiddenRegionTest.php | 51 - .../ds/src/Tests/LayoutClassesTest.php | 224 --- web/modules/ds/src/Tests/LayoutFluidTest.php | 83 - web/modules/ds/src/Tests/LayoutPluginTest.php | 106 -- .../ds/src/Tests/ManageDisplayTabTest.php | 39 - web/modules/ds/src/Tests/RdfTest.php | 38 - web/modules/ds/src/Tests/TwigRenderTest.php | 53 - web/modules/ds/src/Tests/ViewsTest.php | 181 --- .../ds/templates/ds-1col-wrapper.html.twig | 22 - web/modules/ds/templates/ds-1col.html.twig | 18 - .../ds/templates/ds-2col-fluid.html.twig | 41 - .../templates/ds-2col-stacked-fluid.html.twig | 55 - .../ds/templates/ds-2col-stacked.html.twig | 43 - web/modules/ds/templates/ds-2col.html.twig | 29 - .../templates/ds-3col-equal-width.html.twig | 36 - .../ds-3col-stacked-equal-width.html.twig | 50 - .../templates/ds-3col-stacked-fluid.html.twig | 71 - .../ds/templates/ds-3col-stacked.html.twig | 50 - web/modules/ds/templates/ds-3col.html.twig | 36 - web/modules/ds/templates/ds-4col.html.twig | 43 - .../ds/templates/ds-entity-view.html.twig | 10 - .../ds/templates/ds-field-expert.html.twig | 75 - .../ds/templates/ds-field-minimal.html.twig | 31 - .../ds/templates/ds-field-reset.html.twig | 23 - web/modules/ds/templates/ds-reset.html.twig | 10 - ...tity_view_display.node.article.default.yml | 77 - .../install/ds.field.exportable_field.yml | 11 - .../ds_exportables_test.info.yml | 12 - .../ds_test/config/schema/ds_test.schema.yml | 16 - .../modules/ds_test/css/dstest-2col-fluid.css | 9 - .../tests/modules/ds_test/css/dstest-2col.css | 9 - .../ds/tests/modules/ds_test/ds_test.info.yml | 13 - .../tests/modules/ds_test/ds_test.layouts.yml | 42 - .../modules/ds_test/ds_test.libraries.yml | 11 - .../ds/tests/modules/ds_test/ds_test.module | 121 -- .../src/Plugin/Block/DsCacheTestBlock.php | 55 - .../ds_test/src/Plugin/Block/DsTestBlock.php | 45 - .../src/Plugin/DsField/TestCachingField.php | 39 - .../ds_test/src/Plugin/DsField/TestField.php | 25 - .../ds_test/src/Plugin/DsField/TestField2.php | 25 - .../Plugin/DsField/TestFieldEmptyString.php | 25 - .../src/Plugin/DsField/TestFieldFalse.php | 25 - .../src/Plugin/DsField/TestFieldNothing.php | 24 - .../src/Plugin/DsField/TestFieldNull.php | 25 - .../src/Plugin/DsField/TestFieldZeroFloat.php | 25 - .../src/Plugin/DsField/TestFieldZeroInt.php | 25 - .../Plugin/DsField/TestFieldZeroString.php | 25 - .../DsField/TestMultipleEntityTypeField.php | 25 - .../src/Plugin/DsField/TestMultipleField.php | 39 - .../src/Plugin/DsFieldTemplate/TestLayout.php | 18 - .../templates/ds-test-template.html.twig | 1 - .../templates/dstest-1col-title.html.twig | 18 - .../ds_test/templates/dstest-1col.html.twig | 18 - .../templates/dstest-2col-fluid.html.twig | 41 - .../ds_test/templates/dstest-2col.html.twig | 29 - .../test_views/views.view.ds-testing.yml | 572 ------- .../install/rdf.mapping.node.article.yml | 26 - .../modules/ds_test_rdf/ds_test_rdf.info.yml | 11 - .../src/Functional/BlockFieldPluginTest.php | 171 -- .../ds/tests/src/Functional/BlockTest.php | 106 -- .../ds/tests/src/Functional/CacheTagsTest.php | 54 - .../ds/tests/src/Functional/CloneTest.php | 51 - .../tests/src/Functional/DsFieldCacheTest.php | 55 - .../ds/tests/src/Functional/DsTestTrait.php | 227 --- .../src/Functional/DynamicFieldPluginTest.php | 170 -- .../ds/tests/src/Functional/EntitiesTest.php | 245 --- .../tests/src/Functional/ExportablesTest.php | 86 - .../ds/tests/src/Functional/FastTestBase.php | 190 --- .../tests/src/Functional/FieldGroupTest.php | 69 - .../tests/src/Functional/FieldLayoutTest.php | 47 - .../src/Functional/FieldPermissionsTest.php | 63 - .../tests/src/Functional/FieldPluginTest.php | 105 -- .../src/Functional/FieldTemplateTest.php | 603 ------- .../tests/src/Functional/HiddenRegionTest.php | 51 - .../src/Functional/LayoutClassesTest.php | 231 --- .../tests/src/Functional/LayoutFluidTest.php | 93 -- .../tests/src/Functional/LayoutPluginTest.php | 136 -- .../src/Functional/ManageDisplayTabTest.php | 39 - .../ds/tests/src/Functional/RdfTest.php | 39 - .../tests/src/Functional/TwigRenderTest.php | 57 - .../ds/tests/src/Functional/UserTest.php | 36 - .../ds/tests/src/Functional/ViewsTest.php | 180 --- .../FunctionalJavascript/JavascriptTest.php | 94 -- .../ds/tests/src/Unit/DsServiceTest.php | 22 - .../ds_test_layout_theme.info.yml | 11 - .../ds_test_layout_theme.layouts.yml | 8 - .../templates/ds-1col--node.html.twig | 18 - .../templates/ds-field-minimal.html.twig | 34 - .../templates/ds-test-layout-theme.html.twig | 5 - 265 files changed, 1 insertion(+), 21371 deletions(-) delete mode 100644 web/modules/ds/LICENSE.txt delete mode 100644 web/modules/ds/README.txt delete mode 100644 web/modules/ds/composer.json delete mode 100644 web/modules/ds/config/install/ds.settings.yml delete mode 100644 web/modules/ds/config/schema/ds.entity_display.schema.yml delete mode 100644 web/modules/ds/config/schema/ds.field.schema.yml delete mode 100644 web/modules/ds/config/schema/ds.field_plugin.schema.yml delete mode 100644 web/modules/ds/config/schema/ds.field_template.schema.yml delete mode 100644 web/modules/ds/config/schema/ds.schema.yml delete mode 100644 web/modules/ds/config/schema/ds.views.schema.yml delete mode 100644 web/modules/ds/css/ds-2col-fluid.css delete mode 100644 web/modules/ds/css/ds-2col-stacked-fluid.css delete mode 100644 web/modules/ds/css/ds-2col-stacked.css delete mode 100644 web/modules/ds/css/ds-2col.css delete mode 100644 web/modules/ds/css/ds-3col-equal-width.css delete mode 100644 web/modules/ds/css/ds-3col-stacked-equal-width.css delete mode 100644 web/modules/ds/css/ds-3col-stacked-fluid.css delete mode 100644 web/modules/ds/css/ds-3col-stacked.css delete mode 100644 web/modules/ds/css/ds-3col.css delete mode 100644 web/modules/ds/css/ds-4col.css delete mode 100644 web/modules/ds/css/ds.admin.css delete mode 100644 web/modules/ds/drush/ExampleField.php delete mode 100644 web/modules/ds/drush/ds.drush.inc delete mode 100644 web/modules/ds/drush/example_layout/README.txt delete mode 100644 web/modules/ds/drush/example_layout/example-layout.html.twig delete mode 100644 web/modules/ds/drush/example_layout/example_layout.css delete mode 100644 web/modules/ds/drush/example_layout/example_layout.inc delete mode 100644 web/modules/ds/drush/example_layout/example_layout.png delete mode 100644 web/modules/ds/ds.api.php delete mode 100644 web/modules/ds/ds.info.yml delete mode 100644 web/modules/ds/ds.install delete mode 100644 web/modules/ds/ds.layouts.yml delete mode 100644 web/modules/ds/ds.libraries.yml delete mode 100644 web/modules/ds/ds.links.action.yml delete mode 100644 web/modules/ds/ds.links.menu.yml delete mode 100644 web/modules/ds/ds.links.task.yml delete mode 100644 web/modules/ds/ds.module delete mode 100644 web/modules/ds/ds.permissions.yml delete mode 100644 web/modules/ds/ds.routing.yml delete mode 100644 web/modules/ds/ds.services.yml delete mode 100644 web/modules/ds/images/arrow.png delete mode 100644 web/modules/ds/images/ds-1col-wrapper.png delete mode 100644 web/modules/ds/images/ds-1col.png delete mode 100644 web/modules/ds/images/ds-2col-fluid.png delete mode 100644 web/modules/ds/images/ds-2col-stacked-fluid.png delete mode 100644 web/modules/ds/images/ds-2col-stacked.png delete mode 100644 web/modules/ds/images/ds-2col.png delete mode 100644 web/modules/ds/images/ds-3col-equal-width.png delete mode 100644 web/modules/ds/images/ds-3col-stacked-equal-width.png delete mode 100644 web/modules/ds/images/ds-3col-stacked-fluid.png delete mode 100644 web/modules/ds/images/ds-3col-stacked.png delete mode 100644 web/modules/ds/images/ds-3col.png delete mode 100644 web/modules/ds/images/ds-4col.png delete mode 100644 web/modules/ds/images/ds-reset.png delete mode 100644 web/modules/ds/images/preview.png delete mode 100644 web/modules/ds/includes/field_ui.inc delete mode 100644 web/modules/ds/js/ds.admin.js delete mode 100644 web/modules/ds/modules/ds_devel/ds_devel.info.yml delete mode 100644 web/modules/ds/modules/ds_devel/ds_devel.links.task.yml delete mode 100644 web/modules/ds/modules/ds_devel/ds_devel.module delete mode 100644 web/modules/ds/modules/ds_devel/ds_devel.services.yml delete mode 100644 web/modules/ds/modules/ds_devel/src/Controller/DsDevelController.php delete mode 100644 web/modules/ds/modules/ds_devel/src/Plugin/Derivative/DsDevelLocalTask.php delete mode 100644 web/modules/ds/modules/ds_devel/src/Routing/RouteSubscriber.php delete mode 100644 web/modules/ds/modules/ds_extras/README.txt delete mode 100644 web/modules/ds/modules/ds_extras/config/install/ds_extras.settings.yml delete mode 100644 web/modules/ds/modules/ds_extras/config/optional/core.entity_view_mode.node.revision.yml delete mode 100644 web/modules/ds/modules/ds_extras/config/schema/ds_extras.schema.yml delete mode 100644 web/modules/ds/modules/ds_extras/ds_extras.info.yml delete mode 100644 web/modules/ds/modules/ds_extras/ds_extras.install delete mode 100644 web/modules/ds/modules/ds_extras/ds_extras.libraries.yml delete mode 100644 web/modules/ds/modules/ds_extras/ds_extras.module delete mode 100644 web/modules/ds/modules/ds_extras/ds_extras.permissions.yml delete mode 100644 web/modules/ds/modules/ds_extras/ds_extras.routing.yml delete mode 100644 web/modules/ds/modules/ds_extras/ds_extras.services.yml delete mode 100644 web/modules/ds/modules/ds_extras/js/ds_extras.admin.js delete mode 100644 web/modules/ds/modules/ds_extras/src/Controller/DsExtrasController.php delete mode 100644 web/modules/ds/modules/ds_extras/src/EventSubscriber/RouteSubscriber.php delete mode 100644 web/modules/ds/modules/ds_extras/src/ExtrasPermissions.php delete mode 100644 web/modules/ds/modules/ds_extras/src/Plugin/Block/DsRegionBlock.php delete mode 100644 web/modules/ds/modules/ds_extras/src/Plugin/Derivative/DsRegionBlock.php delete mode 100644 web/modules/ds/modules/ds_extras/src/Plugin/DsField/SwitchField.php delete mode 100644 web/modules/ds/modules/ds_switch_view_mode/ds_switch_view_mode.info.yml delete mode 100644 web/modules/ds/modules/ds_switch_view_mode/ds_switch_view_mode.module delete mode 100644 web/modules/ds/modules/ds_switch_view_mode/ds_switch_view_mode.permissions.yml delete mode 100644 web/modules/ds/modules/ds_switch_view_mode/src/Permissions.php delete mode 100644 web/modules/ds/src/Annotation/DsField.php delete mode 100644 web/modules/ds/src/Annotation/DsFieldTemplate.php delete mode 100644 web/modules/ds/src/Controller/DsController.php delete mode 100644 web/modules/ds/src/Controller/FieldController.php delete mode 100644 web/modules/ds/src/Ds.php delete mode 100644 web/modules/ds/src/DsAttribute.php delete mode 100644 web/modules/ds/src/Form/BlockFieldConfigForm.php delete mode 100644 web/modules/ds/src/Form/BlockFieldForm.php delete mode 100644 web/modules/ds/src/Form/ChangeLayoutForm.php delete mode 100644 web/modules/ds/src/Form/ClassesForm.php delete mode 100644 web/modules/ds/src/Form/CopyFieldForm.php delete mode 100644 web/modules/ds/src/Form/EmergencyForm.php delete mode 100644 web/modules/ds/src/Form/FieldDeleteForm.php delete mode 100644 web/modules/ds/src/Form/FieldFormBase.php delete mode 100644 web/modules/ds/src/Form/SettingsForm.php delete mode 100644 web/modules/ds/src/Form/TokenFieldForm.php delete mode 100644 web/modules/ds/src/Plugin/Derivative/BundleField.php delete mode 100644 web/modules/ds/src/Plugin/Derivative/DsEntityRow.php delete mode 100644 web/modules/ds/src/Plugin/Derivative/DsLocalTask.php delete mode 100644 web/modules/ds/src/Plugin/Derivative/DynamicBlockField.php delete mode 100644 web/modules/ds/src/Plugin/Derivative/DynamicCopyField.php delete mode 100644 web/modules/ds/src/Plugin/Derivative/DynamicField.php delete mode 100644 web/modules/ds/src/Plugin/Derivative/DynamicTokenField.php delete mode 100644 web/modules/ds/src/Plugin/DsField/Block/BlockDescription.php delete mode 100644 web/modules/ds/src/Plugin/DsField/BlockBase.php delete mode 100644 web/modules/ds/src/Plugin/DsField/Book/BookNavigation.php delete mode 100644 web/modules/ds/src/Plugin/DsField/BundleField.php delete mode 100644 web/modules/ds/src/Plugin/DsField/Comment/CommentAuthor.php delete mode 100644 web/modules/ds/src/Plugin/DsField/Comment/CommentChangedDate.php delete mode 100644 web/modules/ds/src/Plugin/DsField/Comment/CommentPostDate.php delete mode 100644 web/modules/ds/src/Plugin/DsField/Comment/CommentTitle.php delete mode 100644 web/modules/ds/src/Plugin/DsField/Comment/CommentUser.php delete mode 100644 web/modules/ds/src/Plugin/DsField/Comment/CommentUserSignature.php delete mode 100644 web/modules/ds/src/Plugin/DsField/Date.php delete mode 100644 web/modules/ds/src/Plugin/DsField/DsFieldBase.php delete mode 100644 web/modules/ds/src/Plugin/DsField/DsFieldInterface.php delete mode 100644 web/modules/ds/src/Plugin/DsField/DynamicBlockField.php delete mode 100644 web/modules/ds/src/Plugin/DsField/DynamicCopyField.php delete mode 100644 web/modules/ds/src/Plugin/DsField/DynamicTokenField.php delete mode 100644 web/modules/ds/src/Plugin/DsField/Entity.php delete mode 100644 web/modules/ds/src/Plugin/DsField/Field.php delete mode 100644 web/modules/ds/src/Plugin/DsField/Link.php delete mode 100644 web/modules/ds/src/Plugin/DsField/Markup.php delete mode 100644 web/modules/ds/src/Plugin/DsField/Node/NodeAuthor.php delete mode 100644 web/modules/ds/src/Plugin/DsField/Node/NodeChangedDate.php delete mode 100644 web/modules/ds/src/Plugin/DsField/Node/NodeLink.php delete mode 100644 web/modules/ds/src/Plugin/DsField/Node/NodeLinks.php delete mode 100644 web/modules/ds/src/Plugin/DsField/Node/NodePostDate.php delete mode 100644 web/modules/ds/src/Plugin/DsField/Node/NodeSubmittedBy.php delete mode 100644 web/modules/ds/src/Plugin/DsField/Node/NodeTitle.php delete mode 100644 web/modules/ds/src/Plugin/DsField/Taxonomy/TaxonomyTermLink.php delete mode 100644 web/modules/ds/src/Plugin/DsField/Taxonomy/TaxonomyTermTitle.php delete mode 100644 web/modules/ds/src/Plugin/DsField/ThemePluginBase.php delete mode 100644 web/modules/ds/src/Plugin/DsField/Title.php delete mode 100644 web/modules/ds/src/Plugin/DsField/TokenBase.php delete mode 100644 web/modules/ds/src/Plugin/DsField/User/User.php delete mode 100644 web/modules/ds/src/Plugin/DsField/User/UserSignature.php delete mode 100644 web/modules/ds/src/Plugin/DsField/User/Username.php delete mode 100644 web/modules/ds/src/Plugin/DsFieldTemplate/DefaultField.php delete mode 100644 web/modules/ds/src/Plugin/DsFieldTemplate/DsFieldTemplateBase.php delete mode 100644 web/modules/ds/src/Plugin/DsFieldTemplate/DsFieldTemplateInterface.php delete mode 100644 web/modules/ds/src/Plugin/DsFieldTemplate/Expert.php delete mode 100644 web/modules/ds/src/Plugin/DsFieldTemplate/Minimal.php delete mode 100644 web/modules/ds/src/Plugin/DsFieldTemplate/Reset.php delete mode 100644 web/modules/ds/src/Plugin/DsFieldTemplatePluginManager.php delete mode 100644 web/modules/ds/src/Plugin/DsLayout.php delete mode 100644 web/modules/ds/src/Plugin/DsPluginManager.php delete mode 100644 web/modules/ds/src/Plugin/views/Entity/Render/ConfigurableLanguageRenderer.php delete mode 100644 web/modules/ds/src/Plugin/views/Entity/Render/CurrentLanguageRenderer.php delete mode 100644 web/modules/ds/src/Plugin/views/Entity/Render/DefaultLanguageRenderer.php delete mode 100644 web/modules/ds/src/Plugin/views/Entity/Render/RendererBase.php delete mode 100644 web/modules/ds/src/Plugin/views/Entity/Render/TranslationLanguageRenderer.php delete mode 100644 web/modules/ds/src/Plugin/views/row/EntityRow.php delete mode 100644 web/modules/ds/src/Routing/RouteSubscriber.php delete mode 100644 web/modules/ds/src/Tests/BlockFieldPluginTest.php delete mode 100644 web/modules/ds/src/Tests/BlockTest.php delete mode 100644 web/modules/ds/src/Tests/CacheTagsTest.php delete mode 100644 web/modules/ds/src/Tests/CommentTest.php delete mode 100644 web/modules/ds/src/Tests/DsTestTrait.php delete mode 100644 web/modules/ds/src/Tests/DynamicFieldPluginTest.php delete mode 100644 web/modules/ds/src/Tests/EntitiesTest.php delete mode 100644 web/modules/ds/src/Tests/ExportablesTest.php delete mode 100644 web/modules/ds/src/Tests/FastTestBase.php delete mode 100644 web/modules/ds/src/Tests/FieldGroupTest.php delete mode 100644 web/modules/ds/src/Tests/FieldPermissionsTest.php delete mode 100644 web/modules/ds/src/Tests/FieldPluginTest.php delete mode 100644 web/modules/ds/src/Tests/FieldTemplateTest.php delete mode 100644 web/modules/ds/src/Tests/HiddenRegionTest.php delete mode 100644 web/modules/ds/src/Tests/LayoutClassesTest.php delete mode 100644 web/modules/ds/src/Tests/LayoutFluidTest.php delete mode 100644 web/modules/ds/src/Tests/LayoutPluginTest.php delete mode 100644 web/modules/ds/src/Tests/ManageDisplayTabTest.php delete mode 100644 web/modules/ds/src/Tests/RdfTest.php delete mode 100644 web/modules/ds/src/Tests/TwigRenderTest.php delete mode 100644 web/modules/ds/src/Tests/ViewsTest.php delete mode 100644 web/modules/ds/templates/ds-1col-wrapper.html.twig delete mode 100644 web/modules/ds/templates/ds-1col.html.twig delete mode 100644 web/modules/ds/templates/ds-2col-fluid.html.twig delete mode 100644 web/modules/ds/templates/ds-2col-stacked-fluid.html.twig delete mode 100644 web/modules/ds/templates/ds-2col-stacked.html.twig delete mode 100644 web/modules/ds/templates/ds-2col.html.twig delete mode 100644 web/modules/ds/templates/ds-3col-equal-width.html.twig delete mode 100644 web/modules/ds/templates/ds-3col-stacked-equal-width.html.twig delete mode 100644 web/modules/ds/templates/ds-3col-stacked-fluid.html.twig delete mode 100644 web/modules/ds/templates/ds-3col-stacked.html.twig delete mode 100644 web/modules/ds/templates/ds-3col.html.twig delete mode 100644 web/modules/ds/templates/ds-4col.html.twig delete mode 100644 web/modules/ds/templates/ds-entity-view.html.twig delete mode 100644 web/modules/ds/templates/ds-field-expert.html.twig delete mode 100644 web/modules/ds/templates/ds-field-minimal.html.twig delete mode 100644 web/modules/ds/templates/ds-field-reset.html.twig delete mode 100644 web/modules/ds/templates/ds-reset.html.twig delete mode 100644 web/modules/ds/tests/modules/ds_exportables_test/config/install/core.entity_view_display.node.article.default.yml delete mode 100644 web/modules/ds/tests/modules/ds_exportables_test/config/install/ds.field.exportable_field.yml delete mode 100644 web/modules/ds/tests/modules/ds_exportables_test/ds_exportables_test.info.yml delete mode 100644 web/modules/ds/tests/modules/ds_test/config/schema/ds_test.schema.yml delete mode 100644 web/modules/ds/tests/modules/ds_test/css/dstest-2col-fluid.css delete mode 100644 web/modules/ds/tests/modules/ds_test/css/dstest-2col.css delete mode 100644 web/modules/ds/tests/modules/ds_test/ds_test.info.yml delete mode 100644 web/modules/ds/tests/modules/ds_test/ds_test.layouts.yml delete mode 100644 web/modules/ds/tests/modules/ds_test/ds_test.libraries.yml delete mode 100644 web/modules/ds/tests/modules/ds_test/ds_test.module delete mode 100644 web/modules/ds/tests/modules/ds_test/src/Plugin/Block/DsCacheTestBlock.php delete mode 100644 web/modules/ds/tests/modules/ds_test/src/Plugin/Block/DsTestBlock.php delete mode 100644 web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestCachingField.php delete mode 100644 web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestField.php delete mode 100644 web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestField2.php delete mode 100644 web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestFieldEmptyString.php delete mode 100644 web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestFieldFalse.php delete mode 100644 web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestFieldNothing.php delete mode 100644 web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestFieldNull.php delete mode 100644 web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestFieldZeroFloat.php delete mode 100644 web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestFieldZeroInt.php delete mode 100644 web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestFieldZeroString.php delete mode 100644 web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestMultipleEntityTypeField.php delete mode 100644 web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestMultipleField.php delete mode 100644 web/modules/ds/tests/modules/ds_test/src/Plugin/DsFieldTemplate/TestLayout.php delete mode 100644 web/modules/ds/tests/modules/ds_test/templates/ds-test-template.html.twig delete mode 100644 web/modules/ds/tests/modules/ds_test/templates/dstest-1col-title.html.twig delete mode 100644 web/modules/ds/tests/modules/ds_test/templates/dstest-1col.html.twig delete mode 100644 web/modules/ds/tests/modules/ds_test/templates/dstest-2col-fluid.html.twig delete mode 100644 web/modules/ds/tests/modules/ds_test/templates/dstest-2col.html.twig delete mode 100644 web/modules/ds/tests/modules/ds_test/test_views/views.view.ds-testing.yml delete mode 100644 web/modules/ds/tests/modules/ds_test_rdf/config/install/rdf.mapping.node.article.yml delete mode 100644 web/modules/ds/tests/modules/ds_test_rdf/ds_test_rdf.info.yml delete mode 100644 web/modules/ds/tests/src/Functional/BlockFieldPluginTest.php delete mode 100644 web/modules/ds/tests/src/Functional/BlockTest.php delete mode 100644 web/modules/ds/tests/src/Functional/CacheTagsTest.php delete mode 100644 web/modules/ds/tests/src/Functional/CloneTest.php delete mode 100644 web/modules/ds/tests/src/Functional/DsFieldCacheTest.php delete mode 100644 web/modules/ds/tests/src/Functional/DsTestTrait.php delete mode 100644 web/modules/ds/tests/src/Functional/DynamicFieldPluginTest.php delete mode 100644 web/modules/ds/tests/src/Functional/EntitiesTest.php delete mode 100644 web/modules/ds/tests/src/Functional/ExportablesTest.php delete mode 100644 web/modules/ds/tests/src/Functional/FastTestBase.php delete mode 100644 web/modules/ds/tests/src/Functional/FieldGroupTest.php delete mode 100644 web/modules/ds/tests/src/Functional/FieldLayoutTest.php delete mode 100644 web/modules/ds/tests/src/Functional/FieldPermissionsTest.php delete mode 100644 web/modules/ds/tests/src/Functional/FieldPluginTest.php delete mode 100644 web/modules/ds/tests/src/Functional/FieldTemplateTest.php delete mode 100644 web/modules/ds/tests/src/Functional/HiddenRegionTest.php delete mode 100644 web/modules/ds/tests/src/Functional/LayoutClassesTest.php delete mode 100644 web/modules/ds/tests/src/Functional/LayoutFluidTest.php delete mode 100644 web/modules/ds/tests/src/Functional/LayoutPluginTest.php delete mode 100644 web/modules/ds/tests/src/Functional/ManageDisplayTabTest.php delete mode 100644 web/modules/ds/tests/src/Functional/RdfTest.php delete mode 100644 web/modules/ds/tests/src/Functional/TwigRenderTest.php delete mode 100644 web/modules/ds/tests/src/Functional/UserTest.php delete mode 100644 web/modules/ds/tests/src/Functional/ViewsTest.php delete mode 100644 web/modules/ds/tests/src/FunctionalJavascript/JavascriptTest.php delete mode 100644 web/modules/ds/tests/src/Unit/DsServiceTest.php delete mode 100644 web/modules/ds/tests/themes/ds_test_layout_theme/ds_test_layout_theme.info.yml delete mode 100644 web/modules/ds/tests/themes/ds_test_layout_theme/ds_test_layout_theme.layouts.yml delete mode 100644 web/modules/ds/tests/themes/ds_test_layout_theme/templates/ds-1col--node.html.twig delete mode 100644 web/modules/ds/tests/themes/ds_test_layout_theme/templates/ds-field-minimal.html.twig delete mode 100644 web/modules/ds/tests/themes/ds_test_layout_theme/templates/ds-test-layout-theme.html.twig diff --git a/composer.json b/composer.json index 91ecdfc98a..54ad0dcd6a 100644 --- a/composer.json +++ b/composer.json @@ -92,7 +92,6 @@ "drupal/devel": "1.0-rc2", "drupal/draggableviews": "1.0", "drupal/dropzonejs": "2.0-alpha3", - "drupal/ds": "2.7", "drupal/editor_advanced_link": "1.4", "drupal/embed": "1.0", "drupal/entity": "1.0-beta1", diff --git a/composer.lock b/composer.lock index 487c19ec08..daa98a4360 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "793d8ae996392aed15f315c60a8d2431", + "content-hash": "b37ad91cff6e56b6de95d0612dbc4cb6", "packages": [ { "name": "alchemy/zippy", @@ -3199,80 +3199,6 @@ "source": "http://cgit.drupalcode.org/dropzonejs" } }, - { - "name": "drupal/ds", - "version": "2.7.0", - "source": { - "type": "git", - "url": "https://git.drupal.org/project/ds", - "reference": "8.x-2.7" - }, - "dist": { - "type": "zip", - "url": "https://ftp.drupal.org/files/projects/ds-8.x-2.7.zip", - "reference": "8.x-2.7", - "shasum": "23fd8ac65ec94a7673c8d5235170bedf4a0da587" - }, - "require": { - "drupal/core": "~8.0", - "drupal/layout_plugin": "*" - }, - "require-dev": { - "drupal/devel": "*", - "drupal/field_group": "*" - }, - "type": "drupal-module", - "extra": { - "branch-alias": { - "dev-2.x": "2.x-dev" - }, - "drupal": { - "version": "8.x-2.7", - "datestamp": "1495040310", - "security-coverage": { - "status": "covered", - "message": "Covered by Drupal's security advisory policy" - } - } - }, - "notification-url": "https://packages.drupal.org/8/downloads", - "license": [ - "GPL-2.0+" - ], - "authors": [ - { - "name": "Bram Goffings", - "homepage": "https://www.drupal.org/user/172527", - "role": "Maintainer" - }, - { - "name": "Kristof De Jaeger", - "homepage": "http://realize.be/", - "role": "Maintainer" - }, - { - "name": "Brecht Ceyssens", - "homepage": "https://www.drupal.org/user/591438", - "role": "Maintainer" - }, - { - "name": "swentel", - "homepage": "https://www.drupal.org/user/107403" - } - ], - "description": "Extend the display options for every entity type.", - "homepage": "https://www.drupal.org/project/ds", - "keywords": [ - "drupal", - "layout", - "php" - ], - "support": { - "source": "http://git.drupal.org/project/ds.git", - "issues": "https://www.drupal.org/project/issues/ds", - "irc": "irc://irc.freenode.org/drupal-contribute" - } - }, { "name": "drupal/editor_advanced_link", "version": "1.4.0", diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index d52d8e5f6a..c57e12dda7 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -3294,82 +3294,6 @@ "source": "http://cgit.drupalcode.org/dropzonejs" } }, - { - "name": "drupal/ds", - "version": "2.7.0", - "version_normalized": "2.7.0.0", - "source": { - "type": "git", - "url": "https://git.drupal.org/project/ds", - "reference": "8.x-2.7" - }, - "dist": { - "type": "zip", - "url": "https://ftp.drupal.org/files/projects/ds-8.x-2.7.zip", - "reference": "8.x-2.7", - "shasum": "23fd8ac65ec94a7673c8d5235170bedf4a0da587" - }, - "require": { - "drupal/core": "~8.0", - "drupal/layout_plugin": "*" - }, - "require-dev": { - "drupal/devel": "*", - "drupal/field_group": "*" - }, - "type": "drupal-module", - "extra": { - "branch-alias": { - "dev-2.x": "2.x-dev" - }, - "drupal": { - "version": "8.x-2.7", - "datestamp": "1495040310", - "security-coverage": { - "status": "covered", - "message": "Covered by Drupal's security advisory policy" - } - } - }, - "installation-source": "dist", - "notification-url": "https://packages.drupal.org/8/downloads", - "license": [ - "GPL-2.0+" - ], - "authors": [ - { - "name": "Bram Goffings", - "homepage": "https://www.drupal.org/user/172527", - "role": "Maintainer" - }, - { - "name": "Kristof De Jaeger", - "homepage": "http://realize.be/", - "role": "Maintainer" - }, - { - "name": "Brecht Ceyssens", - "homepage": "https://www.drupal.org/user/591438", - "role": "Maintainer" - }, - { - "name": "swentel", - "homepage": "https://www.drupal.org/user/107403" - } - ], - "description": "Extend the display options for every entity type.", - "homepage": "https://www.drupal.org/project/ds", - "keywords": [ - "drupal", - "layout", - "php" - ], - "support": { - "source": "http://git.drupal.org/project/ds.git", - "issues": "https://www.drupal.org/project/issues/ds", - "irc": "irc://irc.freenode.org/drupal-contribute" - } - }, { "name": "drupal/editor_advanced_link", "version": "1.4.0", diff --git a/web/modules/ds/LICENSE.txt b/web/modules/ds/LICENSE.txt deleted file mode 100644 index d159169d10..0000000000 --- a/web/modules/ds/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. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - 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. - - <signature of Ty Coon>, 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/web/modules/ds/README.txt b/web/modules/ds/README.txt deleted file mode 100644 index 64c53881c7..0000000000 --- a/web/modules/ds/README.txt +++ /dev/null @@ -1,41 +0,0 @@ - ____ _ __ _____ _ __ - / __ \(_)________ / /___ ___ __ / ___/__ __(_) /____ - / / / / / ___/ __ \/ / __ `/ / / / \__ \/ / / / / __/ _ \ - / /_/ / (__ ) /_/ / / /_/ / /_/ / ___/ / /_/ / / /_/ __/ -/_____/_/____/ .___/_/\__,_/\__, / /____/\__,_/_/\__/\___/ - /_/ /____/ - -Display Suite gives you full control over the way content is displayed without -having to maintain dozens of twig files. -Read more: https://drupal.org/node/644662 - --- GETTING STARTED -- - -1. Install Display Suite in the usual way (https://drupal.org/node/895232) -2. Go to Administration > Structure > Display Suite - (admin/structure/ds/) -3. Click "Manage display" for the entity (e.g., "User") whose display you like - to change -4. In the vertical tab "Layout for ... in default" choose the desired layout - template (e.g. "Two column stacked") and click "Apply" -5. Start managing the display by dragging fields to regions -6. Click "Save" -Read more: https://drupal.org/node/1795282 - --- LINKS -- - -Project page: https://drupal.org/project/ds -Documentation: https://drupal.org/node/644662 -Screen casts & articles: https://drupal.org/node/644706 -Submit bug reports, feature suggestions: https://drupal.org/project/issues/ds - --- MAINTAINERS -- - -aspilicious - https://drupal.org/u/aspilicious -swentel - https://drupal.org/u/swentel -bceyssens - https://www.drupal.org/u/bceyssens - --- INSPIRATORS -- - -mzenner - https://drupal.org/u/mzenner -Wimmmmm - https://drupal.org/u/Wimmmmm diff --git a/web/modules/ds/composer.json b/web/modules/ds/composer.json deleted file mode 100644 index 8ff0492223..0000000000 --- a/web/modules/ds/composer.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "drupal/ds", - "description": "Extend the display options for every entity type.", - "type": "drupal-module", - "license": "GPL-2.0+", - "keywords": ["php", "layout", "drupal"], - "homepage": "https://www.drupal.org/project/ds", - "minimum-stability": "dev", - "authors": [ - { - "name": "Bram Goffings", - "role": "Maintainer" - }, - { - "name": "Kristof De Jaeger", - "homepage": "http://realize.be/", - "role": "Maintainer" - }, - { - "name": "Brecht Ceyssens", - "role": "Maintainer" - } - ], - "support": { - "issues": "https://www.drupal.org/project/issues/ds", - "irc": "irc://irc.freenode.org/drupal-contribute", - "source": "http://git.drupal.org/project/ds.git" - } -} diff --git a/web/modules/ds/config/install/ds.settings.yml b/web/modules/ds/config/install/ds.settings.yml deleted file mode 100644 index 333281dd79..0000000000 --- a/web/modules/ds/config/install/ds.settings.yml +++ /dev/null @@ -1,8 +0,0 @@ -disabled: false -field_template: false -ft-default: default -ft-show-colon: false -classes: - region: { } - field: { } -use_field_names: true diff --git a/web/modules/ds/config/schema/ds.entity_display.schema.yml b/web/modules/ds/config/schema/ds.entity_display.schema.yml deleted file mode 100644 index 9e8f9c125d..0000000000 --- a/web/modules/ds/config/schema/ds.entity_display.schema.yml +++ /dev/null @@ -1,107 +0,0 @@ -core.entity_view_display.*.*.*.third_party.ds: - type: mapping - label: 'Entity View Display Suite settings' - mapping: - layout: - type: mapping - label: 'The Display Suite layout' - mapping: - id: - type: string - label: 'The id of the layout' - library: - type: string - label: 'The asset library name attached to this layout' - disable_css: - type: boolean - label: 'Disable CSS or not' - entity_classes: - type: string - label: 'Entity, bundle and view mode classes' - settings: - type: mapping - label: 'Display Suite layout settings' - mapping: - classes: - type: 'sequence' - label: 'The layout classes' - sequence: - - type: ds.classes.[%key] - label: 'Classes array' - wrappers: - type: 'sequence' - label: 'The layout wrappers' - sequence: - - type: string - label: 'Field wrapper' - outer_wrapper: - type: string - label: 'The outer wrapper of the layout' - attributes: - type: string - label: 'The attributesof the layout' - link_attribute: - type: string - label: 'The link attribute of the layout' - link_custom: - type: string - label: 'The custom path of the layout' - regions: - type: sequence - label: 'The regions of the layout' - sequence: - - type: sequence - label: 'The fields belonging to the region' - sequence: - - type: string - label: 'The field name' - fields: - type: sequence - label: 'The Display Suite field plugins' - sequence: - - type: mapping - label: 'A Display Suite field plugin' - mapping: - plugin_id: - type: string - label: 'The plugin ID of the field' - weight: - type: integer - label: 'The weight of the field' - label: - type: string - label: 'The position of the label' - formatter: - type: string - label: 'The formatter of the field' - settings: - type: ds.field_plugin.[%parent.plugin_id] - ft: - type: ds.field_template.settings - -field.formatter.third_party.ds: - type: mapping - label: Display Suite field formatter settings - mapping: - ds_limit: - type: string - label: Limit of the field - ft: - type: ds.field_template.settings - -ds.field_template.settings: - type: mapping - label: 'The field template of the field' - mapping: - id: - type: string - label: 'The ID of the template' - settings: - type: ds.field_template.[%parent.id] - -ds.classes.*: - type: sequence - label: 'A list of classes' - sequence: - - type: string - label: 'Class name' diff --git a/web/modules/ds/config/schema/ds.field.schema.yml b/web/modules/ds/config/schema/ds.field.schema.yml deleted file mode 100644 index 9de1e67c41..0000000000 --- a/web/modules/ds/config/schema/ds.field.schema.yml +++ /dev/null @@ -1,65 +0,0 @@ -# Schema for the Display Suite field made in the UI. - -ds.field.*: - type: config_object - label: 'Display Suite field' - mapping: - id: - type: string - label: 'Unique ID' - label: - type: string - label: 'Label' - ui_limit: - type: string - label: 'UI limit' - type: - type: string - label: 'Field type' - type_label: - type: string - label: 'Administration label of the field type' - entities: - type: sequence - label: 'Entities' - sequence: - - type: string - label: 'Entity' - properties: - type: ds.field.properties.[%parent.type] - -ds.field.properties.token: - type: mapping - label: 'Display Suite token field field properties' - mapping: - content: - type: mapping - label: 'Token properties' - mapping: - value: - type: string - label: 'The content' - format: - type: string - label: 'The format' - -ds.field.properties.block: - type: mapping - label: 'Display Suite block field properties' - mapping: - block: - type: string - label: 'Block plugin ID' - use_block_title: - type: boolean - label: 'Use block title as label' - config: - type: block.settings.[%parent.block] - -ds.field.properties.copy: - type: mapping - label: 'Display Suite copy field properties' - mapping: - ds_plugin: - type: string - label: 'Display Suite plugin ID' diff --git a/web/modules/ds/config/schema/ds.field_plugin.schema.yml b/web/modules/ds/config/schema/ds.field_plugin.schema.yml deleted file mode 100644 index b861028373..0000000000 --- a/web/modules/ds/config/schema/ds.field_plugin.schema.yml +++ /dev/null @@ -1,56 +0,0 @@ -ds.field_plugin.node_title: - type: ds.field_plugin.title - -ds.field_plugin.taxonomy_term_title: - type: ds.field_plugin.title - -ds.field_plugin.username: - type: ds.field_plugin.title - -ds.field_plugin.title: - type: mapping - label: 'Mapping for the title field settings' - mapping: - link: - type: boolean - label: 'Link to content' - wrapper: - type: string - label: 'Wrapper of the field' - class: - type: string - label: 'Class of the field' - -ds.field_plugin.node_link: - type: ds.field_plugin.link - -ds.field_plugin.taxonomy_term_link: - type: ds.field_plugin.link - -ds.field_plugin.link: - type: mapping - label: 'Mapping for the link field settings' - mapping: - link text: - type: string - label: 'Link text' - link class: - type: string - label: 'Link class' - wrapper: - type: string - label: 'Wrapper of the field' - class: - type: string - label: 'Class of the field' - -ds.field_plugin.user: - type: ds.field_plugin.entity - -ds.field_plugin.entity: - type: mapping - label: 'Mapping for the entity field settings' - mapping: - entity_view_mode: - type: string - label: 'Display mode' diff --git a/web/modules/ds/config/schema/ds.field_template.schema.yml b/web/modules/ds/config/schema/ds.field_template.schema.yml deleted file mode 100644 index 07a4aff683..0000000000 --- a/web/modules/ds/config/schema/ds.field_template.schema.yml +++ /dev/null @@ -1,121 +0,0 @@ -ds.field_template.reset: - type: mapping - label: 'The settings of the reset field template' - mapping: - lb: - type: string - label: 'The label of the field' - -ds.field_template.minimal: - type: mapping - label: 'The settings of the minimal field template' - mapping: - lb: - type: string - label: 'The label of the field' - lb-col: - type: boolean - label: 'Enable the label colon' - classes: - type: sequence - label: 'Classes for the template' - sequence: - - type: string - label: 'Class name' - -ds.field_template.default: - type: mapping - label: 'The settings of the default field template' - mapping: - lb: - type: string - label: 'The label of the field' - lb-col: - type: boolean - label: 'Enable the label colon' - classes: - type: sequence - label: 'Classes for the template' - sequence: - - type: string - label: 'Class name' - -ds.field_template.expert: - type: mapping - label: 'The settings of the expert field template' - mapping: - lb: - type: string - label: 'The label of the field' - lbw: - type: boolean - label: 'Enable the label wrapper' - lbw-el: - type: string - label: 'The label wrapper element' - lbw-cl: - type: string - label: 'The label wrapper class' - lbw-at: - type: string - label: 'The label wrapper attribute' - lb-col: - type: boolean - label: 'Enable the label colon' - lbw-def-at: - type: boolean - label: 'Enable default attributes for the layout wrapper' - ow: - type: boolean - label: 'Enable the outer wrapper' - ow-el: - type: string - label: 'The outer wrapper element' - ow-cl: - type: string - label: 'The outer wrapper class' - ow-at: - type: string - label: 'The outer wrapper attribute' - ow-def-at: - type: boolean - label: 'Enable default attributes for the outer wrapper' - ow-def-cl: - type: boolean - label: 'Enable default classes for the outer wrapper' - fis: - type: boolean - label: 'Enable the field items wrapper' - fis-el: - type: string - label: 'The field items wrapper element' - fis-cl: - type: string - label: 'The field items wrapper class' - fis-at: - type: string - label: 'The field items wrapper attribute' - fis-def-at: - type: boolean - label: 'Enable default attributes for the field items wrapper' - fi: - type: boolean - label: 'Enable the field item wrapper' - fi-el: - type: string - label: 'The field item wrapper element' - fi-cl: - type: string - label: 'The field item wrapper class' - fi-at: - type: string - label: 'The field item wrapper attribute' - fi-def-at: - type: boolean - label: 'Enable default attributes for the field item wrapper' - prefix: - type: string - label: 'The prefix of the field' - suffix: - type: string - label: 'The suffix of the field' diff --git a/web/modules/ds/config/schema/ds.schema.yml b/web/modules/ds/config/schema/ds.schema.yml deleted file mode 100644 index dbcbd7d485..0000000000 --- a/web/modules/ds/config/schema/ds.schema.yml +++ /dev/null @@ -1,37 +0,0 @@ -# Schema for the configuration files of the Display Suite module. - -ds.settings: - type: config_object - label: 'Display Suite settings' - mapping: - disabled: - type: boolean - label: 'Disable Display Suite attaching fields' - field_template: - type: boolean - label: 'Uses field templates' - ft-default: - type: string - label: 'The default template' - ft-show-colon: - type: boolean - label: 'Kill the label colon' - classes: - type: mapping - label: 'Display Suite classes' - mapping: - region: - type: sequence - label: 'Region classes' - sequence: - - type: string - label: 'Region class' - field: - type: sequence - label: 'Field classes' - sequence: - - type: string - label: 'Field class' - use_field_names: - type: boolean - label: 'Use field names as field keys' diff --git a/web/modules/ds/config/schema/ds.views.schema.yml b/web/modules/ds/config/schema/ds.views.schema.yml deleted file mode 100644 index 696f54a38e..0000000000 --- a/web/modules/ds/config/schema/ds.views.schema.yml +++ /dev/null @@ -1,74 +0,0 @@ -views.row.ds_entity:*: - type: ds_views_entity_row - label: 'Display suite entity options' - -ds_views_entity_row: - type: views_entity_row - mapping: - alternating_fieldset: - type: mapping - label: 'Alternating settings' - mapping: - alternating: - type: boolean - label: 'Alternating' - allpages: - type: boolean - label: 'On every page' - item_0: - type: string - label: 'Display mode of type 1' - item_1: - type: string - label: 'Display mode of type 2' - item_2: - type: string - label: 'Display mode of type 3' - item_3: - type: string - label: 'Display mode of type 4' - item_4: - type: string - label: 'Display mode of type 5' - item_5: - type: string - label: 'Display mode of type 6' - item_6: - type: string - label: 'Display mode of type 7' - item_7: - type: string - label: 'Display mode of type 8' - item_8: - type: string - label: 'Display mode of type 9' - item_9: - type: string - label: 'Display mode of type 10' - grouping_fieldset: - type: mapping - label: 'Grouping settings' - mapping: - group: - type: boolean - label: 'Grouping enabled' - group_field: - type: string - label: 'Grouping based on a field' - group_field_function: - type: string - label: 'Process function for grouping field' - advanced_fieldset: - type: mapping - label: 'Advanced settings' - mapping: - advanced: - type: boolean - label: 'Advanced mode enabled' - switch_fieldset: - type: mapping - label: 'Use view mode of display settings' - mapping: - switch: - type: boolean - label: 'Use the alternative view mode selected in the display settings tab.' diff --git a/web/modules/ds/css/ds-2col-fluid.css b/web/modules/ds/css/ds-2col-fluid.css deleted file mode 100644 index 5c4af3fcd9..0000000000 --- a/web/modules/ds/css/ds-2col-fluid.css +++ /dev/null @@ -1,28 +0,0 @@ -/** - * @file - * Styling for the ds_2col_fluid template. - */ - -.ds-2col-fluid > .group-left { - float: left; /* LTR */ - width: 50%; -} - -[dir="rtl"] .ds-2col-fluid > .group-left { - float: right; -} - -.ds-2col-fluid > .group-right { - float: right; /* LTR */ - width: 50%; -} - -[dir="rtl"] .ds-2col-fluid > .group-right { - float: left; -} - -.ds-2col-fluid.group-one-column > .group-left, -.ds-2col-fluid.group-one-column > .group-right { - width: 100%; - float: none; -} diff --git a/web/modules/ds/css/ds-2col-stacked-fluid.css b/web/modules/ds/css/ds-2col-stacked-fluid.css deleted file mode 100644 index f70ef6cd1c..0000000000 --- a/web/modules/ds/css/ds-2col-stacked-fluid.css +++ /dev/null @@ -1,32 +0,0 @@ -/** - * @file - * Styling for the ds-2col-stacked-fluid template. - */ - -.ds-2col-stacked-fluid > .group-left { - float: left; /* LTR */ - width: 50%; -} - -[dir="rtl"] .ds-2col-stacked-fluid > .group-left { - float: right; -} - -.ds-2col-stacked-fluid > .group-right { - float: right; /* LTR */ - width: 50%; -} - -[dir="rtl"] .ds-2col-stacked-fluid > .group-right { - float: left; -} - -.ds-2col-stacked-fluid.group-one-column > .group-left, -.ds-2col-stacked-fluid.group-one-column > .group-right { - width: 100%; - float: none; -} - -.ds-2col-stacked-fluid > .group-footer { - clear: both; -} diff --git a/web/modules/ds/css/ds-2col-stacked.css b/web/modules/ds/css/ds-2col-stacked.css deleted file mode 100644 index 1f57dd0402..0000000000 --- a/web/modules/ds/css/ds-2col-stacked.css +++ /dev/null @@ -1,26 +0,0 @@ -/** - * @file - * Styling for the ds-2col-stacked template. - */ - -.ds-2col-stacked > .group-left { - float: left; /* LTR */ - width: 50%; -} - -[dir="rtl"] .ds-2col-stacked > .group-left { - float: right; -} - -.ds-2col-stacked > .group-right { - float: right; /* LTR */ - width: 50%; -} - -[dir="rtl"] .ds-2col-stacked > .group-right { - float: left; -} - -.ds-2col-stacked > .group-footer { - clear: both; -} diff --git a/web/modules/ds/css/ds-2col.css b/web/modules/ds/css/ds-2col.css deleted file mode 100644 index b5235b6f64..0000000000 --- a/web/modules/ds/css/ds-2col.css +++ /dev/null @@ -1,22 +0,0 @@ -/** - * @file - * Styling for the ds-2col template. - */ - -.ds-2col > .group-left { - float: left; /* LTR */ - width: 50%; -} - -[dir="rtl"] .ds-2col > .group-left { - float: right; -} - -.ds-2col > .group-right { - float: left; /* LTR */ - width: 50%; -} - -[dir="rtl"] .ds-2col > .group-right { - float: right; -} diff --git a/web/modules/ds/css/ds-3col-equal-width.css b/web/modules/ds/css/ds-3col-equal-width.css deleted file mode 100644 index 81f817b1e4..0000000000 --- a/web/modules/ds/css/ds-3col-equal-width.css +++ /dev/null @@ -1,31 +0,0 @@ -/** - * @file - * Styling for the ds-3col-equal template. - */ - -.ds-3col-equal > .group-left { - width: 33%; - float: left; /* LTR */ -} - -[dir="rtl"] .ds-3col-equal > .group-left { - float: right; -} - -.ds-3col-equal > .group-middle { - width: 34%; - float: left; /* LTR */ -} - -[dir="rtl"] .ds-3col-equal > .group-middle { - float: right; -} - -.ds-3col-equal > .group-right { - width: 33%; - float: right; /* LTR */ -} - -[dir="rtl"] .ds-3col-equal > .group-right { - float: left; -} diff --git a/web/modules/ds/css/ds-3col-stacked-equal-width.css b/web/modules/ds/css/ds-3col-stacked-equal-width.css deleted file mode 100644 index b5ce5b2ad8..0000000000 --- a/web/modules/ds/css/ds-3col-stacked-equal-width.css +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @file - * Styling for the ds-3col-stacked-equal template. - */ - -.ds-3col-stacked-equal > .group-header { - clear: both; -} - -.ds-3col-stacked-equal > .group-left { - width: 33%; - float: left; /* LTR */ -} - -[dir="rtl"] .ds-3col-stacked-equal > .group-left { - float: right; -} - -.ds-3col-stacked-equal > .group-middle { - width: 34%; - float: left; /* LTR */ -} - -[dir="rtl"] .ds-3col-stacked-equal > .group-middle { - float: right; -} - -.ds-3col-stacked-equal > .group-right { - width: 33%; - float: right; /* LTR */ -} - -[dir="rtl"] .ds-3col-stacked-equal > .group-right { - float: left; -} - -.ds-3col-stacked-equal > .group-footer { - clear: both; -} diff --git a/web/modules/ds/css/ds-3col-stacked-fluid.css b/web/modules/ds/css/ds-3col-stacked-fluid.css deleted file mode 100644 index bdcadac862..0000000000 --- a/web/modules/ds/css/ds-3col-stacked-fluid.css +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @file - * Styling for the ds-3col-stacked-fluid template. - */ - -.ds-3col-stacked-fluid > .group-header { - clear: both; -} - -.ds-3col-stacked-fluid > .group-left { - width: 25%; - float: left; /* LTR */ -} - -[dir="rtl"] .ds-3col-stacked-fluid > .group-left { - float: right; -} - -.ds-3col-stacked-fluid > .group-middle { - width: 100%; - float: left; /* LTR */ -} - -[dir="rtl"] .ds-3col-stacked-fluid > .group-middle { - float: right; -} - -.ds-3col-stacked-fluid.group-one-sidebar > .group-middle { - width: 75%; -} - -.ds-3col-stacked-fluid.group-two-sidebars > .group-middle { - width: 50%; -} - -.ds-3col-stacked-fluid > .group-right { - width: 25%; - float: right; /* LTR */ -} - -[dir="rtl"] .ds-3col-stacked-fluid > .group-right { - float: left; -} - -.ds-3col-stacked-fluid > .group-footer { - clear: both; -} diff --git a/web/modules/ds/css/ds-3col-stacked.css b/web/modules/ds/css/ds-3col-stacked.css deleted file mode 100644 index f79ba5460a..0000000000 --- a/web/modules/ds/css/ds-3col-stacked.css +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @file - * Styling for the ds-3col-stacked template. - */ - -.ds-3col-stacked > .group-header { - clear: both; -} - -.ds-3col-stacked > .group-left { - width: 25%; - float: left; /* LTR */ -} - -[dir="rtl"] .ds-3col-stacked > .group-left { - float: right; -} - -.ds-3col-stacked > .group-middle { - width: 50%; - float: left; /* LTR */ -} - -[dir="rtl"] .ds-3col-stacked > .group-middle { - float: right; -} - -.ds-3col-stacked > .group-right { - width: 25%; - float: right; /* LTR */ -} - -[dir="rtl"] .ds-3col-stacked > .group-right { - float: left; -} - -.ds-3col-stacked > .group-footer { - clear: both; -} diff --git a/web/modules/ds/css/ds-3col.css b/web/modules/ds/css/ds-3col.css deleted file mode 100644 index 6145d88ab9..0000000000 --- a/web/modules/ds/css/ds-3col.css +++ /dev/null @@ -1,31 +0,0 @@ -/** - * @file - * Styling for the ds-3col template. - */ - -.ds-3col > .group-left { - width: 25%; - float: left; /* LTR */ -} - -[dir="rtl"] .ds-3col > .group-left { - float: right; -} - -.ds-3col > .group-middle { - width: 50%; - float: left; /* LTR */ -} - -[dir="rtl"] .ds-3col > .group-middle { - float: right; -} - -.ds-3col > .group-right { - width: 25%; - float: right; /* LTR */ -} - -[dir="rtl"] .ds-3col > .group-right { - float: left; -} diff --git a/web/modules/ds/css/ds-4col.css b/web/modules/ds/css/ds-4col.css deleted file mode 100644 index dc86992a22..0000000000 --- a/web/modules/ds/css/ds-4col.css +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @file - * Styling for the ds-4col template. - */ - -.ds-4col > .group-first { - width: 25%; - float: left; /* LTR */ -} - -[dir="rtl"] .ds-4col > .group-first { - float: right; -} - -.ds-4col > .group-second { - width: 25%; - float: left; /* LTR */ -} - -[dir="rtl"] .ds-4col > .group-second { - float: right; -} - -.ds-4col > .group-third { - width: 25%; - float: left; /* LTR */ -} - -[dir="rtl"] .ds-4col > .group-third { - float: right; -} - -.ds-4col > .group-fourth { - width: 25%; - float: left; /* LTR */ -} - -[dir="rtl"] .ds-4col > .group-fourth { - float: right; -} diff --git a/web/modules/ds/css/ds.admin.css b/web/modules/ds/css/ds.admin.css deleted file mode 100644 index e2a4183600..0000000000 --- a/web/modules/ds/css/ds.admin.css +++ /dev/null @@ -1,88 +0,0 @@ -/** - * @file - * Administration CSS for Display Suite. - */ - -.ds-extras-field-template { - margin-bottom: 1em; -} - -.ft-settings .ft-group { - border-top: 1px solid #aaa; - padding: 5px 0; - overflow: auto; -} - -.field-formatter-settings-edit-form .ft-group .form-item { - margin: 0; -} - -.ds-layout-preview-title { - font-weight: bold; -} - -.ds-layout-preview-image { - float: left; - width: 150px; - padding-top: 10px; -} - -.ds-layout-preview-image img { - width: 150px; -} - -.ds-layout-preview-suggestion { - min-width: 150px; - overflow: hidden; - padding-left: 30px; -} - -.ft-group div.form-item { - float: left; - width: 130px; -} - -.ds-after-suggestion { - clear: both; - padding-top: 10px; -} - -/** - * Displays list - */ -.ds-display-list-options { - width: 300px; -} - -/** - * Limit - */ -.limit-float { - float: left; - margin-right: 5px; -} - -/** - * Change layout screen. - */ -.change-ds-layout-info { - margin-bottom: 10px; -} - -.change-ds-layout-old-region { - font-weight: bold; -} - -.ds-layout-change-save { - clear: both; -} - -.ds-layout-preview-arrow { - float: left; - margin: 80px 10px 0 5px; -} - -.ds-layout-regions { - float: left; - width: 210px; -} diff --git a/web/modules/ds/drush/ExampleField.php b/web/modules/ds/drush/ExampleField.php deleted file mode 100644 index bfa21c1136..0000000000 --- a/web/modules/ds/drush/ExampleField.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php - -namespace Drupal\example_field\Plugin\DsField; - -use Drupal\Core\Form\FormStateInterface; -use Drupal\ds\Plugin\DsField\DsFieldBase; - -/** - * Generated field. - * - * @DsField( - * id = "example_field_ExampleField", - * title = @Translation("ExampleField"), - * entity_type = "node" - * ) - */ -class ExampleField extends DsFieldBase { - - /** - * {@inheritdoc} - */ - public function build() { - return []; - } - - /** - * {@inheritdoc} - */ - public function settingsForm($form, FormStateInterface $form_state) { - return []; - } - - /** - * {@inheritdoc} - */ - public function defaultConfiguration() { - return []; - } - - /** - * {@inheritdoc} - */ - public function formatters() { - return []; - } - - /** - * {@inheritdoc} - */ - public function isAllowed() { - return TRUE; - } - -} diff --git a/web/modules/ds/drush/ds.drush.inc b/web/modules/ds/drush/ds.drush.inc deleted file mode 100644 index a47d10e145..0000000000 --- a/web/modules/ds/drush/ds.drush.inc +++ /dev/null @@ -1,290 +0,0 @@ -<?php - -/** - * @file - * Display Suite drush integration. - */ - -use Drupal\Component\Utility\Html; -use Drupal\Component\Utility\Unicode; - -/** - * Implements hook_drush_command(). - */ -function ds_drush_command() { - $items = []; - - $items['ds-build'] = [ - 'description' => 'Create a basic template and configuration file for a new Display Suite layout.', - 'arguments' => [ - 'name' => 'Name for your layout.', - ], - 'options' => [ - 'name' => 'Name for your layout.', - 'regions' => 'Regions for your layout, comma-separated.', - 'css' => 'Set this to true if you want to include a CSS file for your layout.', - 'image' => 'Set this to true if you want to include a preview image for your layout.', - ], - 'examples' => [ - 'drush ds-build "My layout name"' => 'Create a layout with a few example regions.', - 'drush ds-build "My layout name" --regions="Region 1, Region 2"' => 'Create a layout with custom regions.', - 'drush ds-build "My layout name" --css' => 'Create a layout with an included CSS file.', - ], - ]; - - $items['ds-field'] = [ - 'description' => 'Create a Display Suite plugin', - 'arguments' => [ - 'name' => 'Name for your Display Suite field class', - ], - 'options' => [ - 'name' => 'Name for your class.', - 'entity' => 'Name of the entity', - ], - 'examples' => [ - 'drush ds-field "MyField"' => 'Create a field with only a render function', - 'drush ds-field "MyTest" --entity=user' => 'Create a field for the user entity', - ], - ]; - - return $items; -} - -/** - * Create a basic template and configuration file for a Display Suite layout. - */ -function drush_ds_build($name = NULL) { - // Determine the layout name. - if (!isset($name)) { - $name = drush_get_option('name'); - } - if (!$name) { - drush_die(dt('You need to set a name for your layout. Type "drush help ds-build" for help.')); - } - - // Determine the machine name. - $machine_name = ds_prepare_machine_name($name); - - // Determine the path to our example layout templates. - $ds_layout_path = dirname(__FILE__) . '/example_layout'; - - // We create files in the current working directory. - $layout_path = drush_cwd() . '/' . $machine_name; - drush_op('mkdir', $layout_path); - - // Determine regions. - $regions = drush_get_option('regions'); - if ($regions) { - $regions = preg_split('/,(\ )?/', $regions); - } - - // Copy the example templates. - $twig_machine_name = strtr($machine_name, '_', '-'); - drush_op('copy', $ds_layout_path . '/example-layout.html.twig', $layout_path . "/$twig_machine_name.html.twig"); - drush_op('copy', $ds_layout_path . '/example_layout.inc', $layout_path . "/$machine_name.inc"); - - // Prepare an array of things that need to be rewritten in our templates. - $find = []; - $replace = []; - - // Replace example name. - $find[] = '/example layout/i'; - $replace[] = $name; - $find[] = '/example_layout/'; - $replace[] = $machine_name; - - // Include a CSS file for this layout. - $css = drush_get_option('css'); - if (isset($css)) { - drush_op('copy', $ds_layout_path . '/example_layout.css', $layout_path . "/$machine_name.css"); - - // Replace example styling if we have custom regions. - if ($regions) { - // Separate variables so this won't mess up our other templates. - $css_find = $find; - $css_replace = $replace; - - $css_find[] = "/(\*\/\n\n).+(\n)$/s"; - $css_replace[] = '$1' . ds_prepare_regions_css($regions) . '$2'; - - drush_op('ds_file_preg_replace', [$layout_path . "/$machine_name.css"], $css_find, $css_replace); - } - - // Uncomment the CSS rule in our configuration. - $find[] = "/\/\/ ('css' => TRUE,)/"; - $replace[] = '$1'; - } - - // Check on form option. - $image = drush_get_option('image'); - if (isset($image)) { - // Uncomment the Form rule in our configuration. - $find[] = "/\/\/ ('image' => TRUE,)/"; - $replace[] = '$1'; - } - - // Replace example region PHP/HTML code. - if ($regions) { - $find[] = '/ {# regions #}.+{# \/regions #}/s'; - $replace[] = ds_prepare_regions_html($regions); - $find[] = "/( \* Regions:\n).+(\n \*\/)/s"; - $replace[] = '$1' . ds_prepare_regions_variable_documentation($regions) . '$2'; - $find[] = "/( 'regions' => array\(\n).+(\n \),)/s"; - $replace[] = '$1' . ds_prepare_regions_configuration($regions) . '$2'; - } - - // Rewrite templates. - drush_op('ds_file_preg_replace', [$layout_path . "/$twig_machine_name.html.twig", $layout_path . "/$machine_name.inc"], $find, $replace); - - // Notify user of the newly created templates. - drush_print(dt('Templates for "@name" created in: @path', ['@name' => $name, '@path' => $layout_path])); -} - -/** - * Prepare a string for use as a valid machine name. - */ -function ds_prepare_machine_name($string) { - $machine_name = str_replace(' ', '_', Unicode::strtolower($string)); - // Remove characters not valid in function names. - $machine_name = preg_replace('/[^a-z0-9_]/', '', $machine_name); - - return $machine_name; -} - -/** - * Perform preg_replace() on the contents of an array of files. - */ -function ds_file_preg_replace($file_paths, $find, $replace) { - foreach ($file_paths as $path) { - $file_contents = file_get_contents($path); - $file_contents = preg_replace($find, $replace, $file_contents); - file_put_contents($path, $file_contents); - } -} - -/** - * Prepare HTML structure for an array of regions. - */ -function ds_prepare_regions_html($region_names) { - $output = []; - - foreach ($region_names as $name) { - $machine_name = ds_prepare_machine_name($name); - - $output[] = <<<END - <{{ \${$machine_name}_wrapper }} class="group-left{{ \${$machine_name}_classes }}"> - {% if \${$machine_name} is not null %} - {{ \${$machine_name} }} - {% endif %} - </{{ \${$machine_name}_wrapper }}> -END; - } - - return implode("\n\n", $output); -} - -/** - * Prepare variable documentation for an array of regions. - */ -function ds_prepare_regions_variable_documentation($region_names) { - $output = []; - - foreach ($region_names as $name) { - $machine_name = ds_prepare_machine_name($name); - - $output[] = <<<END - * - * - \$$machine_name: Rendered content for the "$name" region. - * - \${$machine_name}_classes: String of classes that can be used to style the "$name" region. -END; - } - - return implode("\n", $output); -} - -/** - * Prepare configuration for an array of regions. - */ -function ds_prepare_regions_configuration($region_names) { - $output = []; - - foreach ($region_names as $name) { - $machine_name = ds_prepare_machine_name($name); - $output[] = " '$machine_name' => t('$name'),"; - } - - return implode("\n", $output); -} - -/** - * Prepare styling for an array of regions. - */ -function ds_prepare_regions_css($region_names) { - $output = []; - - foreach ($region_names as $name) { - $html_class = Html::getClass($name); - - $output[] = <<<END -.ds-$html_class { - /* Styles for the "$html_class" region go here */ -} -END; - } - - return implode("\n\n", $output); -} - -/** - * Create a Display Suite plugin. - */ -function drush_ds_field($name = NULL) { - // Determine the layout name. - if (!isset($name)) { - $name = drush_get_option('name'); - } - if (!$name) { - drush_die(dt('You need to set a name for your field class')); - } - - // We assume you run this command in the root of your module - // Fetch the current path. - $current_path = drush_cwd(); - - // Fetch the module name from the path. - $parts = explode('/', $current_path); - $module_name = end($parts); - - // Class path. - $class_path = $current_path . "/src/Plugin/DsField/"; - drush_mkdir($class_path); - - // Determine the path to our example layout templates. - $ds_class_path = dirname(__FILE__); - - // Copy the example templates. - drush_op('copy', $ds_class_path . '/ExampleField.php', $class_path . "/$name.php"); - - // Prepare an array of things that need to be rewritten in our class. - $find = []; - $replace = []; - - // Replace example text. - $find[] = '/ExampleField/'; - $replace[] = $name; - $find[] = '/example_field/'; - $replace[] = $module_name; - - // Determine entity_type. - $entity_type = drush_get_option('entity'); - if ($entity_type) { - $find[] = '/entity_type = \"node\"/'; - $replace[] = 'entity_type = "' . $entity_type . '"'; - } - - // Rewrite class. - drush_op('ds_file_preg_replace', [$class_path . "/$name.php"], $find, $replace); - - // Notify user of the newly created class. - drush_print(dt('"@name" class created in: @class_path', ['@name' => $name, '@class_path' => $class_path])); -} diff --git a/web/modules/ds/drush/example_layout/README.txt b/web/modules/ds/drush/example_layout/README.txt deleted file mode 100644 index dac5329917..0000000000 --- a/web/modules/ds/drush/example_layout/README.txt +++ /dev/null @@ -1,2 +0,0 @@ -Use this example layout template and configuration as a starting point for your -own, custom Display Suite layouts. diff --git a/web/modules/ds/drush/example_layout/example-layout.html.twig b/web/modules/ds/drush/example_layout/example-layout.html.twig deleted file mode 100644 index b431fd94b6..0000000000 --- a/web/modules/ds/drush/example_layout/example-layout.html.twig +++ /dev/null @@ -1,31 +0,0 @@ -{# -/** - * @file - * Display Suite example layout template. - */ -#} -<{{ layout_wrapper }} {{ layout_attributes }} class="ds-2col {{ attributes.class }} clearfix"> - - {# Needed to activate contextual links #} - {% if title_suffix.contextual_links is not null %} - {{ title_suffix.contextual_links }} - {% endif %} - - {# regions #} - - <{{ left_wrapper }} class="group-left{{ left_classes }}"> - {% if left is not null %} - {{ left }} - {% endif %} - </{{ left_wrapper }}> - - <{{ right_wrapper }} class="group-right{{ right_classes }}"> - {% if right is not null %} - {{ right }} - {% endif %} - </{{ right_wrapper }}> - - {# These comments are required for the Drush command. You can remove them in your own copy #} - {# /regions #} - -</{{ layout_wrapper }}> diff --git a/web/modules/ds/drush/example_layout/example_layout.css b/web/modules/ds/drush/example_layout/example_layout.css deleted file mode 100644 index 77a6043473..0000000000 --- a/web/modules/ds/drush/example_layout/example_layout.css +++ /dev/null @@ -1,22 +0,0 @@ -/** - * @file - * Display Suite example layout stylesheet. - */ - -.ds-left { - width: 20%; - float: left; /* LTR */ -} - -[dir="rtl"] .ds-left { - float: right; -} - -.ds-right { - width: 80%; - float: right; /* LTR */ -} - -[dir="rtl"] .ds-right { - float: left; -} diff --git a/web/modules/ds/drush/example_layout/example_layout.inc b/web/modules/ds/drush/example_layout/example_layout.inc deleted file mode 100644 index efe6d0420b..0000000000 --- a/web/modules/ds/drush/example_layout/example_layout.inc +++ /dev/null @@ -1,23 +0,0 @@ -<?php - -/** - * @file - * Display Suite example layout configuration. - */ - -/** - * Defines a Display Suite layout. - */ -function ds_example_layout() { - return [ - 'label' => t('Example layout'), - 'regions' => [ - 'left' => t('Left'), - 'right' => t('Right'), - ], - // Uncomment if you want to include a CSS file for this layout (example_layout.css). - // 'css' => TRUE, - // Uncomment if you want to include a preview for this layout (example_layout.png). - // 'image' => TRUE, - ]; -} diff --git a/web/modules/ds/drush/example_layout/example_layout.png b/web/modules/ds/drush/example_layout/example_layout.png deleted file mode 100644 index cf953c1641..0000000000 --- a/web/modules/ds/drush/example_layout/example_layout.png +++ /dev/null @@ -1,3 +0,0 @@ -�PNG - -��� IHDR�������������$h���tEXtSoftware�Adobe ImageReadyq�e<���IDATx���Mj�@���L{qSx����˞E��4��f�c �EI3��� ������e�ݾE�T�r^���y�R�Mc,,fi)^����L��9oJ�%J����ö�)�)�$��\�orܔ��R��%9FY����J��W&�D�(A���4�o��������{�Z��g�h�I�u>�f��(A��D �D� JD �D� J%�Q"J%�Q"J%�Q�(%�Q�(A��D�(A��D�(A� JD �D� JD �D�F�(A��D�(A��D �D� JD �D� JD �Q"J%�Q"J%�Q�(%�Q�(%�D�(A��D�(A� JD �D� JD �D� J%�Q"J%�Q�(%�Q�(%�Q�(A��D�(A��D �D� JD �D� JD �Q"J%�Q"J%�Q�(%�Q�(%�D�(A��D�(A� JD �D� JD �D� J%�Q"J%�Q�(%�Q�(%�Q�(A��D�(A��D�(A� JD �D� JnL���6M��'��zm�f��(A��D �D� JD �D� J%�Q"J�H�1�����(X��px�/����sw:��m跨Mʜb�N��t>�m��8:Ó��EGscFǾ���s�a��oA����Q��0�Ֆ�Fk�%��8�˦�W�yA�X����R�������IEND�B`� \ No newline at end of file diff --git a/web/modules/ds/ds.api.php b/web/modules/ds/ds.api.php deleted file mode 100644 index 5e8b7b907d..0000000000 --- a/web/modules/ds/ds.api.php +++ /dev/null @@ -1,197 +0,0 @@ -<?php - -/** - * @file - * Hooks provided by Display Suite module. - */ - -/** - * @addtogroup hooks - * @{ - */ - -/** - * Modify the list of available ds field plugins. - * - * This hook may be used to modify plugin properties after they have been - * specified by other modules. - * - * @param array $plugins - * An array of all the existing plugin definitions, passed by reference. - * - * @see \Drupal\views\Plugin\DsPluginManager - */ -function hook_ds_fields_info_alter(array &$plugins) { - $plugins['node_title']['title'] = t('My title'); -} - -/** - * Modify the list of available ds field template plugins. - * - * This hook may be used to modify plugin properties after they have been - * specified by other modules. - * - * @param array $plugins - * An array of all the existing plugin definitions, passed by reference. - * - * @see \Drupal\views\Plugin\DsFieldTemplatePluginManager - */ -function hook_ds_field_templates_info_alter(array &$plugins) { - $plugins['expert']['title'] = t('My template'); -} - -/** - * Return configuration summary for the field format. - * - * As soon as you have hook_ds_fields and one of the fields - * has a settings key, Display Suite will call this hook for the summary. - * - * @param array $field - * The configuration of the field. - * - * @return string - * The summary to show on the Field UI. - */ -function hook_ds_field_format_summary(array $field) { - return 'Field summary'; -} - -/** - * Modify the layout settings just before they get saved. - * - * @param array $record - * The record just before it gets saved into the database. - * @param \Drupal\Core\Form\FormStateInterface $form_state - * The form_state values. - */ -function hook_ds_layout_settings_alter(array $record, \Drupal\Core\Form\FormStateInterface $form_state) { - $record['layout']['settings']['classes'] = ['layout-class']; -} - -/** - * Alter the layout render array. - * - * @param array $layout_render_array - * The render array. - * @param array $context - * An array with the context that is being rendered. Available keys are: - * - entity - * - entity_type - * - bundle - * - view_mode - * @param array $vars - * All variables available for render. You can use this to add css classes. - */ -function hook_ds_pre_render_alter(array &$layout_render_array, array $context, array &$vars) { - $layout_render_array['left'][] = ['#markup' => 'cool!', '#weight' => 20]; - $vars['attributes']['class'][] = 'custom'; -} - -/** - * Alter the region options in the field UI screen. - * - * This function is only called when a layout has been chosen. - * - * @param array $context - * A collection of keys for the context. The keys are 'entity_type', - * 'bundle' and 'view_mode'. - * @param array $region_info - * A collection of info for regions. The keys are 'region_options' - * and 'table_regions'. - */ -function hook_ds_layout_region_alter(array $context, array &$region_info) { - $region_info['region_options']['my_region'] = 'New region'; - $region_info['table_regions']['my_region'] = [ - 'title' => \Drupal\Component\Utility\Html::escape('New region'), - 'message' => t('No fields are displayed in this region'), - ]; -} - -/** - * Alter the field label options. - * - * Note that you will either update the preprocess functions or the - * field.html.twig file when adding new options. - * - * @param array $field_label_options - * A collection of field label options. - */ -function hook_ds_label_options_alter(array &$field_label_options) { - $field_label_options['label_after'] = t('Label after field'); -} - -/** - * Alter the view mode just before it's rendered by the DS views entity plugin. - * - * @param string $view_mode - * The name of the view mode. - * @param array $context - * A collection of items which can be used to identify in what - * context an entity is being rendered. The variable contains 3 keys: - * - entity: The entity being rendered. - * - view_name: the name of the view. - * - display: the name of the display of the view. - */ -function hook_ds_views_view_mode_alter(&$view_mode, array $context) { - if ($context['view_name'] == 'my_view_name') { - $view_mode = 'new_view_mode'; - } -} - -/** - * Theme an entity through an advanced function. - * - * The function is coming from the views entity plugin. - * - * @param \Drupal\Core\Entity\EntityInterface $entity - * The entity. - * @param string $view_mode - * The name of the view mode. - * - * @return array - * The rendered entity - */ -function hook_ds_views_row_render_entity(\Drupal\Core\Entity\EntityInterface $entity, $view_mode) { - $entity = Drupal\ds\Plugin\DsField\Node::load(1); - return \Drupal::entityManager()->getViewBuilder('node')->view($entity, $view_mode); -} - -/** - * Theme an entity through an advanced function. - * - * Function is coming from the views entity plugin. - * - * @param array $build - * The builded entity. - * @param array $context - * Collection of parameters (row, view and view_mode). - */ -function hook_ds_views_row_render_entity_alter(array &$build, array $context) { - // You can do whatever you want to here. - $build['data'] = [ - '#markup' => 'Sample text', - '#weight' => 20, - ]; -} - -/** - * Allow modules to provide additional classes for regions and layouts. - */ -function hook_ds_classes_alter(&$classes, $name) { - if ('ds_classes_regions' === $name) { - $classes['css-class-name'] = t('Custom Styling'); - } -} - -/** - * Allow modules to alter the operations on the dynamic field overview page. - */ -function hook_ds_field_operations_alter(&$operations, $field) { - if ($field['type'] == 'block') { - unset($operations['edit']); - } -} - -/** - * @} End of "addtogroup hooks". - */ diff --git a/web/modules/ds/ds.info.yml b/web/modules/ds/ds.info.yml deleted file mode 100644 index 08d67bb227..0000000000 --- a/web/modules/ds/ds.info.yml +++ /dev/null @@ -1,17 +0,0 @@ -type: module -name: 'Display Suite' -description: 'Extend the display options for every entity type.' -# core: 8.x -package: 'Display Suite' -configure: ds.structure -dependencies: - - drupal:layout_discovery - - drupal:system (>= 8.3.x) -test_dependencies: - - field_group:field_group - -# Information added by Drupal.org packaging script on 2017-05-24 -version: '8.x-3.1' -core: '8.x' -project: 'ds' -datestamp: 1495660091 diff --git a/web/modules/ds/ds.install b/web/modules/ds/ds.install deleted file mode 100644 index e19d285837..0000000000 --- a/web/modules/ds/ds.install +++ /dev/null @@ -1,97 +0,0 @@ -<?php - -/** - * @file - * Display Suite install file. - */ - -use Drupal\Core\Entity\Entity\EntityViewDisplay; - -/** - * Implements hook_install(). - */ -function ds_install() { - module_set_weight('ds', 1); -} - -/** - * Disable adding entity, bundle, view mode classes per display. - */ -function ds_update_8001() { - - /** @var \Drupal\Core\Entity\Display\EntityDisplayInterface $display */ - foreach (EntityViewDisplay::loadMultiple() as $display) { - $ds = $display->getThirdPartySetting('ds', 'layout'); - if (!empty($ds)) { - $ds['entity_classes'] = 'old_view_mode'; - $display - ->setThirdPartySetting('ds', 'layout', $ds) - ->save(); - } - } - -} - -/** - * Fix ds_switch being added to each content entity. - */ -function ds_update_8002() { - $entity_definition_update_manager = \Drupal::entityDefinitionUpdateManager(); - $entity_types = \Drupal::entityTypeManager()->getDefinitions(); - foreach ($entity_types as $entity_type_id => $entity_type) { - if ($entity_type->getGroup() == 'content' && $entity_type_id != 'node') { - if ($entity_definition_update_manager->getEntityType($entity_type_id)) { - $storage_definition = $entity_definition_update_manager->getFieldStorageDefinition('ds_switch', $entity_type_id); - if ($storage_definition) { - $entity_definition_update_manager->uninstallFieldStorageDefinition($storage_definition); - } - } - } - } -} - -/** - * Uninstalls Layout plugin, then enables Layout Discovery. - */ -function ds_update_8003() { - if (\Drupal::moduleHandler()->moduleExists('layout_plugin')) { - \Drupal::service('module_installer')->uninstall(['layout_plugin'], FALSE); - \Drupal::service('module_installer')->install(['layout_discovery'], FALSE); - } -} - -/** - * Makes sure Layout Discovery is enabled on update, as 8003 could have failed to do so. - */ -function ds_update_8004() { - if (!\Drupal::moduleHandler()->moduleExists('layout_discovery')) { - \Drupal::service('module_installer')->install(['layout_discovery'], FALSE); - } -} - -/** - * Fix scrambled fields in the UI - */ -function ds_update_8005() { - // Fix scrambled fields - $entity_storage = \Drupal::service('entity_type.manager')->getStorage('entity_view_display'); - /** @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface $entity_display */ - foreach($entity_storage->loadMultiple() as $entity_display) { - if ($ds_config = $entity_display->getThirdPartySettings('ds')) { - $components = $entity_display->getComponents(); - if (empty($ds_config['regions'])) { - continue; - } - foreach ($ds_config['regions'] as $region_name => $fields) { - foreach ($fields as $field_name) { - if (isset($components[$field_name])) { - $options = $components[$field_name]; - $options['region'] = $region_name; - $entity_display->setComponent($field_name, $options); - } - } - } - $entity_display->save(); - } - } -} diff --git a/web/modules/ds/ds.layouts.yml b/web/modules/ds/ds.layouts.yml deleted file mode 100644 index 5fb370e196..0000000000 --- a/web/modules/ds/ds.layouts.yml +++ /dev/null @@ -1,194 +0,0 @@ -ds_1col: - label: One column layout - category: Display Suite - class: '\Drupal\ds\Plugin\DsLayout' - type: partial - template: templates/ds-1col - icon: images/ds-1col.png - regions: - ds_content: - label: Content -ds_1col_wrapper: - label: One column layout + wrapper - category: Display Suite - class: '\Drupal\ds\Plugin\DsLayout' - type: partial - template: templates/ds-1col-wrapper - icon: images/ds-1col-wrapper.png - regions: - ds_content: - label: Content -ds_2col: - label: Two column layout - category: Display Suite - class: '\Drupal\ds\Plugin\DsLayout' - type: partial - template: templates/ds-2col - library: ds/ds_2col - icon: images/ds-2col.png - regions: - left: - label: Left - right: - label: Right -ds_2col_fluid: - label: Fluid two column layout - category: Display Suite - class: '\Drupal\ds\Plugin\DsLayout' - type: partial - template: templates/ds-2col-fluid - library: ds/ds_2col_fluid - icon: images/ds-2col-fluid.png - regions: - left: - label: Left - right: - label: Right -ds_2col_stacked: - label: Two column stacked layout - category: Display Suite - class: '\Drupal\ds\Plugin\DsLayout' - type: partial - template: templates/ds-2col-stacked - library: ds/ds_2col_stacked - icon: images/ds-2col-stacked.png - regions: - header: - label: Header - left: - label: Left - right: - label: Right - footer: - label: Footer -ds_2col_stacked_fluid: - label: Fluid two column stacked layout - category: Display Suite - class: '\Drupal\ds\Plugin\DsLayout' - type: partial - template: templates/ds-2col-stacked-fluid - library: ds/ds_2col_stacked_fluid - icon: images/ds-2col-stacked-fluid.png - regions: - header: - label: Header - left: - label: Left - right: - label: Right - footer: - label: Footer -ds_3col: - label: Three column - 25/50/25 - category: Display Suite - class: '\Drupal\ds\Plugin\DsLayout' - type: partial - template: templates/ds-3col - library: ds/ds_3col - icon: images/ds-3col.png - regions: - left: - label: Left - middle: - label: Middle - right: - label: Right -ds_3col_equal_width: - label: Three column - equal width - category: Display Suite - class: '\Drupal\ds\Plugin\DsLayout' - type: partial - template: templates/ds-3col-equal-width - library: ds/ds_3col_equal_width - icon: images/ds-3col-equal-width.png - regions: - left: - label: Left - middle: - label: Middle - right: - label: Right -ds_3col_stacked: - label: Three column stacked - 25/50/25 - category: Display Suite - class: '\Drupal\ds\Plugin\DsLayout' - type: partial - template: templates/ds-3col-stacked - library: ds/ds_3col_stacked - icon: images/ds-3col-stacked.png - regions: - header: - label: Header - left: - label: Left - middle: - label: Middle - right: - label: Right - footer: - label: Footer -ds_3col_stacked_fluid: - label: Fluid three column stacked - 25/50/25 - category: Display Suite - class: '\Drupal\ds\Plugin\DsLayout' - type: partial - template: templates/ds-3col-stacked-fluid - library: ds/ds_3col_stacked_fluid - icon: images/ds-3col-stacked-fluid.png - regions: - header: - label: Header - left: - label: Left - middle: - label: Middle - right: - label: Right - footer: - label: Footer -ds_3col_stacked_equal_width: - label: Three column stacked - equal width - category: Display Suite - class: '\Drupal\ds\Plugin\DsLayout' - type: partial - template: templates/ds-3col-stacked-equal-width - library: ds/ds_3col_stacked_equal_width - icon: images/ds-3col-stacked-equal-width.png - regions: - header: - label: Header - left: - label: Left - middle: - label: Middle - right: - label: Right - footer: - label: Footer -ds_4col: - label: Four column - equal width - category: Display Suite - class: '\Drupal\ds\Plugin\DsLayout' - type: partial - template: templates/ds-4col - library: ds/ds_4col - icon: images/ds-4col.png - regions: - first: - label: First - second: - label: Second - third: - label: Third - fourth: - label: Fourth -ds_reset: - label: Reset layout - category: Display Suite - class: '\Drupal\ds\Plugin\DsLayout' - type: partial - template: templates/ds-reset - image: images/ds-reset.png - regions: - ds_content: - label: Content diff --git a/web/modules/ds/ds.libraries.yml b/web/modules/ds/ds.libraries.yml deleted file mode 100644 index 7137935f97..0000000000 --- a/web/modules/ds/ds.libraries.yml +++ /dev/null @@ -1,61 +0,0 @@ -admin: - version: VERSION - js: - js/ds.admin.js: {} - css: - theme: - css/ds.admin.css: {} - dependencies: - - core/jquery - - core/drupal - - core/drupal.form -ds_2col: - version: VERSION - css: - theme: - css/ds-2col.css: {} -ds_2col_fluid: - version: VERSION - css: - theme: - css/ds-2col-fluid.css: {} -ds_2col_stacked: - version: VERSION - css: - theme: - css/ds-2col-stacked.css: {} -ds_2col_stacked_fluid: - version: VERSION - css: - theme: - css/ds-2col-stacked-fluid.css: {} -ds_3col: - version: VERSION - css: - theme: - css/ds-3col.css: {} -ds_3col_equal_width: - version: VERSION - css: - theme: - css/ds-3col-equal-width.css: {} -ds_3col_stacked: - version: VERSION - css: - theme: - css/ds-3col-stacked.css: {} -ds_3col_stacked_fluid: - version: VERSION - css: - theme: - css/ds-3col-stacked-fluid.css: {} -ds_3col_stacked_equal_width: - version: VERSION - css: - theme: - css/ds-3col-stacked-equal-width.css: {} -ds_4col: - version: VERSION - css: - theme: - css/ds-4col.css: {} diff --git a/web/modules/ds/ds.links.action.yml b/web/modules/ds/ds.links.action.yml deleted file mode 100644 index 026360cb7e..0000000000 --- a/web/modules/ds/ds.links.action.yml +++ /dev/null @@ -1,15 +0,0 @@ -ds.block_field_add_local_action: - route_name: ds.add_block_field - title: 'Add a block field' - appears_on: - - ds.fields_list -ds.token_field_add_local_action: - route_name: ds.add_token_field - title: 'Add a token field' - appears_on: - - ds.fields_list -ds.copy_field_add_local_action: - route_name: ds.add_copy_field - title: 'Create a copy of a Display Suite field' - appears_on: - - ds.fields_list diff --git a/web/modules/ds/ds.links.menu.yml b/web/modules/ds/ds.links.menu.yml deleted file mode 100644 index 7fafbb91fd..0000000000 --- a/web/modules/ds/ds.links.menu.yml +++ /dev/null @@ -1,5 +0,0 @@ -ds.overview: - title: 'Display Suite' - description: 'Manage layouts for entities and configure fields etc.' - route_name: ds.structure - parent: system.admin_structure diff --git a/web/modules/ds/ds.links.task.yml b/web/modules/ds/ds.links.task.yml deleted file mode 100644 index b49d2ea5ba..0000000000 --- a/web/modules/ds/ds.links.task.yml +++ /dev/null @@ -1,48 +0,0 @@ -ds.display_task: - route_name: ds.structure - title: Displays - base_route: ds.display_task - weight: 0 -ds.list_task: - route_name: ds.structure - title: List - parent_id: ds.display_task - weight: 5 -ds.settings_task: - route_name: ds.admin_settings - title: Settings - parent_id: ds.display_task - weight: 10 -ds.emergency_task: - route_name: ds.admin_emergency - title: Emergency - parent_id: ds.display_task - weight: 100 -ds.classes_task: - route_name: ds.classes - title: Classes - base_route: ds.display_task - weight: 1 -ds.fields_task: - route_name: ds.fields_list - title: Fields - base_route: ds.display_task - weight: 2 -ds.entities: - class: \Drupal\Core\Menu\LocalTaskDefault - deriver: \Drupal\ds\Plugin\Derivative\DsLocalTask -ds.manage_block_field_task: - route_name: ds.manage_block_field - title: Edit - base_route: ds.manage_block_field_task - weight: 0 -ds.manage_block_field_config_task: - route_name: ds.manage_block_field_config - title: Configure block - base_route: ds.manage_block_field_task - weight: 1 -ds.delete_field_task: - route_name: ds.delete_field - title: Delete - base_route: ds.manage_block_field_task - weight: 2 diff --git a/web/modules/ds/ds.module b/web/modules/ds/ds.module deleted file mode 100644 index 8dc1de5df2..0000000000 --- a/web/modules/ds/ds.module +++ /dev/null @@ -1,1116 +0,0 @@ -<?php - -/** - * @file - * Display Suite core functions. - */ - -use Drupal\Component\Utility\Html; -use Drupal\Component\Utility\Xss; -use Drupal\Core\Cache\CacheableMetadata; -use Drupal\Core\Entity\Display\EntityDisplayInterface; -use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Field\FieldConfigInterface; -use Drupal\Core\Field\FieldDefinitionInterface; -use Drupal\Core\Field\FormatterInterface; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Render\Element; -use Drupal\Core\Routing\RouteMatchInterface; -use Drupal\Core\Template\Attribute; -use Drupal\Core\Url; -use Drupal\ds\Ds; -use Drupal\ds\DsAttribute; -use Drupal\ds\Plugin\DsLayout; -use Drupal\field\Entity\FieldConfig; - -/** - * Implements hook_help(). - */ -function ds_help($route_name, RouteMatchInterface $route_match) { - switch ($route_name) { - case 'help.page.ds': - $output = ''; - $output .= '<h3>' . t('About') . '</h3>'; - $output .= '<br/>' . t('The <a href=":link">Display Suite</a> module allows you to take full control over how your content is displayed using a drag and drop interface. Arrange your nodes, views, comments, user data etc. the way you want without having to work your way through dozens of template files.', [':link' => 'https://www.drupal.org/project/ds']); - $output .= '<br/>' . t('It allows you to apply theme templates to content type displays. It comes with predefined layouts such as "two columns", "three columns stacked", "three columns fluid" et cetera, but also lets you define your own.'); - $output .= '<br/>' . t('Display Suite allows you to create fields from tokens or blocks. This gives you full control over the way content is displayed without having to maintain dozens of twig files.'); - $output .= '<br/>' . t('More documentation about Display Suite in Drupal 8 can be found in Drupal\'s <a href=":documentation">Community Documentation </a>.', [':documentation' => 'https://www.drupal.org/node/2718943']); - return $output; - } -} - -/** - * Implements hook_theme(). - */ -function ds_theme() { - $theme_functions = []; - - $theme_functions['ds_entity_view'] = [ - 'render element' => 'content', - ]; - - // Field templates. - if (\Drupal::config('ds.settings')->get('field_template')) { - $field_layouts = \Drupal::service('plugin.manager.ds.field.layout')->getDefinitions(); - foreach ($field_layouts as $key => $plugin) { - if ($key != 'default') { - $theme_functions['field__' . $plugin['theme']] = [ - 'render element' => 'elements', - 'template' => strtr($plugin['theme'], '_', '-'), - 'base hook' => 'field', - 'path' => drupal_get_path('module', $plugin['provider']) . '/templates', - ]; - - if (!empty($plugin['path'])) { - $theme_functions['field__' . $plugin['theme']]['file'] = $plugin['path']; - } - } - } - } - - return $theme_functions; -} - -/** - * Implements hook_theme_registry_alter(). - */ -function ds_theme_registry_alter(&$theme_registry) { - $layouts = Ds::getLayouts(); - $layout_theme_hooks = []; - /** @var \Drupal\Core\Layout\LayoutDefinition $info */ - foreach ($layouts as $info) { - if (is_a($info->getClass(), DsLayout::class, TRUE)) { - $layout_theme_hooks[$info->getThemeHook()] = 'layout'; - } - } - - // Only add preprocess functions if entity exposes theme function, and this - // layout is using the Display Suite layout class. - foreach ($theme_registry as $theme_hook => $info) { - if (array_key_exists($theme_hook, $layout_theme_hooks) || (!empty($info['base hook']) && array_key_exists($info['base hook'], $layout_theme_hooks))) { - - // @todo Remove once https://www.drupal.org/node/2861840 is resolved. - if (!in_array('template_preprocess_layout', $theme_registry[$theme_hook]['preprocess functions'])) { - $theme_registry[$theme_hook]['preprocess functions'][] = 'template_preprocess_layout'; - } - - $theme_registry[$theme_hook]['preprocess functions'][] = 'ds_preprocess_ds_layout'; - } - } - - // Check preprocess functions for ds fields. - $field_theme_hooks = []; - if (\Drupal::config('ds.settings')->get('field_template')) { - $field_layouts = \Drupal::service('plugin.manager.ds.field.layout') - ->getDefinitions(); - foreach ($field_layouts as $key => $plugin) { - if ($key != 'default') { - - // Get the hook name. - $hook_field_name = 'field__' . $plugin['theme']; - - if (isset($theme_registry[$hook_field_name])) { - - // Store for suggestions later. - $field_theme_hooks[$hook_field_name] = 'field'; - - // Variable holding the preprocess functions to add later. - $preprocess_functions_to_add = []; - - // Overrides don't get the template_preprocess_field function. - if (!in_array('template_preprocess_field', $theme_registry[$hook_field_name]['preprocess functions'])) { - $preprocess_functions_to_add[] = 'template_preprocess_field'; - } - - // Overrides don't get the ds_preprocess_field function. - if (!in_array('ds_preprocess_field', $theme_registry[$hook_field_name]['preprocess functions'])) { - $preprocess_functions_to_add[] = 'ds_preprocess_field'; - } - - // We need to make sure the function runs asap as the dedicated field - // preprocess function might need ds information, e.g. - // template_preprocess_field__ds_field_expert(). - // template_preprocess() will be available, so put them right after. - if (!empty($preprocess_functions_to_add)) { - $preprocess_functions = $theme_registry[$hook_field_name]['preprocess functions']; - array_splice($preprocess_functions, 1, 0, $preprocess_functions_to_add); - $theme_registry[$hook_field_name]['preprocess functions'] = $preprocess_functions; - } - } - } - } - } - - // ------------------------------------------------------------------------ - // Workaround to get theme suggestions working for templates using the - // the Display Suite class. It's borderline insane, but gets the job done. - // - // Note that this currently only works for Twig, but I assume, there isn't - // any other engine out there yet for Drupal 8. - // - // Code based on drupal_find_theme_templates(). - // - // @see - // - https://www.drupal.org/node/2862683 (core queue) - // - https://www.drupal.org/node/2802429 (DS queue) - // (and maybe others) - // ------------------------------------------------------------------------ - - // Merge layout and field hooks. - $all_ds_theme_hooks = $layout_theme_hooks + $field_theme_hooks; - - $engine = \Drupal::theme()->getActiveTheme()->getEngine(); - if ($engine == 'twig') { - - $extension = '.html.twig'; - $theme_path = \Drupal::theme()->getActiveTheme()->getPath(); - - // Escape the periods in the extension. - $regex = '/' . str_replace('.', '\.', $extension) . '$/'; - // Get a listing of all template files in the path to search. - $files = file_scan_directory($theme_path, $regex, ['key' => 'filename']); - $patterns = array_keys($files); - $implementations = []; - - foreach ($all_ds_theme_hooks as $hook => $base_hook) { - - // Ignored if not registered (which would be weird). - if (!isset($theme_registry[$hook])) { - continue; - } - - $pattern = isset($info['pattern']) ? $info['pattern'] : ($hook . '__'); - if (!empty($pattern)) { - // Transform _ in pattern to - to match file naming scheme - // for the purposes of searching. - $pattern = strtr($pattern, '_', '-'); - - $matches = preg_grep('/^' . $pattern . '/', $patterns); - if ($matches) { - foreach ($matches as $match) { - $file = $match; - // Remove the extension from the filename. - $file = str_replace($extension, '', $file); - // Put the underscores back in for the hook name and register this - // pattern. - $info = $theme_registry[$hook]; - $arg_name = isset($info['variables']) ? 'variables' : 'render element'; - $new_hook = strtr($file, '-', '_'); - $implementations[$new_hook] = [ - 'template' => $file, - 'path' => dirname($files[$match]->uri), - $arg_name => $info[$arg_name], - 'base hook' => $base_hook, - 'type' => 'theme_engine', - 'theme path' => $theme_path, - ]; - if (isset($theme_registry[$hook]['preprocess functions'])) { - $implementations[$new_hook]['preprocess functions'] = $theme_registry[$hook]['preprocess functions']; - } - } - } - } - } - - if (!empty($implementations)) { - $theme_registry += $implementations; - } - } - - // ------------------------------------------------------------------------ - // End of workaround, hopefully we can kill this one day. - // ------------------------------------------------------------------------ - - // Run field group preprocess before ds_entity_view. - if (function_exists('field_group_build_entity_groups')) { - array_unshift($theme_registry['ds_entity_view']['preprocess functions'], 'field_group_build_entity_groups'); - } - - // Remove ds_preprocess_field in case field templates is not enabled. - if (!\Drupal::config('ds.settings')->get('field_template')) { - $key = array_search('ds_preprocess_field', $theme_registry['field']['preprocess functions']); - if (!empty($key)) { - unset($theme_registry['field']['preprocess functions'][$key]); - } - } -} - -/** - * Implements hook_form_alter(). - */ -function ds_form_entity_view_display_edit_form_alter(&$form, FormStateInterface $form_state) { - $form_state->loadInclude('ds', 'inc', 'includes/field_ui'); - // Also load admin on behalf of DS extras when enabled. - if (\Drupal::moduleHandler()->moduleExists('ds_extras')) { - $form_state->loadInclude('ds_extras', 'inc', 'includes/admin'); - } - ds_field_ui_fields_layouts($form, $form_state); -} - -/** - * Implements hook_module_implements_alter(). - */ -function ds_module_implements_alter(&$implementations, $hook) { - // node_entity_view_display_alter() disables all labels on all fields - // when the view mode is 'search_index'. If you set display modes for - // this view mode by hand, then the hook isn't needed. Since this - // may be called dozens of times on some pages, it's worth disabling it. - if ($hook == 'entity_view_display_alter') { - unset($implementations['node']); - } - - // Because it's possible to turn on/off field templates, - // we'll unset hooks here so ds_preprocess_field() doesn't run. - $ft_hooks = [ - 'form_ds_classes_form_alter', - 'form_field_ui_field_edit_form_alter', - ]; - if (!\Drupal::config('ds.settings')->get('field_template') && in_array($hook, $ft_hooks)) { - unset($implementations['ds']); - } -} - -/** - * Implements hook_entity_view_alter(). - */ -function ds_entity_view_alter(&$build, EntityInterface $entity, EntityDisplayInterface $display) { - static $field_permissions = FALSE; - static $loaded = FALSE; - - $entity_type = $entity->getEntityTypeId(); - $bundle = $entity->bundle(); - $view_mode = $display->getMode(); - - // Add extra metadata needed for contextual links. - if (isset($build['#contextual_links'][$entity_type])) { - $build['#contextual_links'][$entity_type]['metadata']['ds_bundle'] = $bundle; - $build['#contextual_links'][$entity_type]['metadata']['ds_view_mode'] = $view_mode; - } - - // If no layout is configured, stop executing. - if (!$display->getThirdPartySetting('ds', 'layout')) { - return; - } - - // If Display Suite is disabled, stop here. - if (Ds::isDisabled()) { - return; - } - - // Load field permissions and layouts only once. - if (!$loaded) { - $loaded = TRUE; - $field_permissions = \Drupal::config('ds_extras.settings')->get('field_permissions'); - } - - // Get configuration. - $configuration = $display->getThirdPartySettings('ds'); - - // Put #entity_type, #bundle and #layout on the build so we can access it in - // ds_entity_variables(). - $build['#entity_type'] = $entity_type; - $build['#bundle'] = $bundle; - $build['#ds_configuration'] = $configuration; - $build['#entity'] = $entity; - - // Implement UI limit. - $components = $display->getComponents(); - foreach ($components as $field => $component) { - if (isset($component['third_party_settings']['ds']) && !empty($component['third_party_settings']['ds']['ds_limit'])) { - $limit = $component['third_party_settings']['ds']['ds_limit']; - if (isset($build[$field]) && isset($build[$field]['#items'])) { - if ($limit === 'delta' && isset($entity->ds_delta) && isset($entity->ds_delta[$field])) { - $delta = $entity->ds_delta[$field]; - $filtered_elements = Element::children($build['field']); - foreach ($filtered_elements as $filtered_element) { - if ($filtered_element != $delta) { - unset($build[$field][$filtered_element]); - } - } - } - else { - $filtered_elements = Element::children($build[$field]); - $filtered_elements = array_slice($filtered_elements, $limit); - foreach ($filtered_elements as $filtered_element) { - unset($build[$field][$filtered_element]); - } - } - } - } - } - - // Add Display Suite fields. - $fields = Ds::getFields($entity_type); - $field_values = !empty($configuration['fields']) ? $configuration['fields'] : []; - - foreach ($configuration['regions'] as $region) { - foreach ($region as $weight => $key) { - // Ignore if this field is not a DS field, just pull it in from the - // entity. - if (!isset($fields[$key])) { - continue; - } - - $field = $fields[$key]; - if (isset($field_values[$key]['formatter'])) { - $field['formatter'] = $field_values[$key]['formatter']; - } - - if (isset($field_values[$key]['settings'])) { - $field['settings'] = $field_values[$key]['settings']; - } - - /* @var $field_instance \Drupal\ds\Plugin\DsField\DsFieldInterface */ - $field_instance = Ds::getFieldInstance($key, $field, $entity, $view_mode, $display, $build); - $field_value = $field_instance->build(); - $field_title = $field_instance->getTitle(); - - // If the field value is cache data then we presume the value was empty - // and we just have cache data as to why it's empty. - if ($field_value instanceof CacheableMetadata) { - CacheableMetadata::createFromRenderArray($build) - ->merge($field_value) - ->applyTo($build); - } - // Only allow non empty fields. - elseif (!empty($field_value)) { - $build[$key] = [ - '#theme' => 'field', - '#field_type' => 'ds', - '#title' => $field_title, - '#weight' => isset($field_values[$key]['weight']) ? $field_values[$key]['weight'] : $weight, - '#label_display' => isset($field_values[$key]['label']) ? $field_values[$key]['label'] : 'inline', - '#field_name' => $key, - '#bundle' => $bundle, - '#object' => $entity, - '#entity_type' => $entity_type, - '#view_mode' => '_custom', - '#ds_view_mode' => $view_mode, - '#items' => [(object) ['_attributes' => []]], - '#is_multiple' => $field_instance->isMultiple(), - '#access' => ($field_permissions && function_exists('ds_extras_ds_field_access')) ? ds_extras_ds_field_access($key, $entity_type) : TRUE, - '#formatter' => 'ds_field', - ]; - - if ($field_instance->isMultiple()) { - $build[$key] += $field_value; - } - else { - $build[$key][0] = [$field_value]; - } - } - } - } - - // Defer to ds_entity_view theme hook to actually render the layout. - $build['#theme'] = 'ds_entity_view'; -} - -/** - * Process entity view. - */ -function template_preprocess_ds_entity_view(&$variables) { - $build = $variables['content']; - $configuration = $build['#ds_configuration']; - - // Process the render array so we can reuse it. - // Don't add/override the cache key if there aren't any. - if (!empty($build['#cache']['keys'])) { - $build['#cache']['keys'][0] = 'ds_entity_view'; - } - unset($build['#theme']); - unset($build['#pre_render']); - unset($build['#sorted']); - unset($build['#children']); - unset($build['#render_children']); - unset($build['#prefix']); - unset($build['#suffix']); - unset($build['#attached']['html_head_link']); - - // Create region variables based on the layout settings. - $use_field_names = \Drupal::config('ds.settings')->get('use_field_names'); - $regions = []; - foreach (array_keys($configuration['regions']) as $region_name) { - $regions[$region_name] = []; - - // Create the region content. - if (!empty($configuration['regions'][$region_name])) { - foreach ($configuration['regions'][$region_name] as $key => $field) { - // Make sure the field exists. - if (!isset($build[$field])) { - continue; - } - if (!isset($build[$field]['#weight'])) { - $build[$field]['#weight'] = $key; - } - - if ($use_field_names) { - $regions[$region_name][$field] = $build[$field]; - } - else { - $regions[$region_name][$key] = $build[$field]; - } - } - } - } - - /* @var \Drupal\layout_plugin\Plugin\Layout\LayoutInterface $layout */ - $layout = \Drupal::service('plugin.manager.core.layout')->createInstance($configuration['layout']['id'], $configuration['layout']['settings']); - $build = array_merge($build, $layout->build($regions)); - - // Disable CSS files when needed. - if ($build['#ds_configuration']['layout']['disable_css']) { - $library = $build['#ds_configuration']['layout']['library']; - $attached = $build['#attached']['library']; - - $index = array_search($library, $attached); - unset($build['#attached']['library'][$index]); - } - - $variables['content'] = $build; -} - -/** - * Process layout. - * - * This function is added in ds_theme_registry_alter(). - */ -function ds_preprocess_ds_layout(&$variables) { - $layout_settings = $variables['settings']; - - // Fetch the entity type. - $bundle = FALSE; - $entity_type_id = FALSE; - if (isset($variables['content']['#entity_type'])) { - $entity_type_id = $variables['content']['#entity_type']; - } - if (isset($variables['content']['#bundle'])) { - $bundle = $variables['content']['#bundle']; - } - - // Template layout. - if (!isset($variables['attributes']['class'])) { - $variables['attributes']['class'] = []; - } - - // If the layout has wrapper class lets add it. - if (!empty($layout_settings['classes']['layout_class'])) { - foreach ($layout_settings['classes']['layout_class'] as $layout_class) { - $variables['attributes']['class'][] = $layout_class; - } - } - - // Create region variables based on the layout settings. - foreach ($layout_settings['wrappers'] as $region_name => $wrapper) { - // @todo remove from D9, This is deprecated - $variables[$region_name . '_classes'] = !empty($layout_settings['classes'][$region_name]) ? ' ' . implode(' ', $layout_settings['classes'][$region_name]) : ''; - // The new way of doing stuff is creating an attributes object. - if (!empty($layout_settings['classes'][$region_name])) { - $variables[$region_name . '_attributes'] = new Attribute(['class' => $layout_settings['classes'][$region_name]]); - } - else { - $variables[$region_name . '_attributes'] = new Attribute(); - } - $variables[$region_name . '_wrapper'] = !empty($layout_settings['wrappers'][$region_name]) ? $layout_settings['wrappers'][$region_name] : 'div'; - } - - // Add a layout wrapper. - $variables['outer_wrapper'] = isset($layout_settings['outer_wrapper']) ? $layout_settings['outer_wrapper'] : 'div'; - - // Add custom attributes if any. - if (!empty($layout_settings['attributes'])) { - $layout_attributes = explode(',', $layout_settings['attributes']); - foreach ($layout_attributes as $layout_attribute) { - $replaced_attribute = $layout_attribute; - if (strpos($layout_attribute, '|') !== FALSE) { - if (isset($entity_type_id)) { - $replaced_attribute = \Drupal::service('token')->replace( - $layout_attribute, - [$variables['content']['#entity_type'] => $variables['content']['#' . $entity_type_id]], - ['clear' => TRUE] - ); - } - list($key, $attribute_value) = explode('|', $replaced_attribute); - $variables['attributes'][$key] = $attribute_value; - } - } - } - - // Add an onclick attribute on the wrapper. - if (!empty($layout_settings['link_attribute'])) { - $url = ''; - switch ($layout_settings['link_attribute']) { - case 'content': - if ($entity_type_id) { - $url = $variables['content']['#' . $entity_type_id]->toUrl()->getInternalPath(); - } - break; - - case 'custom': - $url = $layout_settings['link_custom']; - break; - - case 'tokens': - if ($entity_type_id) { - $url = \Drupal::service('token')->replace($layout_settings['link_custom'], [$entity_type_id => $variables['content']['#' . $entity_type_id]], ['clear' => TRUE]); - } - break; - } - - if (!empty($url)) { - $url = Url::fromUri('internal:/' . $url); - $variables['attributes']['onclick'] = 'location.href=\'' . $url->toString() . '\''; - } - } - - if ($entity_type_id) { - if (isset($variables['content']['#ds_configuration'])) { - - // Add theming-classes to template. - $entity_classes = !empty($variables['content']['#ds_configuration']['layout']['entity_classes']) ? $variables['content']['#ds_configuration']['layout']['entity_classes'] : 'old_view_mode'; - if ($entity_classes != 'no_classes') { - if ($entity_classes == 'all_classes') { - $variables['attributes']['class'][] = Html::cleanCssIdentifier($entity_type_id); - $variables['attributes']['class'][] = Html::cleanCssIdentifier($entity_type_id) . '--type-' . Html::cleanCssIdentifier($bundle); - $variables['attributes']['class'][] = Html::cleanCssIdentifier($entity_type_id) . '--view-mode-' . Html::cleanCssIdentifier($variables['content']['#view_mode']); - } - elseif ($entity_classes == 'old_view_mode') { - // Add (old style, non cleaned) view-mode-{name} to classes. - if (!in_array('view-mode-' . $variables['content']['#view_mode'], $variables['attributes']['class'])) { - $variables['attributes']['class'][] = 'view-mode-' . $variables['content']['#view_mode']; - } - } - } - - // RDF support. - if ($entity_type_id == 'node' && function_exists('rdf_preprocess_node')) { - $entity = isset($variables[$entity_type_id]) ? $variables[$entity_type_id] : (isset($variables['content']['#' . $entity_type_id]) ? $variables['content']['#' . $entity_type_id] : ''); - if ($entity) { - $variables['node'] = $entity; - // We disable the date feature for now as it throws notices. - $variables['display_submitted'] = FALSE; - rdf_preprocess_node($variables); - } - } - - // Let other modules know we have rendered. - $variables['rendered_by_ds'] = TRUE; - - // Let other modules alter the ds array before rendering. - $context = [ - 'entity' => NULL, - 'entity_type' => $variables['content']['#entity_type'], - 'bundle' => $variables['content']['#bundle'], - 'view_mode' => $variables['content']['#view_mode'], - ]; - - // Special case for User entity, becase $variables['user'] contains the currently logged in user - if($entity_type_id !== 'user' && isset($variables[$entity_type_id])) { - $context['entity'] = $variables[$entity_type_id]; - } - elseif (isset($variables['content']['#' . $entity_type_id])) { - $context['entity'] = $variables['content']['#' . $entity_type_id]; - } - - \Drupal::moduleHandler()->alter('ds_pre_render', $variables['content'], $context, $variables); - } - } - - // Copy the regions from 'content' into the top-level. - foreach (Element::children($variables['content']) as $name) { - $variables[$name] = $variables['content'][$name]; - } - - // Copy entity to top level to improve theme experience. - if (isset($variables['content']['#entity'])) { - $variables[$variables['content']['#entity_type']] = $variables['content']['#entity']; - } -} - -/** - * Implements hook_theme_suggestions_alter(). - */ -function ds_theme_suggestions_alter(&$suggestions, $variables, $base_theme_hook) { - if (isset($variables['content']) && is_array($variables['content']) && isset($variables['content']['#ds_configuration']) && $base_theme_hook != 'ds_entity_view') { - $layout_id = $variables['content']['#ds_configuration']['layout']['id']; - $entity_id = $variables['content']['#' . $variables['content']['#entity_type']]->id(); - $suggestions[] = $layout_id . '__' . $variables['content']['#entity_type']; - $suggestions[] = $layout_id . '__' . $variables['content']['#entity_type'] . '_' . $variables['content']['#view_mode']; - $suggestions[] = $layout_id . '__' . $variables['content']['#entity_type'] . '_' . $variables['content']['#bundle']; - $suggestions[] = $layout_id . '__' . $variables['content']['#entity_type'] . '_' . $variables['content']['#bundle'] . '_' . $variables['content']['#view_mode']; - $suggestions[] = $layout_id . '__' . $variables['content']['#entity_type'] . '__' . $entity_id; - } -} - -/** - * Implements hook_contextual_links_view_alter(). - */ -function ds_contextual_links_view_alter(&$element, $items) { - $def = \Drupal::service('entity.manager')->getDefinitions(); - $entity_type = array_keys($element['#contextual_links'])[0]; - - if (isset($def[$entity_type]) && $def[$entity_type]->get('field_ui_base_route')) { - if (!empty($entity_type) && \Drupal::moduleHandler()->moduleExists('field_ui') && \Drupal::currentUser()->hasPermission('administer node display')) { - - // This might not exist (especially in panels environments). - if (!isset($element['#contextual_links'][$entity_type]['metadata']['ds_bundle'])) { - return; - } - - $bundle = $element['#contextual_links'][$entity_type]['metadata']['ds_bundle']; - $view_mode = $element['#contextual_links'][$entity_type]['metadata']['ds_view_mode']; - - $route_name = "entity.entity_view_display.$entity_type.view_mode"; - $type = $def[$entity_type]->getBundleEntityType(); - $route_params = [ - $type => $bundle, - 'view_mode_name' => $view_mode, - ]; - - $url = new Url($route_name, $route_params); - - $destination = \Drupal::destination()->getAsArray(); - $url->setOption('query', $destination); - - // When there is no bundle defined, return. - if (!empty($bundle)) { - $element['#links']['manage-display'] = [ - 'title' => t('Manage display'), - 'url' => $url, - ]; - } - } - } -} - -/** - * Implements hook_local_tasks_alter(). - */ -function ds_local_tasks_alter(&$local_tasks) { - if (!\Drupal::moduleHandler()->moduleExists('contextual') || !\Drupal::moduleHandler()->moduleExists('field_ui')) { - unset($local_tasks['ds.manage_node_display']); - unset($local_tasks['ds.manage_user_display']); - unset($local_tasks['ds.manage_taxonomy_term_display']); - } -} - -/** - * Implements hook_preprocess_field(). - */ -function ds_preprocess_field(&$variables) { - $entity_type = $variables['element']['#entity_type']; - $bundle = $variables['element']['#bundle']; - $view_mode = isset($variables['element']['#ds_view_mode']) ? $variables['element']['#ds_view_mode'] : $variables['element']['#view_mode']; - - /* @var $entity_display EntityDisplayInterface */ - $entity_display = Ds::getDisplay($entity_type, $bundle, $view_mode); - if ($entity_display && $entity_display->getThirdPartySetting('ds', 'layout')) { - - // Get the field name and field instance info - if available. - $field_name = $variables['element']['#field_name']; - - $config = []; - static $field_settings = []; - if (!isset($field_settings[$entity_type][$bundle][$view_mode])) { - $f = []; - - // Get third party settings for Core fields. - foreach ($entity_display->getComponents() as $key => $info) { - if (!empty($info['third_party_settings']['ds']['ft'])) { - $f[$key]['ft'] = $info['third_party_settings']['ds']['ft']; - } - } - - // Get third party settings for Display Suite fields. - $ds_fields_third_party_settings = $entity_display->getThirdPartySetting('ds', 'fields'); - if ($ds_fields_third_party_settings) { - $f += $entity_display->getThirdPartySetting('ds', 'fields'); - } - - $field_settings[$entity_type][$bundle][$view_mode] = $f; - } - - // Check if this field has custom output settings. - $variables['ds-config'] = []; - if (isset($field_settings[$entity_type][$bundle][$view_mode][$field_name]['ft'])) { - $config = $field_settings[$entity_type][$bundle][$view_mode][$field_name]['ft']; - $variables['ds-config'] = $config; - - // When dealing with a field template we need to massage to values before - // printing to prevent layout issues. - if (isset($config['id']) && $config['id'] != 'default' && !empty($variables['ds-config']['settings'])) { - /* @var \Drupal\ds\Plugin\DsFieldTemplate\DsFieldTemplateInterface $layout_instance */ - $layout_instance = \Drupal::service('plugin.manager.ds.field.layout')->createInstance($config['id']); - if (isset($variables['element']['#object'])) { - $layout_instance->setEntity($variables['element']['#object']); - } - $layout_instance->massageRenderValues($variables['ds-config']['settings'], $config['settings']); - } - } - - // CSS classes. - if (isset($config['settings']['classes'])) { - foreach ($config['settings']['classes'] as $class_name) { - if (isset($variables['element']['#object'])) { - $class_name = \Drupal::token()->replace( - $class_name, - [$entity_type => $variables['element']['#object']], - ['clear' => TRUE] - ); - } - $variables['attributes']['class'][] = $class_name; - } - } - - // Alter the label if configured. - if (!$variables['label_hidden']) { - if (!empty($config['settings']['lb'])) { - $variables['label'] = t(Html::escape($config['settings']['lb'])); - } - } - } -} - -/** - * Implements hook_theme_suggestions_HOOK_alter(). - * - * The suggestion alters for for field templates. - */ -function ds_theme_suggestions_field_alter(&$suggestions, $variables) { - $entity_type = $variables['element']['#entity_type']; - $bundle = $variables['element']['#bundle']; - $view_mode = isset($variables['element']['#ds_view_mode']) ? $variables['element']['#ds_view_mode'] : $variables['element']['#view_mode']; - - /* @var $entity_display EntityDisplayInterface */ - $entity_display = Ds::getDisplay($entity_type, $bundle, $view_mode); - if ($entity_display && $entity_display->getThirdPartySetting('ds', 'layout')) { - - // Get the field name and field instance info - if available. - $field_name = $variables['element']['#field_name']; - - $field_theme_function = \Drupal::config('ds.settings')->get('ft-default'); - static $field_settings = []; - if (!isset($field_settings[$entity_type][$bundle][$view_mode])) { - - $f = []; - - // Get third party settings for Core fields. - foreach ($entity_display->getComponents() as $key => $info) { - if (!empty($info['third_party_settings']['ds']['ft'])) { - $f[$key]['ft'] = $info['third_party_settings']['ds']['ft']; - } - } - - // Get third party settings for Display Suite fields. - $ds_fields_third_party_settings = $entity_display->getThirdPartySetting('ds', 'fields'); - if ($ds_fields_third_party_settings) { - $f += $entity_display->getThirdPartySetting('ds', 'fields'); - } - - $field_settings[$entity_type][$bundle][$view_mode] = $f; - } - - $field = FieldConfig::loadByName($entity_type, $bundle, $field_name); - - // Check if this field has custom output settings. - $config = []; - if (isset($field_settings[$entity_type][$bundle][$view_mode][$field_name]['ft'])) { - $config = $field_settings[$entity_type][$bundle][$view_mode][$field_name]['ft']; - } - - // Initialize suggestion name. - $suggestion = ''; - - // Determine the field template. In case it's something different. - if (isset($config['id']) && $config['id'] != 'default') { - $layout_instance = \Drupal::service('plugin.manager.ds.field.layout')->createInstance($config['id']); - - // Either it uses the function. - $suggestions[] = 'field__' . $layout_instance->getThemeFunction(); - - // Or the template file(s). - $suggestion = 'field__' . $config['id']; - } - // Check if we have a default field template on field level. - elseif ($field instanceof FieldConfigInterface && ($theme_function = $field->getThirdPartySetting('ds', 'ds_field_template', '')) && !empty($theme_function)) { - // Either it uses the function. - $suggestions[] = 'field__theme_ds_field_' . $theme_function; - - // Or the template file(s). - $suggestion = 'field__' . $theme_function; - } - elseif (!empty($field_theme_function)) { - $suggestions[] = 'field__theme_ds_field_' . $field_theme_function; - - // Or the template file(s). - $suggestion = 'field__' . $field_theme_function; - } - - if (!empty($suggestion)) { - $suggestions[] = $suggestion; - $suggestions[] = $suggestion . '__' . $field_name; - $suggestions[] = $suggestion . '__' . $variables['element']['#bundle']; - $suggestions[] = $suggestion . '__' . $field_name . '__' . $variables['element']['#bundle']; - $suggestions[] = $suggestion . '__' . $variables['element']['#entity_type'] . '__' . $field_name; - $suggestions[] = $suggestion . '__' . $variables['element']['#entity_type'] . '__' . $variables['element']['#bundle']; - $suggestions[] = $suggestion . '__' . $variables['element']['#entity_type'] . '__' . $field_name . '__' . $variables['element']['#bundle']; - } - - // Custom DS fields name may contain colon separators or dashes; replace it - // with "__" or "_" to ensure suggestions are compatible with file names on - // all systems. - foreach ($suggestions as $key => $suggestion) { - $suggestions[$key] = str_replace([':', '-'], ['__', '_'], $suggestion); - } - } -} - -/** - * Field template settings form. - */ -function ds_field_template_settings_form(array &$form, FormStateInterface &$form_state, array $context) { - $functions = Ds::getFieldLayoutOptions(); - - $default_field_function = \Drupal::config('ds.settings')->get('ft-default'); - if (empty($default_field_function)) { - $default_field_function = 'default'; - } - - // @todo fix me - and rename 'instance' to field :) - if (is_array($context['instance'])) { - $key = $context['instance']['field_name']; - } - else { - $key = $context['instance']->getName(); - } - - // Plugin settings. - $plugin_settings = $form_state->get('plugin_settings'); - $field_settings = isset($plugin_settings[$key]['ft']) ? $plugin_settings[$key]['ft'] : []; - - // In case with an ajax refresh we fetch the function from a different place. - $values = $form_state->getValues(); - if (isset($values['fields'][$key]['settings_edit_form']['settings']['ft']['id'])) { - $field_function = $values['fields'][$key]['settings_edit_form']['settings']['ft']['id']; - } - elseif (isset($values['fields'][$key]['settings_edit_form']['third_party_settings']['ds']['ft']['id'])) { - $field_function = $values['fields'][$key]['settings_edit_form']['third_party_settings']['ds']['ft']['id']; - } - else { - $field_function = isset($field_settings['id']) ? $field_settings['id'] : $default_field_function; - } - - if (!isset($functions[$field_function])) { - $field_function = $default_field_function; - } - - $form['ft'] = [ - '#weight' => 20, - ]; - - $form['ft']['id'] = [ - '#title' => t('Choose a Field Template'), - '#type' => 'select', - '#options' => $functions, - '#default_value' => $field_function, - '#submit' => ['ds_field_ui_display_overview_multistep_submit'], - '#ajax' => [ - 'callback' => 'ds_field_ui_display_overview_multistep_js', - 'wrapper' => 'field-display-overview-wrapper', - ], - ]; - - // Create field layout plugin instance. - $config = isset($field_settings['settings']) ? $field_settings['settings'] : []; - $field_layout_instance = \Drupal::service('plugin.manager.ds.field.layout')->createInstance($field_function, $config); - - // Alter the form to add specific field layout settings. - $form['ft']['settings'] = [ - '#type' => 'container', - '#attributes' => [ - 'class' => [ - 'ft-settings', - ], - ], - ]; - - $field_layout_instance->alterForm($form['ft']['settings']); -} - -/** - * Ajax handler for changing conditions on the 'Manage display' screen. - */ -function ds_field_ui_display_overview_multistep_js($form, &$form_state) { - return $form['fields']; -} - -/** - * Submission handler for condition changes in field_ui_display_overview_form(). - */ -function ds_field_ui_display_overview_multistep_submit($form, &$form_state) { - $form_state['rebuild'] = TRUE; -} - -/** - * Implements hook_field_formatter_third_party_settings_form(). - */ -function ds_field_formatter_third_party_settings_form(FormatterInterface $plugin, FieldDefinitionInterface $field_definition, $view_mode, $form, FormStateInterface $form_state) { - $element = []; - - $field_info = $field_definition->getFieldStorageDefinition(); - if (!empty($field_info) && $field_info->getCardinality() != 1) { - $name = $field_info->getName(); - $settings = $form_state->get('plugin_settings'); - - $element['ds_limit'] = [ - '#type' => 'textfield', - '#title' => t('UI limit'), - '#size' => 2, - '#description' => t("Enter a number to limit the number of items or 'delta' to print a specific delta (usually configured in views or found in entity->ds_delta). Leave empty to display them all. Note that depending on the formatter settings, this option might not always work."), - '#default_value' => !empty($settings[$name]['ds_limit']) ? $settings[$name]['ds_limit'] : '', - ]; - } - - if (\Drupal::config('ds.settings')->get('field_template')) { - $context = [ - 'instance' => $field_definition, - 'formatter' => $plugin, - ]; - ds_field_template_settings_form($element, $form_state, $context); - } - - return $element; -} - -/** - * Implements hook_field_formatter_settings_summary_alter(). - */ -function ds_field_formatter_settings_summary_alter(&$summary, $context) { - if (\Drupal::config('ds.settings')->get('field_template')) { - // Field template summary. - $functions = Ds::getFieldLayoutOptions(); - - $default_field_function = \Drupal::config('ds.settings')->get('ft-default'); - $field = $context['field_definition']; - - if (isset($context['form_state'])) { - /* @var $form_state FormStateInterface */ - $form_state = $context['form_state']; - $plugin_settings = $form_state->get('plugin_settings'); - $field_function = isset($plugin_settings[$field->getName()]['ft']['id']) ? $plugin_settings[$field->getName()]['ft']['id'] : $default_field_function; - } - else { - $plugin_settings = $context['formatter']->getThirdPartySetting('ds', 'ft'); - $field_function = isset($plugin_settings['id']) ? $plugin_settings['id'] : $default_field_function; - } - - if (!isset($functions[$field_function])) { - $field_function = $default_field_function; - } - $summary[] = 'Field template: ' . Html::escape($field_function); - } -} - -/** - * Implements hook_hook_info(). - */ -function ds_hook_info() { - $hooks['ds_views_row_render_entity'] = [ - 'group' => 'ds', - ]; - $hooks['ds_views_row_render_entity_alter'] = [ - 'group' => 'ds', - ]; - $hooks['ds_views_view_mode_alter'] = [ - 'group' => 'ds', - ]; - return $hooks; -} - -/** - * Implements template_preprocess_ds_field_reset(). - */ -function template_preprocess_field__ds_field_reset(&$variables) { - $variables['show_colon'] = \Drupal::config('ds.settings')->get('ft-show-colon'); -} - -/** - * Implements template_preprocess_ds_field_minimal(). - */ -function template_preprocess_field__ds_field_minimal(&$variables) { - $variables['settings'] = isset($variables['ds-config']['settings']) ? $variables['ds-config']['settings'] : []; -} - -/** - * Implements template_preprocess_ds_field_expert(). - */ -function template_preprocess_field__ds_field_expert(&$variables) { - $variables['settings'] = isset($variables['ds-config']['settings']) ? $variables['ds-config']['settings'] : []; - - $vars = [ - 'lbw' => 'label_attributes', - 'ow' => 'wrapper_attributes', - 'fis' => 'field_wrapper_attributes', - 'fi' => 'field_item_wrapper_attributes', - ]; - - foreach ($vars as $key => $variable_name) { - $var_attributes = []; - - // Add classes. - if (!empty($variables['settings'][$key . '-cl'])) { - $var_attributes['class'] = explode(' ', $variables['settings'][$key . '-cl']); - } - // Add attributes. - if (!empty($variables['settings'][$key . '-at'])) { - $attributes = explode(' ', $variables['settings'][$key . '-at']); - foreach ($attributes as $key => $attribute) { - if (strpos($attribute, '=') !== FALSE) { - $attribute_parts = explode('=', $attribute); - $var_attributes[$attribute_parts[0]] = trim($attribute_parts[1], '\"'); - } - } - } - - $variables[$variable_name] = new DsAttribute($var_attributes); - } - - // In order to allow HTML we need to filter XSS the output of the - // prefix/suffix. - $variables['settings']['prefix'] = XSS::filterAdmin($variables['settings']['prefix']); - $variables['settings']['suffix'] = XSS::filterAdmin($variables['settings']['suffix']); -} - -/** - * Implements hook_ds_field_operations_alter(). - */ -function ds_ds_field_operations_alter(&$operations, $field) { - if ($field['type'] == 'block') { - $operations['config'] = [ - 'title' => t('Configure block'), - 'url' => new Url('ds.manage_block_field_config', ['field_key' => $field['id']]), - ]; - } -} - -/** - * Implements hook_entity_type_alter(). - */ -function ds_entity_type_alter(array &$entity_types) { - /* @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */ - foreach ($entity_types as $entity_type) { - $base_table = $entity_type->getBaseTable(); - if ($entity_type->get('field_ui_base_route') && !empty($base_table)) { - if ($entity_type->hasLinkTemplate('canonical')) { - $entity_type->setLinkTemplate('display', $entity_type->getLinkTemplate('canonical') . '/manage-display'); - } - } - } - // Undo field_layout changes to EntityViewDisplay. - if (\Drupal::moduleHandler()->moduleExists('field_layout')) { - $entity_types['entity_view_display']->setClass($entity_types['entity_view_display']->getOriginalClass()); - if (\Drupal::moduleHandler()->moduleExists('field_ui')) { - $entity_types['entity_view_display']->setFormClass('edit', 'Drupal\field_ui\Form\EntityViewDisplayEditForm'); - } - } -} diff --git a/web/modules/ds/ds.permissions.yml b/web/modules/ds/ds.permissions.yml deleted file mode 100644 index 2da0d3fc63..0000000000 --- a/web/modules/ds/ds.permissions.yml +++ /dev/null @@ -1,10 +0,0 @@ -'admin display suite': - title: 'Administer Display Suite' - description: 'General permission for Display Suite settings pages.' -'admin fields': - 'title': 'Administer fields' - 'description': 'Manage fields for every entity.' - 'restrict access': true -'admin classes': - title: 'Administer classes' - description: 'Manage classes.' diff --git a/web/modules/ds/ds.routing.yml b/web/modules/ds/ds.routing.yml deleted file mode 100644 index 33db9dfa13..0000000000 --- a/web/modules/ds/ds.routing.yml +++ /dev/null @@ -1,110 +0,0 @@ -ds.structure: - path: 'admin/structure/ds' - defaults: - _controller: '\Drupal\ds\Controller\DsController::listDisplays' - _title: 'Displays' - requirements: - _permission: 'admin display suite' -ds.list: - path: 'admin/structure/ds/list' - defaults: - _controller: '\Drupal\ds\Controller\DsController::listDisplays' - _title: 'Displays' - requirements: - _permission: 'admin display suite' -ds.admin_settings: - path: 'admin/structure/ds/settings' - defaults: - _form: '\Drupal\ds\Form\SettingsForm' - _title: 'Settings' - requirements: - _permission: 'admin display suite' -ds.admin_emergency: - path: 'admin/structure/ds/emergency' - defaults: - _form: '\Drupal\ds\Form\EmergencyForm' - _title: 'Emergency settings' - requirements: - _permission: 'admin display suite' -ds.change_layout: - path: 'admin/structure/ds/change-layout/{entity_type}/{bundle}/{display_mode}/{new_layout}' - defaults: - _form: '\Drupal\ds\Form\ChangeLayoutForm' - _title: 'Change layout' - requirements: - _permission: 'admin display suite' -ds.classes: - path: 'admin/structure/ds/classes' - defaults: - _form: '\Drupal\ds\Form\ClassesForm' - _title: 'Classes' - requirements: - _permission: 'admin classes' -ds.fields_list: - path: 'admin/structure/ds/fields' - defaults: - _controller: 'Drupal\ds\Controller\FieldController::fieldList' - _title: 'Fields' - requirements: - _permission: 'admin fields' -ds.manage_field: - path: 'admin/structure/ds/fields/manage/{field_key}' - defaults: - _controller: 'Drupal\ds\Controller\FieldController::manageRedirect' - requirements: - _permission: 'admin fields' -ds.delete_field: - path: 'admin/structure/ds/fields/delete/{field_key}' - defaults: - _form: '\Drupal\ds\Form\FieldDeleteForm' - requirements: - _permission: 'admin fields' -ds.manage_token_field: - path: 'admin/structure/ds/fields/manage_token/{field_key}' - defaults: - _form: '\Drupal\ds\Form\TokenFieldForm' - _title: 'Edit a token field' - requirements: - _permission: 'admin fields' -ds.add_token_field: - path: 'admin/structure/ds/fields/manage_token' - defaults: - _form: '\Drupal\ds\Form\TokenFieldForm' - _title: 'Add a token field' - requirements: - _permission: 'admin fields' -ds.manage_block_field: - path: 'admin/structure/ds/fields/manage_block/{field_key}' - defaults: - _form: '\Drupal\ds\Form\BlockFieldForm' - _title: 'Edit a block field' - requirements: - _permission: 'admin fields' -ds.manage_block_field_config: - path: 'admin/structure/ds/fields/manage_block/{field_key}/block_config' - defaults: - _form: '\Drupal\ds\Form\BlockFieldConfigForm' - _title: 'Edit block config' - requirements: - _permission: 'admin fields' -ds.add_block_field: - path: 'admin/structure/ds/fields/manage_block' - defaults: - _form: '\Drupal\ds\Form\BlockFieldForm' - _title: 'Add a block field' - requirements: - _permission: 'admin fields' -ds.manage_copy_field: - path: 'admin/structure/ds/fields/manage_copy/{field_key}' - defaults: - _form: '\Drupal\ds\Form\CopyFieldForm' - _title: 'Edit a copy of a Display Suite field' - requirements: - _permission: 'admin fields' -ds.add_copy_field: - path: 'admin/structure/ds/fields/manage_copy' - defaults: - _form: '\Drupal\ds\Form\CopyFieldForm' - _title: 'Add a copy of a Display Suite field' - requirements: - _permission: 'admin fields' diff --git a/web/modules/ds/ds.services.yml b/web/modules/ds/ds.services.yml deleted file mode 100644 index ed57823eb2..0000000000 --- a/web/modules/ds/ds.services.yml +++ /dev/null @@ -1,12 +0,0 @@ -services: - plugin.manager.ds: - class: Drupal\ds\Plugin\DsPluginManager - parent: default_plugin_manager - plugin.manager.ds.field.layout: - class: Drupal\ds\Plugin\DsFieldTemplatePluginManager - parent: default_plugin_manager - ds.route_subscriber: - class: Drupal\ds\Routing\RouteSubscriber - arguments: ['@entity.manager'] - tags: - - { name: event_subscriber } diff --git a/web/modules/ds/images/arrow.png b/web/modules/ds/images/arrow.png deleted file mode 100644 index 715f5cdd4f..0000000000 --- a/web/modules/ds/images/arrow.png +++ /dev/null @@ -1,12 +0,0 @@ -�PNG - -��� IHDR���d���<����?����tEXtSoftware�Adobe ImageReadyq�e<��}IDATx��1HBQ��$� ����������bcSAA� -�8H�6�Xc��PE�485�a�ѣT��]�)�~���}�{�=�b�R�D�zx (�P��!�� -����o�D]���<V��{d��e�d�C�b�Q$��#�b�I��WIb��c�:�Q��u¿�� -1�"� -�C9��)�R%�H��"����Q� ���/3b�1�9E&(��ȥޕ�}�h�O�w{]?-#;Ȟ�yegBp��\���߄���� -Y��3�!6����Cd�B� ��7��B9d��)R{���P�� - i�H���ءڸ�I�B��j� ÜClQ_X�b~ya��OcG� � -�G�b�2�ak)�kak���F�4$?�;���#�Gi@^}�K -�Ed "�~z������A�k�S�;�⧑-�xn�M�#��~�H!���C - ������Nd1�+���v��B~��� J!��@��gహ�oa7�L��� -i YCl�����(�{d�HVW�O�:)�|� ���v���[q��I��I��x�2X!�:y�N7�6��v��(��sH�Twv�^رB�����5M�߅�"��Q.h���X�!�B(�P���]���9��X�Pi����IEND�B`� \ No newline at end of file diff --git a/web/modules/ds/images/ds-1col-wrapper.png b/web/modules/ds/images/ds-1col-wrapper.png deleted file mode 100644 index 6137607eb0..0000000000 --- a/web/modules/ds/images/ds-1col-wrapper.png +++ /dev/null @@ -1,3 +0,0 @@ -�PNG - -��� IHDR�������������$h���tEXtSoftware�Adobe ImageReadyq�e<���IDATx���Mj�@��3�utWz����˞Et�a\�f��&�t�u��� �,Ɨ/��v�z!<�������x�� �K��ż�m?Q�l ����OJ�%J���4�4)�)�^%�H.��8)��(��L��e%5�u�L%�Q�(%��I~�^�ס��q�4v���C)%���|>�7�1��c��v�u��gJ�U�Q��� J%�Q"J%�Q"J%�Q�(%�Q�(A��D�(A��D�(A� JD �D� JD �Q"J%�Q"J%�Q�(%�Q�(%�D�(A��D�(A��D �D� JD �D� J%�Q"J%�Q"J%�Q�(%�Q�(%�D�(A��D�(A� JD �D� JD �D� J%�Q"J%�Q�(%�Q�(%�Q�(A��D�(A��D �D� JD �D� JD �Q"J%�Q"J%�Q�(%�Q�(%�D�(A��D�(A� JD �D� JD �D� J%�Q"J%�Q�(%�Q�(%�Q�(A��D�(��J)���H�x��iB�u�c�W�y?%SJuG�X,�[�|#J%�Q�(%�Q�(%�D�(A��N$�_����Vp)���mz�����u�[��m��I�9�amw�s�>��>�2Yヺ�IžqFehm�n�a���S�Ѿq�(�q��hJv��:%�4�ä�G�yAr�0��D�gP(�!�����IEND�B`� \ No newline at end of file diff --git a/web/modules/ds/images/ds-1col.png b/web/modules/ds/images/ds-1col.png deleted file mode 100644 index 6137607eb0..0000000000 --- a/web/modules/ds/images/ds-1col.png +++ /dev/null @@ -1,3 +0,0 @@ -�PNG - -��� IHDR�������������$h���tEXtSoftware�Adobe ImageReadyq�e<���IDATx���Mj�@��3�utWz����˞Et�a\�f��&�t�u��� �,Ɨ/��v�z!<�������x�� �K��ż�m?Q�l ����OJ�%J���4�4)�)�^%�H.��8)��(��L��e%5�u�L%�Q�(%��I~�^�ס��q�4v���C)%���|>�7�1��c��v�u��gJ�U�Q��� J%�Q"J%�Q"J%�Q�(%�Q�(A��D�(A��D�(A� JD �D� JD �Q"J%�Q"J%�Q�(%�Q�(%�D�(A��D�(A��D �D� JD �D� J%�Q"J%�Q"J%�Q�(%�Q�(%�D�(A��D�(A� JD �D� JD �D� J%�Q"J%�Q�(%�Q�(%�Q�(A��D�(A��D �D� JD �D� JD �Q"J%�Q"J%�Q�(%�Q�(%�D�(A��D�(A� JD �D� JD �D� J%�Q"J%�Q�(%�Q�(%�Q�(A��D�(��J)���H�x��iB�u�c�W�y?%SJuG�X,�[�|#J%�Q�(%�Q�(%�D�(A��N$�_����Vp)���mz�����u�[��m��I�9�amw�s�>��>�2Yヺ�IžqFehm�n�a���S�Ѿq�(�q��hJv��:%�4�ä�G�yAr�0��D�gP(�!�����IEND�B`� \ No newline at end of file diff --git a/web/modules/ds/images/ds-2col-fluid.png b/web/modules/ds/images/ds-2col-fluid.png deleted file mode 100644 index 7f46b44b1b..0000000000 --- a/web/modules/ds/images/ds-2col-fluid.png +++ /dev/null @@ -1,6 +0,0 @@ -�PNG - -��� IHDR�������������$h���tEXtSoftware�Adobe ImageReadyq�e<�� IDATx���?K[Q�ᓘV���� �"� -����~����7ѩ�E�"�8�:)E��_�M7A��&iN���Fkb.�y�b�wx�y�M���>蟭����L�c6k,��q.�F�i#!!R���RBR��R�(���JI���J�$)2N�$q��=�DIR�EI�L��$�H�d/� J%�Q"J襮��;�χt�m�===m�QF�bѯ�Y8}#J%�Q�(%�Q�(%�D�(A��D�(A��D �D� JD �D� J%�Q"J%�Q"J%�Q�(%�Q�(� J%�Q"J%�Q�(%�Q�(%�Q�(A��D�(A��-��>����pvv��{SSSadd$�����k?���>����i��%a~~���FGG���u�ǘ�����(�bnn���ωrrr2 -�P.� �5��YYY����O���덍�G�뭭���������͍Z)�'^����x:�����O^�"ʶ�j�,�ମ��(���ظi���y��(��<z?88�����Z�#�(_|��b�����>2h7:�qww�x}~~�v�����ud���X)�">�<99i<ü��xr�w���|}_QZ){bmm-����j����m��KKK�c�WWW]�D�_�r�������������Y��p�:��Bva�C�e��=X)q�Q"J%�Q"J%�Q�(%�Q�(%�D�(A��D�(A� JD �D� JD �D� J%�Q"J%�Q�(%�Q�(%�Q�(A��D�(A��D �D� JD �D� JD �Q"J%�Q"J%�Q�(%�Q�(%�D�(A��D�(A� JD �D� JD �D� J%�Q"J%�Q�(%�QBd�u����4��D933c�f��(A��D �D� JD �D� J%�Q"J�L�T�v��}2 -�����{��T����q{W��fj����^*ն�������_c|妭�S��Ces��ʵ���U;�4}�]�)s��Q�Z�̴��Ŧe5-J^)��0+e��</H��/� ��{ =,����IEND�B`� \ No newline at end of file diff --git a/web/modules/ds/images/ds-2col-stacked-fluid.png b/web/modules/ds/images/ds-2col-stacked-fluid.png deleted file mode 100644 index 2bb1b0e097..0000000000 --- a/web/modules/ds/images/ds-2col-stacked-fluid.png +++ /dev/null @@ -1,5 +0,0 @@ -�PNG - -��� IHDR�������������$h���tEXtSoftware�Adobe ImageReadyq�e<���IDATx����jY��tM\�x��H�-��\�+�p%3��Q\M��0��ܺ�4(F�{�� -�ؗɿ�����T%5S���%���ԩ��$m����$�o l������W���̌aa��m�bR\�rPi��ϔP�(͔TJc0[�)�R��+J�"����3e������%U�2%U�՞2A� JD �D�P�B^�^XX0�5�l6�;S�i���2�s�o�)A��D�(A��D �D� JD �D� JD �Q"J%��Z��3�5S�s^�羳,f͔��B�����,aM�(A��D �}/..��������?|������:�RH��v۷w_��1U�}������Sb�Q�(%�Q�(%�Q�(A��D�(A��D �D� JD �D� JD �Q"J%�Q"J%�e� In߾�,--����ɓ��ݻ�;w�$W�^���߿��c�w?�\��ٳ_ݶo߾�իW?��x|��(q��鱷o$ʣG���)��ŋ�[�n�^������ڵkkv�sss�m7o�L>|�`�͔�'֩�~��y�֟>}�͵+�kx�q�s�ҥME��s�έ4ݸqcC�Q:�Ys}ǎ��^�7�͈T�����ϊ�?��涝;wh:����������c���|9l�:f�B�8q"�w���9�G�}s�#�89?x�(͔��r�J�k����y�.\��X?�?>1�|��e�K����5?�;33���<x�6����l�{���B=�I��ԩS�l�n����������+�/fJ�A��DYq�n� �����={����x��`��� �?��Wܬ؆0EYH�E�i"m�c��8d����͛·����O<#���t:y�o߾--�ׯ_�a9rD��\_��|���W���ֻ��0c̘�F��[S��!?~<6Ȳf�3� ��F�cgɭ>���%͔�+�~�����8[2��{+c]�5�7MNN�o�}��I����5����q�o]^�F��n�C�t3�|wfYr�رdϞ=�͐����5_���b�x���<J̔?P|�a��mS�f���,�w�i�,4�"fIDY�� �Q"J%�Q"J%�Q�(%�Q�(%�QD �D� JD �D� J%�Q"J%�Q"J%�Q�(%�Q�(A��D�(A��D�(A� JD �D� JD ��({�����2�d�0��F-��i�V;ʩ�)5�MOOkJD �D��� -9�Y\\t�]3q�]�n!Q��m���}�yΊ�Δ֔�)A� JD �D� JD �D� J%�Q"J%�Q�(%l]�>�]?��Q��fӳ��7�Q"J%�Q�(%�Q�(A��D�(� Y����n�u�P�]>~������ =Y����e��g֟Eͤ��ۿį���r�'���zC���:����7���om�]�a6t� �~;ʎ�;f62Kv��� Q�EQ��:SvG��d���W������R�������IEND�B`� \ No newline at end of file diff --git a/web/modules/ds/images/ds-2col-stacked.png b/web/modules/ds/images/ds-2col-stacked.png deleted file mode 100644 index 3d94a84817..0000000000 --- a/web/modules/ds/images/ds-2col-stacked.png +++ /dev/null @@ -1,4 +0,0 @@ -�PNG - -��� IHDR�������������$h���tEXtSoftware�Adobe ImageReadyq�e<��IDATx���Aj�@�Q˞�:hQ0�<�9PK�=K@�����W�,5 -� �ҕ&:�0�I �/�,�U���u��}��v�ow���Ѳ��箛��[�{KB&���NJ�%J���n�Ҥ$�(g�(�Ep�&�I9�X��\�EI�QV�$'. ���Q�(%�QBJ����t:Y��m�郎��*L�}���� JD �D� JD �Q"J%�Q"J%�Q�(%�Q�i�&+Y���|��}��Y��/�]%ʺ��%<�D� JD ���g�}�sI�i�>~>��X���P��.�D9�?��z�Z��ޟ�<ޟ�D �D� JD �D� JD �Q"J%�Q"J%�Q�(%�Q�(%�D�(A��D�(A� JD �D� JD �D� J%�Q"J%�Q�(%�Q�(%�Q�(A��D�(A��D �D� JD �D� JD �Q"J%�Q"J%�Q�(%�Q�(%�D�(A��D�(A��� J%�Q"J%�Q�(%�Q�(%�Q�(A��D�(A��D ����r�&+Y���<��CBft8��=���;ʺ��5Mc<�D� JD [�D��{g߅�ϾS���0�y�S^�"�I�9%&%�D�(A��D�(A��D �D� JD �D� J%�����k�˓�[�mk/���(A��D �D� JD �D� J%�Q"JXI���s�}�l�r��Xޟ?�'�����1ކ8EMRR�6dݯ���|;�7-��]�7y� )M��[w��Ń��ۑ:��>�p7%����%��2̷I9���fa�`���{!H��E����IEND�B`� \ No newline at end of file diff --git a/web/modules/ds/images/ds-2col.png b/web/modules/ds/images/ds-2col.png deleted file mode 100644 index cf953c1641..0000000000 --- a/web/modules/ds/images/ds-2col.png +++ /dev/null @@ -1,3 +0,0 @@ -�PNG - -��� IHDR�������������$h���tEXtSoftware�Adobe ImageReadyq�e<���IDATx���Mj�@���L{qSx����˞E��4��f�c �EI3��� ������e�ݾE�T�r^���y�R�Mc,,fi)^����L��9oJ�%J����ö�)�)�$��\�orܔ��R��%9FY����J��W&�D�(A���4�o��������{�Z��g�h�I�u>�f��(A��D �D� JD �D� J%�Q"J%�Q"J%�Q�(%�Q�(A��D�(A��D�(A� JD �D� JD �D�F�(A��D�(A��D �D� JD �D� JD �Q"J%�Q"J%�Q�(%�Q�(%�D�(A��D�(A� JD �D� JD �D� J%�Q"J%�Q�(%�Q�(%�Q�(A��D�(A��D �D� JD �D� JD �Q"J%�Q"J%�Q�(%�Q�(%�D�(A��D�(A� JD �D� JD �D� J%�Q"J%�Q�(%�Q�(%�Q�(A��D�(A��D�(A� JD �D� JnL���6M��'��zm�f��(A��D �D� JD �D� J%�Q"J�H�1�����(X��px�/����sw:��m跨Mʜb�N��t>�m��8:Ó��EGscFǾ���s�a��oA����Q��0�Ֆ�Fk�%��8�˦�W�yA�X����R�������IEND�B`� \ No newline at end of file diff --git a/web/modules/ds/images/ds-3col-equal-width.png b/web/modules/ds/images/ds-3col-equal-width.png deleted file mode 100644 index f27045df9a..0000000000 --- a/web/modules/ds/images/ds-3col-equal-width.png +++ /dev/null @@ -1,4 +0,0 @@ -�PNG - -��� IHDR�������������$h���tEXtSoftware�Adobe ImageReadyq�e<���IDATx����JA��]g�y���D=�ѱg<�6��slW�ێ�}0��2;��/X��l�UU=U0���j��?�9ȇ�ұ0�m��x�r�H(DݭӤ�R�4))J觥IIIQfI��"�}S��=֢�3QRb��()���({d�(A��D�(aLW���n��B�\�|>�� �[D�Y۶7�i�n� JD �D� JD �Q"J%�Q"J%�Q�(%�Q�(%�D�(A��D�(A� JD �D� JD �D� J%�Q"J%�Q"JG�(A��D�(A��D �D� JD �D� JD �Q"J%�Q"J%�Q�(%�Q�(%�D�(A��D�(A� JD �D� JD �D� J%�Q"J%�Q�(%�Q�(%�Q�(A��D�(A��D �D� JD �D� JD �Q"J%�Q"J%�Q�(%�Q�(%�D�(A��D�(A� JD �D� JD �D� J%�Q"J%�Q�(%�Q�(%�Q�(A��D�(A��D�(A� JD ���a!���x���Q.���p�u�Q"J%�Q"J%�Q�(%�Q�(A��*��^�M��(��~�>����>������MQ��1�n}��q����a���ݛ����N�� -�vn�e�3^L�v0Vg�䏢�y����>/H&�K��kZY�������IEND�B`� \ No newline at end of file diff --git a/web/modules/ds/images/ds-3col-stacked-equal-width.png b/web/modules/ds/images/ds-3col-stacked-equal-width.png deleted file mode 100644 index 0a7d8dc4a2..0000000000 --- a/web/modules/ds/images/ds-3col-stacked-equal-width.png +++ /dev/null @@ -1,3 +0,0 @@ -�PNG - -��� IHDR�������������$h���tEXtSoftware�Adobe ImageReadyq�e<���IDATx���AJ�@��L=O ���Hq�Y�@��+5�'܈��W�}0�l$����VM���CQw���z�������zm[8�m�c�i>^��Hy�� P�&%���4)��d%QTn�D��S�I�D�%�L�$ {d�(A��D�(���w�ugu�}߇:��,�j�꺎e�7���?�oD �D� JD �D� J%�Q"J%�Q�(%�Q�(%���u���n��nbR"J%��������B]�O^�7I��7�Q�(%�Q�(A��D�(A��D�(A� JD �D� JD �Q"J%�Q"J%�Q�(%�Q�(%�D�(A��D�(A��D �D� JD �D� J%�Q"J%�Q"J%�Q�(%�Q�(A��D�(A��D�(A� JD �D� JD �Q"J%�Q"J%�Q�(%�Q�(%�D�(A��D�(A��D �D� JD �D� J%�Q"J%�Q"J%|W�5MsV�|MJ%�Q�A�G]���R�u�(���N���(A��D �D� JD �D� J%�Q"J%�Q"J%�Q��]�]äQ"J%�Q"J%�Q�(%�Q�(A�DU ��m�[[�������q*�~�|ZW�ίU��&)�4��>��q�N�S��"�y�y%��}����m^i`���e�����Q9�yZ���2�rq�%�2�>-�[ ��a����S��I�����IEND�B`� \ No newline at end of file diff --git a/web/modules/ds/images/ds-3col-stacked-fluid.png b/web/modules/ds/images/ds-3col-stacked-fluid.png deleted file mode 100644 index b63c246ba4..0000000000 --- a/web/modules/ds/images/ds-3col-stacked-fluid.png +++ /dev/null @@ -1,4 +0,0 @@ -�PNG - -��� IHDR�������������$h���tEXtSoftware�Adobe ImageReadyq�e<���IDATx��ݻnY��� tH��"���e$��T�<ڭx�]m� %o@d�K�H�4\�B� K<��Gq䘄�xl��'Y��������ر�Jsy��,���`|�^\Z��s�A^]\�[���f,��QV�Qٺ+%������uVK+%)ErQ����7)���cE���*JR��"JR�)!�^2A� JD �D�0L���{mm�ޜ!�G�j��߈D�(A� JD �D� JD �Q"J%�Q"J%�Q�(%����}7 {+%�Q"J��:���Y���i�V�z�������L�$�� 2�}o���D�(A� JD �D� JD �D� J%�Q"J%�Q�(%�Q�(%�Q�(A��D�(A��D �$U�Y����Ϟ>}��m�.]ʎ9�=x� �}����z���O���r�k���Ǐg���m��#dDY�+W����~�<w�\qA�#u�ΝbU�D�}H�=<��Ǐg���E�q*�(�&�S#�8��a��˗{��"�=W�n��ݼys�(cu�~������w��u: Jtv\?t��@ۋ�z���R�?�9���۷o;>w��a;�x����c�s�ݜ8q����/Vʁă�gϞ�_�|�3�Xy�ݻW<9�y�S�Vʡ�q�Fqh��"���q�����}߾}[�)´�4���W����j����~��լ^���>+++S1I�Fc��}?6�������\|�R�� �D� JD �,�(�61�)�2v�W��Λ7o�S��L��ׯ�߈*�����8'>��D��r���ئq���r��{�>��ݘ�v���9s&�T*�)���Z�b�>~�8�_L�ٳg�6a�2Ή�rcc���O�>�p[��ۣG���X�:+���\���>I��s�X9�?��D k%� �8�k�(w]=F�[�b�� -2+㜊(�ų.\����u���8�2N�{����.^���x�"����ۺ_�}��v������ќ>}:�q�~_��8'~���I�ղ���gG���q��ɱOԬ�s�W�� �s�2�2�s�S�N�e�V���xֱc�J�f�5+����w��x�7c�NԬ�s�W�� +c�0NQ�z�>fe�S%�Q�(%�Q�(%�Q�(A��D�(A��D �D� JD �D� JD �Q"J%�Q"J%�Q�(%�Q�(%�D�(A��D�(A� JD �D� J�P����լ�ng�Je��t|��z��=�y^|O����c?�Lm�'��˗���z�>+K����Q�(%Lţﵵ5{s�,,,�e��2S8|#J%�Q�(%�Q�(%�D�(A��D�(A��D �D�п����h4�M���D�(A� JD �D� JD �Q"J%����<��a�yˮ`\�~��o����嵭�o�������U�J�0�[��������1�kw]:w��M������Z�tWtX�q� +�C�2� �ֳJ���ժ(Q��an��y�q^��-���]�75=Wu����IEND�B`� \ No newline at end of file diff --git a/web/modules/ds/images/ds-3col-stacked.png b/web/modules/ds/images/ds-3col-stacked.png deleted file mode 100644 index e18c863bcd..0000000000 --- a/web/modules/ds/images/ds-3col-stacked.png +++ /dev/null @@ -1,5 +0,0 @@ -�PNG - -��� IHDR�������������$h���tEXtSoftware�Adobe ImageReadyq�e<���IDATx���Q��@�aGm�ŇB`�S�j�cϲ؇���:V��Om�L��!1�o��,a����k�e��η��ӗ� Q���{��ͼ�e��s[B"´��^�P�&%I)�iiR�R��(JRQ�}��{�$�(I1� JR�#!�� J%�Q"J��j�n��n>���ҏ��:W -�oD �D� J%�Q"J%�Q�(%�Q�(%�Q�(A��.�����������D�(���N�,�x�ߦ<������ǻ�H{��ޛ��}�(%�D�(A��D�(A��D �D� JD �D� J%�Q"J%�Q"J%�Q�(%�Q�(A��D�(A��D�(A� JD �D� JD �Q"J%�Q"J%�Q�(%�Q�(%�D�(A��D�(A��D �D� JD �D� J%�Q"J%�Q"J%�Q�(%�Q�(�-@� JD �D� JD �Q"J%�Q"J%�Q�(%�Q�(%�D�(A����������,���I��3>߿�S���9]��~������>�(w�]r��뇘,)��7�Q"J��w�m���RUU�Qv]�J���(A��D �D� JD �D� J%�Q"J%�Q"J%�Q��V��w�4v�Q�(%�D�(A��D�(A� JD �D���2����p�l+�����cy<���rZ��qz,�)j���8��a� ���8FY,��W1�`��P?�nZo� -���Ŕ,�))J��2NQ���=L�-�,�nQr�(�ava_.H3�`��Lh���f�����IEND�B`� \ No newline at end of file diff --git a/web/modules/ds/images/ds-3col.png b/web/modules/ds/images/ds-3col.png deleted file mode 100644 index a309e9fc07..0000000000 --- a/web/modules/ds/images/ds-3col.png +++ /dev/null @@ -1,3 +0,0 @@ -�PNG - -��� IHDR�������������$h���tEXtSoftware�Adobe ImageReadyq�e<���IDATx���MJ�@��$z���P�yD���,�@���ʶS�@V.�?�>|����~�دV/!�����X.���8DyzX,7���0D��ʑP��'4���))J=mK����%QR���7��c%��DI�QFQR��� �Q"J%��K:�g���6�����TU�m�of������uݯ;{��o%�Q�(%�Q�(%�Q�(A��D�(A��D �D� JD �D� JD �Q"J%�Q"J%�Q�(%�Q�(%�D�(A��D�(A� JD �D� JD �D� J%�Q"J%�Q�(%�Q�(%�Q�(A��D�(A��D �D� JD �D� JD �Q"J%�Q"J%�t�D�(A��D�(A� JD �D� JD �D� J%�Q"J%�Q�(%�Q�(%�Q�(A��D�(A��D �D� JD �D� JD �Q"J%�Q"J%�Q�(%�Q�(%�D�(A��D�(A� JD �D� JD �D� J%�Q"J%�Q¨9�/j۶�7�uݿ��%��M�(A��D �D� JD �D� JD �Q"J��&�����GG���v���u_�>�n�����-j�rI)�a��0��e=�r�:Otn\�i�c��4q`3ےuޒ���Q��-1�7��=�E�5���y���*AR@��S���@F�sV�U����IEND�B`� \ No newline at end of file diff --git a/web/modules/ds/images/ds-4col.png b/web/modules/ds/images/ds-4col.png deleted file mode 100644 index 567e74f1ee..0000000000 --- a/web/modules/ds/images/ds-4col.png +++ /dev/null @@ -1,3 +0,0 @@ -�PNG - -��� IHDR�������������$h���tEXtSoftware�Adobe ImageReadyq�e<���IDATx���AJ�@�љ=P6B��=��ҳ��4]��ةI ō����C j��Jkl7���c�弬����AޯV���l�6�S��#�qX�I �DiRR��qZ���e�DI)j�oJ����(JJQ������$>�� �Q"J%��9]���n�U5o�)��4�}\�>�����u��.�(sn�xO �D� J%�Q"J%�Q"J%�Q�(%�Q�(A��D�(A��D�(A� JD �D� JD �D���Q�(%�Q�(%�D�(A��D�(A��D �D� JD �D� J%�Q"J%�Q"J%�Q�(%�Q�(A��D�(A��D�(A� JD �D� JD �Q"J%�Q"J%�Q�(%�Q�(%�D�(A��D�(A��D �D� JD �D� J%�Q"J%�Q"J%�Q�(%�Q�(A��D�(A��D�(A� JD �D� JD �Q"J%�Q"J%�Q�(%�Q�(%�Q�(A��D�(A��D �D� JD ���/}�c��y�N)�Ǖ�c�(��)��ee����)A��D �D� JD �D� JD �Q"J��:���m�G�R�����:���>������z��&)sJ��<���zϏ9�~��_�?�3����֓�dtn�e:�>���d�V�䏢��y����>/H�K��5���Ap^����IEND�B`� \ No newline at end of file diff --git a/web/modules/ds/images/ds-reset.png b/web/modules/ds/images/ds-reset.png deleted file mode 100644 index d1d3fc10f8..0000000000 --- a/web/modules/ds/images/ds-reset.png +++ /dev/null @@ -1,6 +0,0 @@ -�PNG - -��� IHDR�������������$h���tEXtSoftware�Adobe ImageReadyq�e<���IDATx��۱K$g��w�����v��r ZY�iggu$��UB*�?`gi�, -��vv� ���N��[5葸q��awv�=��������ͽ�_�,�9�������/i�� ����Xx7�f�n�>j"�lդ��DiRR+�4-MJ�e(EI]�o�8)��\��ŀ(�c��(�_ Q� �Q"J%��~z�?�>>>�Z�V���h�T?��,�v��E�MMM�7����|\����o\S�<%&%�D�(A��D�(A��D �D� JD �D� J%�Q"J%�Q"J%�Q�(%�Q�(A��D�(A��D�(A� JD �D� JD �Q"J%�Q"J%�Q�(%�Q�(������������<{}dd$[XX�����!������h?B������֪@�iss�� 0;;�DQ~399�h?&���Vvzz��(�w�ooo�����U��<�]^^���wvv����굉����}�ܘ�!�_]]=��nt�@z��"����*�8�%����:??��vn���ǟMk��{z��1�"����jF@��b�k�8�{��RX)���M�����L���b��� -iz�\\\T1E�rL�8/���k�"�����h��쬻��ʘnO�c�,�ԋ�b���=�WJ/��(�KZV�����r8<<�.�p�_���t��s�w�Q���c -���[��D���cJ�vn�5~�r���E�&�WVV���X���g|���Z]]}t<�M_��vn��N\*�M���k���Oortt��l��y633�&�u�lf�?����vgRb�Q"J%�Q"J%�Q�(%�Q�(%�D�(A��D�(A� JD �D� JD �D� J%�Q"J%�Q�(%�Q�(%�Q�(A��D�(A��D �D� JD �D� JD �Q"J%�Q"J%�Q�(%�Q�(%�D�(A��D�(A� JD �D� JD �D� J%�Q"J%�Q�(%��~i�ۢ��(��M�F�j�����ʲ��dQ��rzz��-,߈D�(A� JD �D� JD �Q"J%��7R�e��A���G�{�����w?���������y,:S�$����v���=l�cD��2m�Ζ����'���v���'��gJ6:SR��;ʲe���y'��0=K�(�?�� ����7 Hjf����I{FRP$����IEND�B`� \ No newline at end of file diff --git a/web/modules/ds/images/preview.png b/web/modules/ds/images/preview.png deleted file mode 100644 index e78116b181..0000000000 --- a/web/modules/ds/images/preview.png +++ /dev/null @@ -1,6 +0,0 @@ -�PNG - -��� IHDR�������������$h���tEXtSoftware�Adobe ImageReadyq�e<���IDATx���=lg���3�oV�a��H0�31�RZ��f&&PK�����)R�a�V���Oy��k���K�<�)�}y��?���Io�ի?��������¥K��yqa��YZ\̤��O ��X�����N9XfK3%]�2��+�6�tq�L�=Q�DI�쉒.qJ�nO� J%�Q"J%�Q�(%�Q�(%�Q�(A��D�(A��D �D� JD �D� JD �Q"J%�Q"J%�Q�(%�Q�(%�D�(A��D�(A� JD �D� ʶ|��}n㮯�{�E9�/_�T_�~�VVVZwuu�7�#ʙ�\[[��Ae[a&�o߾��f�\^^V�(g2� -�ds3.LQ�d��0G)LQ�r�[ sR����_����YÜ&�r��ܿ(��#G�T��iӆ9K����=�:Q�_�l#�Y��Q�-LA��Sa -r���� H���&EV�̑���wA�r���Y������M� E����(;� E�-a�B����^�7���L�y�Y��yLQ22�iN�4��AaQ�� �)�N)LQ�H�9����[����r�9�s���V?��(�d9���1e+A�e���(;䯆9�IyQ�(����,a����r��sN��,a<x��D9u�[��٤0�c�|pC�Ӈ���!G�YfH�@�3����!�af�rz��?�%�����D�q� E9�lZO�<9�����oD �D� J%�Q"J%�Q"J%�(�_�^ݺu��������E}�n��x�C3e���/��˗��gϪo/Ey�ĉ:�>��'��͛չs��7Ʈ��yf�ׯ_Wϟ?�n߾=v6}��i�^\�p��!AK�/_���͘Y��ի�Ҽ=�s{�*�g��W.��g�ܹS����}<x����c����z�}�ڵz���qΜ9��;�r�y��I}��\�4Sv`�̋���۷#�y��Q}[ʒ�s�8�u3^�-q&����.ќ:u�+�'��L�+�� ��ݻ���|��g�Q�s�8�������d����m{q�ݵG�y��l5,/V��0 !K�/s�ƍz����Q�ݻw7g�|b�ϔ�c[�Y��g��Ⱥ��9��f��߿�ߌYr{�/눲CO^���7_�2���r�(̓������H���C�mY����՛7o�떖�6�k��8�1�Hs9�����h���B�M��,������r[�Ow[W�Es9o���f'���1&��\n�E�óe����2�5����2�TL6�e6K�����F0��_",��k�,e�b���4���'�<��^,//�c&ڶ߈�l�77�Yr�Pf�r�2is����:����ݻ7v6���&:�Y����ț%�9jF�f��Fd�236�@{qr��S�rx-$�!����S-�df̺ iҹ�����9�2~�P3�2�]�r��)A7g�r�^=��[|�j���B��e&�L��ٳ�����X-\�t�Ƿ����>���7�����I�?)b�Q"J%�Q"J%�Q�(%�Q�(%�D�(A��D�(A��D �D� JD �D� J%�Q"J%�Q"J%�Q�(%�Q�(A��D�(A��D�(A� JD �D� JD �Q"J%�Q"J%�Q�(%�Q�(%�D�(A��D�(A��:�?�^Z\��S�N����?�˽��������ߘEͤ��`c��cY����k�[o,e���Z��1G�������G��1�(�a��fɵƴz@�lS��07g���v^��X�� -0�����5�����IEND�B`� \ No newline at end of file diff --git a/web/modules/ds/includes/field_ui.inc b/web/modules/ds/includes/field_ui.inc deleted file mode 100644 index dafe2df932..0000000000 --- a/web/modules/ds/includes/field_ui.inc +++ /dev/null @@ -1,1417 +0,0 @@ -<?php - -/** - * @file - * Field UI functions for Display Suite. - */ - -use Drupal\Component\Utility\Unicode; -use Drupal\Core\Cache\Cache; -use Drupal\Core\Entity\Display\EntityViewDisplayInterface; -use Drupal\Core\Entity\Entity\EntityViewDisplay; -use Drupal\Core\Form\FormState; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Plugin\PluginFormInterface; -use Drupal\Core\Render\Element; -use Drupal\Core\Url; -use Drupal\ds\Ds; -use Drupal\ds\Plugin\DsField\DsFieldInterface; -use Drupal\field\FieldConfigInterface; -use Drupal\field_ui\FieldUI; - -/** - * Adds the Display Suite fields and layouts to the form. - */ -function ds_field_ui_fields_layouts(&$form, FormStateInterface $form_state) { - global $base_root, $base_path; - - // Get the entity_type, bundle and view mode. - $entity_type = $form['#entity_type']; - $bundle = $form['#bundle']; - - /* @var \Drupal\Core\Entity\EntityFormInterface $entity_form */ - $entity_form = $form_state->getFormObject(); - /* @var \Drupal\Core\Entity\Display\EntityDisplayInterface $entity_display */ - $entity_display = $entity_form->getEntity(); - $view_mode = $entity_display->getMode(); - - // Create vertical tabs. - ds_field_ui_create_vertical_tabs($form); - - // Add layout fieldset. - _ds_field_ui_table_layouts($entity_type, $bundle, $view_mode, $form, $form_state); - - // Add/alter fields on the table, but only if a layout is selected. - if (!empty($form['#ds_layout'])) { - _ds_field_ui_fields($entity_type, $bundle, $view_mode, $form, $form_state); - - // Also alter core fields. - _ds_field_ui_core_fields($form, $form_state); - } - - // Special validate function for field group. - if ($form_state->has('no_field_group')) { - array_unshift($form['#validate'], '_ds_field_group_field_ui_fix_notices'); - } - - // Attach js. - $form['#attached']['library'][] = 'ds/admin'; - - // Add process function to add the regions. - $form['#process'][] = 'ds_field_ui_regions'; - - // Add a destination so we can get back if layout has been changed. - $form['ds_source'] = [ - '#type' => 'hidden', - '#value' => $base_root . $base_path, - ]; - $form['ds_destination'] = [ - '#type' => 'hidden', - '#value' => drupal_get_destination(), - ]; - $form['ds_entity_type'] = [ - '#type' => 'hidden', - '#value' => $entity_type, - ]; - $form['ds_bundle'] = [ - '#type' => 'hidden', - '#value' => $bundle, - ]; - $form['ds_view_mode'] = [ - '#type' => 'hidden', - '#value' => $view_mode, - ]; -} - -/** - * Create vertical tabs. - */ -function ds_field_ui_create_vertical_tabs(&$form) { - - // Add additional settings vertical tab. - if (!isset($form['additional_settings'])) { - $form['additional_settings'] = [ - '#type' => 'vertical_tabs', - '#theme_wrappers' => ['vertical_tabs'], - '#prefix' => '<div>', - '#suffix' => '</div>', - '#tree' => TRUE, - ]; - } - - // @todo needs core permission - $view_mode_admin_access = \Drupal::currentUser()->hasPermission('admin_view_modes'); - if (isset($form['modes'])) { - $form['modes']['#group'] = 'additional_settings'; - $form['modes']['#weight'] = -10; - if ($view_mode_admin_access) { - $url = Url::fromRoute('field_ui.display_mode'); - $form['modes']['view_modes_custom']['#description'] = \Drupal::l(t('Manage display modes'), $url); - } - } -} - -/** - * Add Regions to 'Manage fields' or 'Manage display' screen. - * - * @param array $form - * The form to add layout fieldset and extra Display Suite fields. - * @param \Drupal\Core\Form\FormStateInterface $form_state - * The current form state. - * - * @return array - * The altered form - */ -function ds_field_ui_regions(array $form, FormStateInterface $form_state) { - - // Get the entity_type, bundle and view mode. - $entity_type = $form['#entity_type']; - $bundle = $form['#bundle']; - - /* @var \Drupal\Core\Entity\EntityFormInterface $entity_form */ - $entity_form = $form_state->getFormObject(); - /* @var \Drupal\Core\Entity\Display\EntityDisplayInterface $entity_display */ - $entity_display = $entity_form->getEntity(); - $view_mode = $entity_display->getMode(); - - // Ignore field_group options. - if ($form_state->has('no_field_group')) { - unset($form['fields']['_add_new_group']); - $form['field_group']['#access'] = FALSE; - } - - // Check layout. - $layout = isset($form['#ds_layout']) ? $form['#ds_layout'] : FALSE; - - // Build an array which keys are the field names and - // values are the region they are rendered in. - $field_regions = []; - - // Change UI to add Region column if we have a layout. - if ($layout) { - foreach ($layout['regions'] as $region_name => $field_names) { - foreach ($field_names as $field_name) { - $field_regions[$field_name] = $region_name; - } - } - - $table = &$form['fields']; - - $table['#header'] = [ - t('Field'), - t('Weight'), - t('Parent'), - t('Region'), - t('Label'), - t('Formatter'), - t('Widget'), - [ - 'data' => t('Operations'), - 'colspan' => 2, - ], - ]; - - $table['#regions'] = []; - $region_options = []; - foreach ($layout['region_names'] as $region_key => $region_info) { - $region_options[$region_key] = $region_info['label']; - $table['#regions'][$region_key] = [ - 'title' => $region_info['label'], - 'message' => t('No fields are displayed in this region'), - ]; - } - - // Let other modules alter the regions. - $context = [ - 'entity_type' => $entity_type, - 'bundle' => $bundle, - 'view_mode' => $view_mode, - ]; - $region_info = [ - 'region_options' => &$region_options, - 'table_regions' => &$table['#regions'], - ]; - \Drupal::moduleHandler()->alter('ds_layout_region', $context, $region_info); - - $region_options['hidden'] = t('Disabled'); - $table['#regions']['hidden'] = [ - 'title' => t('Disabled'), - 'message' => t('No fields are hidden.'), - ]; - - $region = [ - '#type' => 'select', - '#options' => $region_options, - '#default_value' => 'hidden', - '#attributes' => [ - 'class' => ['field-region'], - ], - ]; - - // Update existing rows by changing rowHandler and adding regions. - foreach (Element::children($table) as $name) { - $row = &$table[$name]; - $row['#js_settings'] = ['rowHandler' => 'field']; - $row['#region_callback'] = 'ds_field_ui_row_region'; - - // Remove hidden format. - if (isset($row['plugin']['type']['#options']['hidden'])) { - unset($row['plugin']['type']['#options']['hidden']); - } - - // Add label class. - if (isset($row['label'])) { - if ($form_state->has('plugin_settings')) { - $plugin_settings = $form_state->get('plugin_settings'); - if (isset($plugin_settings[$name]['ft']['settings']) && !empty($plugin_settings[$name]['ft']['settings']['lb'])) { - $row['human_name']['#plain_text'] = $plugin_settings[$name]['ft']['settings']['lb'] . ' ' . t('(Original: @orig)', ['@orig' => $row['human_name']['#plain_text']]); - } - } - } - - // Add region. - // Core added regions to Field UI, which default to 'content' - if (!isset($row['region'])) { - $split = 7; - $default = (isset($field_regions[$name]) && isset($region_options[$field_regions[$name]])) ? $field_regions[$name] : 'hidden'; - $second = array_splice($row, $split); - $row['region'] = $region; - $row['region']['#default_value'] = $default; - $row = array_merge($row, $second); - } - else { - $region_default_value = $row['region']['#default_value']; - $default = (isset($field_regions[$name]) && isset($region_options[$field_regions[$name]])) ? $field_regions[$name] : 'hidden'; - if ($region_default_value == 'content' && !isset($region_options['content'])) { - $default = key($region_options); - } - $row['region']['#options'] = $region_options; - $row['region']['#default_value'] = $default; - } - } - } - - return $form; -} - -/** - * Returns the region to which a row in the Field UI screen belongs. - * - * @param array $row - * The current row that is being rendered in the Field UI screen. - * - * @return string - * The region. - */ -function ds_field_ui_row_region(array $row) { - return isset($row['region']['#value']) ? $row['region']['#value'] : 'hidden'; -} - -/** - * Validate the layout settings on the Field UI. - */ -function ds_field_ui_layouts_validate($form, FormStateInterface $form_state) { - // Determine layout variables. - $layout = $form_state->getValue('layout'); - if ($layout === '_none') { - $layout = ''; - $form_state->setValue('layout', ''); - } - $old_layout = $form_state->getValue('old_layout'); - $new_layout = ($layout != $old_layout) || empty($old_layout); - - // Only validate the layout settings if the layout hasn't changed. - if (!$new_layout && !empty($layout)) { - /* @var \Drupal\layout_plugin\Plugin\Layout\LayoutInterface $layout_plugin */ - $layout_plugin = \Drupal::service('plugin.manager.core.layout')->createInstance($form_state->getValue('layout'), []); - $layout_form = isset($form['layout_configuration']) ? $form['layout_configuration'] : []; - foreach (Element::children($form) as $name) { - if (!empty($form[$name]['#ds_layout_configuration'])) { - $layout_form[$name] = $form[$name]; - } - } - if ($layout_plugin instanceof PluginFormInterface) { - $layout_form_state = (new FormState())->setValues($form_state->getValue('layout_configuration', [])); - // TODO - //$layout_plugin->validateConfigurationForm($layout_form, $layout_form_state); - } - } - - // Move the view modes so Field UI can handle them. - if ($form_state->hasValue('modes')) { - $modes = $form_state->getValue('modes'); - if (isset($modes['display_modes_custom'])) { - $form_state->setValue('display_modes_custom', $modes['display_modes_custom']); - } - } -} - -/** - * Save the layout settings from the 'Manage display' screen. - */ -function ds_field_ui_layouts_save($form, FormStateInterface $form_state) { - $save_display = FALSE; - - // Get default values. - $entity_type = $form['#entity_type']; - - /* @var \Drupal\Core\Entity\EntityFormInterface $entity_form */ - $entity_form = $form_state->getFormObject(); - - // Get the entity display. - /* @var \Drupal\Core\Entity\Display\EntityDisplayInterface $display */ - $display = $entity_form->getEntity(); - - // Get view mode. - $view_mode = $display->getMode(); - - // Determine layout variables. - $layout = $form_state->getValue('layout'); - $disable_css = $form_state->getValue('disable_css'); - $entity_classes = $form_state->getValue('entity_classes'); - if (empty($entity_classes)) { - $entity_classes = 'all_classes'; - } - $old_layout = $form_state->getValue('old_layout'); - $new_layout = ($layout != $old_layout) || empty($old_layout); - - $key = array_search('ds_field_ui_change_layout_submit', $form['actions']['submit']['#submit']); - if ($key && !empty($old_layout)) { - return; - } - - $ds_layouts = Ds::getLayouts(); - - // Save layout and add regions if necessary. - $record = []; - $record['layout'] = [ - 'id' => $layout, - 'library' => !empty($layout) ? $ds_layouts[$layout]->getLibrary() : FALSE, - 'disable_css' => $disable_css ? TRUE : FALSE, - 'entity_classes' => $entity_classes, - ]; - $record['regions'] = []; - - // Remove old layout if necessary. - if ($new_layout && !empty($old_layout) || empty($layout)) { - $display->unsetThirdPartySetting('ds', 'layout'); - $display->unsetThirdPartySetting('ds', 'regions'); - - // If layout is empty, unset all regions of the core fields, forcing the - // display to set the default region. Because we are earlier than core, - // change the values in $form_state instead of manipulating the display. - // Also notify ds_field_ui_fields_save() that it shouldn't save the - // third party settings anymore for fields. - if (empty($layout)) { - $form_state->set('ignore_ds_fields', FALSE); - $display->unsetThirdPartySetting('ds', 'fields'); - - $fields = $form_state->getValue('fields'); - foreach (array_keys($display->getComponents()) as $name) { - $fields[$name]['region'] = NULL; - } - $form_state->setValue('fields', $fields); - } - - $display->save(); - } - - if ($new_layout && !empty($layout)) { - $save_display = TRUE; - - // Move current visible fields into a default region, so - // we keep their current settings. - $layouts = Ds::getLayouts(); - /** @var \Drupal\Core\Layout\LayoutDefinition $sl */ - $sl = $layouts[$layout]; - // TODO use default region method? - $first_region = key($sl->getRegions()); - $record['layout']['settings']['classes'] = []; - $record['layout']['settings']['wrappers'] = []; - // Set default region values. - foreach ($sl->getRegions() as $region_name => $content) { - $record['layout']['settings']['wrappers'][$region_name] = 'div'; - } - $record['layout']['settings']['outer_wrapper'] = 'div'; - $record['layout']['settings']['attributes'] = ''; - $record['layout']['settings']['link_attribute'] = FALSE; - $record['layout']['settings']['link_custom'] = ''; - $fields = _ds_sort_fields($form_state->getValue('fields'), 'weight'); - foreach ($fields as $field_key => $field) { - - // Ignore new fieldgroup, new field or existing field. - if (in_array($field_key, [ - '_add_new_field', - '_add_existing_field', - '_add_new_group', - ])) { - continue; - } - - // Can either be form or display. - if ((isset($field['type']) && $field['type'] != 'hidden')) { - $record['regions'][$first_region][] = $field_key; - } - } - // In case this is the full node view mode and if the comment module - // is enabled for this content type, add it as well. - if ($entity_type == 'node' && $view_mode == 'full' && \Drupal::moduleHandler()->moduleExists('comment')) { - $record['regions'][$first_region][] = 'comments'; - } - } - // Update existing layout. - elseif (!empty($layout)) { - $save_display = TRUE; - - $fields = _ds_sort_fields($form_state->getValue('fields'), 'weight'); - - foreach ($fields as $key => $field) { - // Make sure to hide hidden fields. - if ($field['region'] == 'hidden') { - $form_state->setValue(['fields', $key, 'type'], 'hidden'); - continue; - } - - if (!isset($record['regions'][$field['region']])) { - $record['regions'][$field['region']] = []; - } - $record['regions'][$field['region']][] = $key; - } - - /* @var \Drupal\layout_plugin\Plugin\Layout\LayoutInterface $layout_plugin */ - $layout_plugin = \Drupal::service('plugin.manager.core.layout')->createInstance($layout, []); - $layout_form = isset($form['layout_configuration']) ? $form['layout_configuration'] : []; - foreach (Element::children($form) as $name) { - if (!empty($form[$name]['#ds_layout_configuration'])) { - $layout_form[$name] = $form[$name]; - } - } - if ($layout_plugin instanceof PluginFormInterface) { - $layout_form_state = (new FormState())->setValues($form_state->getValue('layout_configuration', [])); - $layout_plugin->submitConfigurationForm($layout_form, $layout_form_state); - } - - // Get the layout settings from the layout_plugin. - $record['layout']['settings'] = $layout_plugin->getConfiguration(); - - // Let other modules alter the layout settings. - \Drupal::moduleHandler()->alter('ds_layout_settings', $record, $form_state); - } - - // Save the configuration. - if ($save_display) { - // Let other modules alter the layout settings. - \Drupal::moduleHandler()->alter('ds_layout_settings', $record, $form_state); - - foreach (array_keys($record) as $key) { - $display->setThirdPartySetting('ds', $key, $record[$key]); - } - $display->save(); - } -} - -/** - * Form validation handler for _ds_field_ui_fields(). - */ -function ds_field_ui_fields_validate($form, FormStateInterface $form_state) { - $fields = $form_state->getValue('fields'); - foreach (Element::children($form['fields']) as $key) { - if (isset($fields[$key]['settings_edit_form']['settings'])) { - $settings = $fields[$key]['settings_edit_form']['settings']; - if (!empty($settings)) { - $plugin_settings = $form_state->get('plugin_settings'); - $plugin_settings[$key] = $settings; - $form_state->set('plugin_settings', $plugin_settings); - } - } - - if (isset($fields[$key]['settings_edit_form']['third_party_settings']['ds'])) { - $settings = $fields[$key]['settings_edit_form']['third_party_settings']['ds']; - if (!empty($settings)) { - $plugin_settings = $form_state->get('plugin_settings'); - $plugin_settings[$key] = $settings; - $form_state->set('plugin_settings', $plugin_settings); - } - } - } -} - -/** - * Save the field settings from the 'Manage display' screen. - */ -function ds_field_ui_fields_save($form, FormStateInterface $form_state) { - if (empty($form['#ds_fields']) || $form_state->has('ignore_ds_fields')) { - return; - } - - // Get the entity display. - /* @var \Drupal\Core\Entity\EntityFormInterface $entity_form */ - $entity_form = $form_state->getFormObject(); - /* @var \Drupal\Core\Entity\Display\EntityDisplayInterface $display */ - $display = $entity_form->getEntity(); - - $field_settings = []; - - // Fetch values from form_state. - $all_field_values = $form_state->getValue('fields'); - $all_plugin_settings = $form_state->get('plugin_settings'); - - // Save settings for each Display Suite field. - $ds_fields = $form['#ds_fields']; - foreach ($ds_fields as $field) { - - $field_values = $all_field_values[$field]; - - // In case the region is hidden, do not save. - if (isset($field_values['region']) && $field_values['region'] == 'hidden') { - continue; - } - - // Build settings. - $settings = []; - $settings['plugin_id'] = $field; - $settings['weight'] = $field_values['weight']; - $settings['label'] = $field_values['label']; - $settings['formatter'] = $field_values['plugin']['type']; - - // Any formatter settings. - if (isset($all_plugin_settings[$field]['settings'])) { - $settings['settings'] = $all_plugin_settings[$field]['settings']; - } - elseif (isset($all_plugin_settings[$field])) { - // When the settings for that fields aren't changed the structure is - // different. - // @todo figure out how we can fix this. - $settings['settings'] = $all_plugin_settings[$field]; - } - - $field_settings[$field] = $settings; - - // Always unset the field template settings from the regular settings array. - // @todo needs serious review. - unset($field_settings[$field]['settings']['ft']); - - // Add field template plugin settings if provided. - $values = isset($all_plugin_settings[$field]['ft']) ? $all_plugin_settings[$field]['ft'] : []; - - if (!empty($values)) { - $field_settings[$field]['ft'] = $values; - - $default_field_function = \Drupal::config('ds.settings')->get('ft-default'); - $function = isset($values['id']) ? $values['id'] : $default_field_function; - $field_settings[$field]['ft']['id'] = $function; - - // It's important for schema validation to never save empty arrays. - if (empty($field_settings[$field]['ft']['settings'])) { - unset($field_settings[$field]['ft']['settings']); - } - } - - // Last but not least unset the settings if they are empty after moving the - // field template settings. - if (empty($field_settings[$field]['settings'])) { - unset($field_settings[$field]['settings']); - } - } - - // Save the record. - $display->unsetThirdPartySetting('ds', 'fields'); - if (!empty($field_settings)) { - $display->setThirdPartySetting('ds', 'fields', $field_settings); - } - $display->save(); - - // Clear the ds_fields cache. - Cache::invalidateTags(['ds_fields_info']); -} - -/** - * Clone a fields layout. - */ -function ds_field_ui_layout_clone($form, FormStateInterface $form_state) { - $clone = $form_state->getValue('clone'); - list(, , $cv) = explode('.', $clone); - $entity_type = $form['#entity_type']; - $bundle = $form['#bundle']; - - /* @var \Drupal\Core\Entity\EntityFormInterface $entity_form */ - $entity_form = $form_state->getFormObject(); - - // Get the entity display. - /* @var \Drupal\Core\Entity\Display\EntityDisplayInterface $old_display */ - $old_display = $entity_form->getEntity(); - $view_mode = $old_display->getMode(); - $old_display->delete(); - - /* @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display */ - $display = EntityViewDisplay::load($entity_type . '.' . $bundle . '.' . $cv); - - $clone_display = $display->createCopy($view_mode); - $clone_display->save(); - - // Show message. - drupal_set_message(t('The layout has been cloned.')); -} - -/** - * Creates a summary for the field format configuration summary. - * - * @param \Drupal\ds\Plugin\DsField\DsFieldInterface $plugin_instance - * An instance of the plugin. - * @param array $settings - * The passed settings. - * @param \Drupal\Core\Form\FormStateInterface $form_state - * The form state of the summary. - * - * @return array - * The summary. - */ -function ds_field_settings_summary(DsFieldInterface $plugin_instance, array $settings, FormStateInterface $form_state) { - // Create the form. - $summary = $plugin_instance->settingsSummary($settings); - - // Add field template summary. - ds_field_formatter_settings_summary_alter($summary, ['field_definition' => $plugin_instance, 'form_state' => $form_state]); - - if (empty($summary)) { - return []; - } - - return [ - '#type' => 'inline_template', - '#template' => '<div class="field-plugin-summary">{{ summary|safe_join("<br />") }}</div>', - '#context' => ['summary' => $summary], - '#cell_attributes' => ['class' => ['field-plugin-summary-cell']], - ]; -} - -/** - * Creates a form for Display Suite fields. - * - * @param \Drupal\ds\Plugin\DsField\DsFieldInterface $plugin_instance - * An instance of the plugin. - * @param \Drupal\Core\Form\FormStateInterface $form_state - * The form state of the form. - * - * @return mixed - * The altered form. - */ -function ds_field_settings_form(DsFieldInterface $plugin_instance, FormStateInterface $form_state) { - // Create the form. - $form = $plugin_instance->settingsForm([], $form_state); - - // Add field template settings to every field if enabled. - if (\Drupal::config('ds.settings')->get('field_template')) { - $context = [ - 'instance' => [ - 'entity_type' => $plugin_instance->getEntityTypeId(), - 'bundle' => $plugin_instance->bundle(), - 'field_name' => $plugin_instance->getName(), - ], - 'view_mode' => $plugin_instance->viewMode(), - ]; - - ds_field_template_settings_form($form, $form_state, $context); - } - - return $form; -} - -/** - * Add fake field group value in. - * - * @param array $form - * The actual form. - * @param \Drupal\Core\Form\FormStateInterface $form_state - * The form state of the form. - */ -function _ds_field_group_field_ui_fix_notices(array $form, FormStateInterface $form_state) { - $field_group = [ - 'group_name' => '', - 'label' => '', - ]; - $fields = $form_state->getValue('fields'); - $fields['_add_new_group'] = $field_group; - $form_state->setValue('fields', $fields); -} - -/** - * Add the layouts fieldset on the Field UI screen. - * - * @param string $entity_type - * The name of the entity type. - * @param string $bundle - * The name of the bundle. - * @param string $view_mode - * The name of the view_mode. - * @param array $form - * A collection of form properties. - * @param \Drupal\Core\Form\FormStateInterface $form_state - * The form_state. - */ -function _ds_field_ui_table_layouts($entity_type, $bundle, $view_mode, array &$form, FormStateInterface $form_state) { - $ds_layouts = Ds::getLayouts(); - $layout_options = []; - /** @var \Drupal\Core\Layout\LayoutDefinition $layout_definition */ - foreach ($ds_layouts as $key => $layout_definition) { - // Create new layout option group. - $optgroup = $layout_definition->getCategory() ?: t('Other'); - if (!isset($layout_options[$optgroup])) { - $layout_options[$optgroup] = []; - } - - // Stack the layout. - $layout_options[$optgroup][$key] = $layout_definition->getLabel(); - } - - // If there is only one $optgroup, move it to the root. - if (count($layout_options) == 1) { - $layout_options = reset($layout_options); - } - - // Add layouts form. - $form['ds_layouts'] = [ - '#type' => 'details', - '#title' => t('Layout for @bundle in @view_mode', [ - '@bundle' => str_replace('_', ' ', $bundle), - '@view_mode' => str_replace('_', ' ', $view_mode), - ]), - '#collapsible' => TRUE, - '#group' => 'additional_settings', - '#collapsed' => FALSE, - '#weight' => -100, - ]; - - // @todo cleanup - $layout = []; - /* @var \Drupal\Core\Entity\EntityFormInterface $entity_form */ - $entity_form = $form_state->getFormObject(); - /* @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display */ - $display = $entity_form->getEntity(); - if ($display->getThirdPartySetting('ds', 'layout')) { - $layout_configuration = $display->getThirdPartySetting('ds', 'layout'); - $layout = (array) $ds_layouts[$layout_configuration['id']]; - $layout['layout'] = $layout_configuration['id']; - $layout['disable_css'] = $layout_configuration['disable_css']; - $layout['entity_classes'] = $layout_configuration['entity_classes']; - $layout['settings'] = $layout_configuration['settings'] ?: []; - $layout['regions'] = $display->getThirdPartySetting('ds', 'regions'); - $layout['fields'] = $display->getThirdPartySetting('ds', 'fields'); - } - - if (!empty($layout) && isset($layout['layout']) && isset($ds_layouts[$layout['layout']])) { - $layout['region_names'] = $ds_layouts[$layout['layout']]->getRegions(); - $form['#ds_layout'] = $layout; - } - - // Load the layout preview form. - $layout['layout_options'] = $layout_options; - _ds_field_ui_table_layouts_preview($form, $form_state, $ds_layouts, $layout, $display); - - if (!empty($layout) && !empty($layout['settings'])) { - /* @var \Drupal\Core\Layout\LayoutInterface $layout_plugin */ - $layout_plugin = \Drupal::service('plugin.manager.core.layout')->createInstance($layout['layout'], $layout['settings'] ?: []); - - if ($layout_plugin instanceof PluginFormInterface) { - $layout_configuration_form = $layout_plugin->buildConfigurationForm([], $form_state); - - // Merge 'details' elements in 'additional_settings' group into the main - // form. - foreach (Element::children($layout_configuration_form) as $name) { - $element = $layout_configuration_form[$name]; - if ($element['#type'] == 'details' && $element['#group'] == 'additional_settings') { - $form[$name] = $layout_configuration_form[$name]; - unset($layout_configuration_form[$name]); - - $form[$name]['#ds_layout_configuration'] = TRUE; - $form[$name]['#parents'] = ['layout_configuration', $name]; - $form[$name]['#tree'] = TRUE; - - if ($layout['layout'] === 'ds_reset') { - $form[$name]['#access'] = FALSE; - } - } - } - - // If anything is left, then we put it on it's own vertial tab. - if (!Element::isEmpty($layout_configuration_form)) { - $form['layout_configuration'] = array_merge($layout_configuration_form, [ - '#group' => 'additional_settings', - '#type' => 'details', - '#title' => t('Layout settings'), - '#tree' => TRUE, - ]); - } - } - } - else { - // See if we can clone from another view mode. - $options = []; - $entity_displays = \Drupal::configFactory()->listAll('core.entity_view_display.' . $entity_type . '.' . $bundle); - foreach ($entity_displays as $name) { - $row = \Drupal::config($name)->get(); - if ($row['mode'] == $view_mode) { - continue; - } - if ($row['targetEntityType'] == $entity_type && $row['bundle'] == $bundle) { - $options[$row['id']] = Unicode::ucfirst(str_replace('_', ' ', $row['targetEntityType'])) . ' > ' . Unicode::ucfirst(str_replace('_', ' ', $row['bundle'])) . ' > ' . Unicode::ucfirst(str_replace('_', ' ', $row['mode'])); - } - } - - if (!empty($options)) { - - // Clone from another layout. - $form['ds_clone'] = [ - '#type' => 'details', - '#group' => 'additional_settings', - '#title' => t('Clone layout'), - '#collapsible' => TRUE, - '#collapsed' => TRUE, - ]; - $form['ds_clone']['clone'] = [ - '#title' => t('Select an existing layout to clone.'), - '#type' => 'select', - '#options' => $options, - '#weight' => 20, - ]; - $form['ds_clone']['clone_submit'] = [ - '#type' => 'submit', - '#value' => t('Clone layout'), - '#submit' => ['ds_field_ui_layout_clone'], - '#weight' => 21, - ]; - } - } - - $form['ds_layouts']['old_layout'] = [ - '#type' => 'value', - '#value' => isset($layout['layout']) ? $layout['layout'] : 0, - ]; - - // Add validate and submit handlers. Layout needs be first so - // we can reset the type key for Field API fields. - $form['#validate'][] = 'ds_field_ui_layouts_validate'; - array_unshift($form['actions']['submit']['#submit'], 'ds_field_ui_fields_save'); - array_unshift($form['actions']['submit']['#submit'], 'ds_field_ui_layouts_save'); -} - -/** - * Add the layout previews to the Field UI screen. - * - * @param array $form - * A collection of form properties. - * @param \Drupal\Core\Form\FormStateInterface $form_state - * The state of the form. - * @param array $ds_layouts - * Collection of all the layouts. - * @param array $layout - * Current selected layout. - * @param \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display - * The entity display object. - */ -function _ds_field_ui_table_layouts_preview(array &$form, FormStateInterface $form_state, array $ds_layouts, array $layout, EntityViewDisplayInterface $display) { - $layout_string = ''; - - $form['ds_layouts']['layout'] = [ - '#type' => 'select', - '#title' => t('Select a layout'), - '#options' => $layout['layout_options'], - '#default_value' => isset($layout['layout']) ? $layout['layout'] : NULL, - '#empty_value' => '_none', - '#weight' => -1, - '#ajax' => [ - 'callback' => 'ds_field_ui_table_layouts_preview_callback', - 'wrapper' => 'ds_layout_wrapper', - ], - ]; - - if (!isset($layout['layout'])) { - $form['ds_layouts']['layout']['#description'] = t("A layout must be selected to enable Display Suite functionality."); - } - - $form['ds_layouts']['preview'] = [ - '#type' => 'container', - '#prefix' => '<div id="ds_layout_wrapper">', - '#suffix' => '</div>', - '#weight' => -3, - ]; - - if (isset($layout['layout']) || $form_state->hasValue('layout')) { - $layout_string = $form_state->hasValue('layout') ? $form_state->getValue('layout') : $layout['layout']; - } - - if (!empty($layout_string)) { - /** @var \Drupal\Core\Layout\LayoutDefinition $chosen_layout */ - $chosen_layout = $ds_layouts[$layout_string]; - $selected = '<strong>' . $chosen_layout->getLabel() . '</strong>'; - $selected .= '<br/>' . t('The default template can be found in %path', ['%path' => $chosen_layout->getPath() . '/' . $chosen_layout->getTemplate()]); - $suggestions_array = []; - $suggestions_array[0] = $chosen_layout->getTemplate() . '--' . $display->getTargetEntityTypeId(); - $suggestions_array[2] = $chosen_layout->getTemplate() . '--' . $display->getTargetEntityTypeId() . '-' . $display->getTargetBundle(); - $suggestions_array[4] = $chosen_layout->getTemplate() . '--' . $display->getTargetEntityTypeId() . '--{id}'; - if ($display->getMode() != 'default') { - $suggestions_array[1] = $chosen_layout->getTemplate() . '--' . $display->getTargetEntityTypeId() . '-' . $display->getMode(); - $suggestions_array[3] = $chosen_layout->getTemplate() . '--' . $display->getTargetEntityTypeId() . '-' . $display->getTargetBundle() . '-' . $display->getMode(); - } - - ksort($suggestions_array); - - // Append correct extension. - foreach ($suggestions_array as $key => $value) { - $suggestion_replace = strtr($suggestions_array[$key], '_', '-'); - $suggestions_array[$key] = $suggestion_replace . '.html.twig'; - } - - if ($form_state->hasValue('layout') || (!empty($layout) && isset($layout['regions']))) { - $fallback_image = drupal_get_path('module', 'ds') . '/images/preview.png'; - $current_layout = $form_state->hasValue('layout') && (!isset($layout->layout) || $form_state->getValue('layout') != $layout->layout) ? t('Current layout (after save)') : t('Current layout'); - $image = $chosen_layout->getIconPath(); - if (empty($image)) { - $image = $fallback_image; - } - - $form['ds_layouts']['preview']['title'] = [ - '#markup' => '<div class="ds-layout-preview-title">' . $current_layout . '</div>', - ]; - $form['ds_layouts']['preview']['image'] = [ - '#markup' => '<div class="ds-layout-preview-image"><img src="' . base_path() . $image . '"/></div>', - ]; - $form['ds_layouts']['preview']['info'] = [ - '#type' => 'container', - '#attributes' => [ - 'class' => ['ds-layout-preview-suggestion'], - ], - ]; - $form['ds_layouts']['preview']['info']['suggestions'] = [ - '#markup' => '<p>' . $selected . '</p><p>' . t('Template suggestions') . ':' . '</p>', - ]; - $form['ds_layouts']['preview']['info']['suggestions_list'] = [ - '#theme' => 'item_list', - '#items' => $suggestions_array, - ]; - - if (!empty($chosen_layout->getLibrary())) { - $disable_css = FALSE; - - if (isset($layout['disable_css'])) { - $disable_css = $layout['disable_css']; - } - if ($form_state->hasValue('disable_css') && $disable_css !== $form_state->getValue('disable_css')) { - $disable_css = $form_state->getValue('disable_css'); - } - - $form['ds_layouts']['preview']['info']['settings']['disable_css'] = array( - '#type' => 'checkbox', - '#title' => t('Disable layout CSS styles'), - '#default_value' => $disable_css, - ); - } - - $entity_classes = 'all_classes'; - if (isset($layout['entity_classes'])) { - $entity_classes = $layout['entity_classes']; - } - if ($form_state->hasValue('entity_classes') && $entity_classes !== $form_state->getValue('entity_classes')) { - $entity_classes = $form_state->getValue('entity_classes'); - } - - // Default classes. - $form['ds_layouts']['preview']['info']['settings']['entity_classes'] = [ - '#type' => 'select', - '#title' => t('Entity classes'), - '#options' => [ - 'all_classes' => t('Entity, bundle and view mode'), - 'no_classes' => t('No classes'), - 'old_view_mode' => t('View mode (deprecated)'), - ], - '#default_value' => $entity_classes, - ]; - - $form['ds_layouts']['preview']['clear'] = [ - '#markup' => '<div class="ds-after-suggestion"></div>', - ]; - } - - if (!isset($layout['layout']) || $layout_string != $layout['layout']) { - - // Get admin path. - $route = FieldUI::getOverviewRouteInfo($display->getTargetEntityTypeId(), $display->getTargetBundle()); - $route_parameters = $route->getRouteParameters(); - $route_parameters['view_mode_name'] = $display->getMode(); - $options = $route->getOptions(); - $route_name = 'entity.entity_view_display.' . $display->getTargetEntityTypeId() . '.view_mode'; - - $admin_path = \Drupal::service('url_generator')->generateFromRoute($route_name, $route_parameters, $options); - $destination_url = ''; - - // If regions aren't set we don't have to move fields. - if (isset($layout['regions'])) { - $route_name = 'ds.change_layout'; - $route_parameters = [ - 'entity_type' => $display->getTargetEntityTypeId(), - 'bundle' => $display->getTargetBundle(), - 'display_mode' => $display->getMode(), - 'new_layout' => $layout_string, - ]; - $options = []; - $destination_url = $admin_path; - } - - $form['layout_changed_url'] = [ - '#type' => 'value', - '#value' => [ - 'route_name' => $route_name, - 'route_parameters' => $route_parameters, - 'destination_url' => $destination_url, - 'options' => $options, - ], - ]; - - array_unshift($form['actions']['submit']['#submit'], 'ds_field_ui_change_layout_submit'); - } - } -} - -/** - * Ajax callback for _ds_field_ui_table_layouts_preview(). - */ -function ds_field_ui_table_layouts_preview_callback($form, FormStateInterface $form_state) { - return $form['ds_layouts']['preview']; -} - -/** - * Form submission handler for _ds_field_ui_table_layouts_preview(). - */ -function ds_field_ui_change_layout_submit($form, FormStateInterface $form_state) { - // Remove original destination. - \Drupal::request()->query->remove('destination'); - - $destination = $form_state->getValue('layout_changed_url'); - - $redirectUrl = new Url( - $destination['route_name'], - $destination['route_parameters'], - $destination['options'] - ); - - if (!empty($destination['destination_url'])) { - $redirectUrl->setOption('query', ['destination' => $destination['destination_url']]); - } - - $form_state->setRedirectUrl($redirectUrl); -} - -/** - * Add the fields to the Field UI form. - * - * @param string $entity_type - * The name of the entity type. - * @param string $bundle - * The name of the bundle. - * @param string $view_mode - * The name of the view_mode. - * @param array $form - * A collection of form properties. - * @param \Drupal\Core\Form\FormStateInterface $form_state - * A collection of form_state properties. - */ -function _ds_field_ui_fields($entity_type, $bundle, $view_mode, array &$form, FormStateInterface $form_state) { - - // Do not add the fields if there is no layout. - if (!isset($form['#ds_layout'])) { - return; - } - - // Get the fields and put them on the form. - $fields = Ds::getFields($entity_type); - - // Get field settings. - $field_settings = $form['#ds_layout']['fields']; - $form['#field_settings'] = $field_settings; - - $table = &$form['fields']; - $form['#ds_fields'] = []; - - $field_label_options = [ - 'above' => t('Above'), - 'inline' => t('Inline'), - 'hidden' => t('- Hidden -'), - ]; - \Drupal::moduleHandler()->alter('ds_label_options', $field_label_options); - - /* @var \Drupal\Core\Entity\EntityFormInterface $entity_form */ - $entity_form = $form_state->getFormObject(); - /* @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display */ - $display = $entity_form->getEntity(); - $parent_options = []; - - if (function_exists('field_group_field_ui_form_params')) { - $field_group_params = field_group_field_ui_form_params($form, $display); - foreach ($field_group_params->groups as $name => $group) { - $parent_options[$name] = $group->label; - } - $parent_options['_add_new_group'] = t('Add new group'); - } - - foreach ($fields as $key => $field) { - if (isset($field_settings[$key]['formatter'])) { - $field['formatter'] = $field_settings[$key]['formatter']; - } - $configuration = [ - 'field' => $field, - 'field_name' => $key, - 'entity_type' => $entity_type, - 'bundle' => $bundle, - 'view_mode' => $view_mode, - ]; - - // Check if we can display this field here. - /* @var $plugin_instance DsFieldInterface */ - $plugin_instance = \Drupal::service('plugin.manager.ds')->createInstance($field['plugin_id'], $configuration); - - if (!$plugin_instance->isAllowed()) { - continue; - } - - // Don't filter out fields when $displays is empty. - if (!empty($displays)) { - $continue = TRUE; - foreach ($displays as $limitation) { - list($limit_bundle, $limit_view_mode) = explode('|', $limitation); - if ($limit_bundle == '*' || $limit_bundle == $bundle) { - if ($limit_view_mode == '*' || $limit_view_mode == $view_mode) { - $continue = FALSE; - } - } - } - - if ($continue) { - continue; - } - } - - $form['#ds_fields'][] = $key; - - // Fetch saved plugin settings. - $form_state_plugin_settings = $form_state->get('plugin_settings'); - - // Check on formatter settings. - $plugin_settings = []; - if (isset($form_state_plugin_settings[$key])) { - $plugin_settings = $form_state_plugin_settings[$key]; - } - elseif (isset($field_settings[$key]['settings']) || isset($field_settings[$key]['ft']) || isset($field_settings[$key]['ds_limit'])) { - if (isset($field_settings[$key]['settings'])) { - $plugin_settings = $field_settings[$key]['settings']; - } - if (isset($field_settings[$key]['ft'])) { - $plugin_settings['ft'] = $field_settings[$key]['ft']; - } - if (isset($field_settings[$key]['ds_limit'])) { - $plugin_settings['ds_limit'] = $field_settings[$key]['ds_limit']; - } - $form_state_plugin_settings[$key] = $plugin_settings; - } - $plugin_instance->setConfiguration($plugin_settings); - - // Save fetched plugin settings. - $form_state->set('plugin_settings', $form_state_plugin_settings); - - $hidden = ['hidden' => t('- Hidden -')]; - - // Get the formatters from the field instance. - $formatters = $plugin_instance->formatters(); - - // This should be temporary. Don't want to copy stuff from the object to - // the field each ajax refresh. - if (!empty($formatters)) { - $formatters = $hidden + $formatters; - } - else { - $formatters = $hidden + ['default' => t('Default')]; - } - - $table[$key] = [ - '#row_type' => 'field', - '#js_settings' => ['field'], - '#region_callback' => 'field_ui_display_overview_row_region', - '#attributes' => ['class' => ['draggable', 'tabledrag-leaf']], - 'human_name' => [ - '#plain_text' => $field['title'], - ], - 'weight' => [ - '#type' => 'textfield', - '#default_value' => isset($field_settings[$key]['weight']) ? $field_settings[$key]['weight'] : 0, - '#size' => 3, - '#attributes' => ['class' => ['field-weight']], - ], - 'parent_wrapper' => [ - 'parent' => [ - '#type' => 'select', - '#empty_value' => '', - '#options' => $parent_options, - '#default_value' => isset($field_group_params->parents[$key]) ? $field_group_params->parents[$key] : '', - '#attributes' => ['class' => ['field-parent']], - '#parents' => ['fields', $key, 'parent'], - ], - 'hidden_name' => [ - '#type' => 'hidden', - '#default_value' => $key, - '#attributes' => ['class' => ['field-name']], - ], - ], - 'label' => [ - '#type' => 'select', - '#options' => $field_label_options, - '#default_value' => isset($field_settings[$key]['label']) ? $field_settings[$key]['label'] : 'hidden', - ], - 'plugin' => [ - 'type' => [ - '#type' => 'select', - '#options' => $formatters, - '#default_value' => isset($field_settings[$key]['formatter']) ? $field_settings[$key]['formatter'] : 'hidden', - '#attributes' => ['class' => ['field-plugin-type']], - ], - ], - 'settings_summary' => [], - 'settings_edit' => [], - ]; - - if ($form_state->get('plugin_settings_edit') == $key) { - $table[$key]['settings_summary']['#attributes']['colspan'] = 2; - $settings_form = ds_field_settings_form($plugin_instance, $form_state); - ds_field_row_form_format_construct($table, $key, $settings_form, $form_state); - } - else { - // After saving, the settings are updated here as well. First we create - // the element for the table cell. - $summary = ds_field_settings_summary($plugin_instance, $plugin_settings, $form_state); - - if (!empty($summary)) { - $table[$key]['settings_summary'] = $summary; - ds_field_row_form_format_summary_construct($table, $key, $form_state); - } - } - } -} - -/** - * Alter the core field on the the Field UI form. - * - * @param array $form - * A collection of form properties. - * @param \Drupal\Core\Form\FormStateInterface $form_state - * A collection of form_state properties. - */ -function _ds_field_ui_core_fields(array &$form, FormStateInterface $form_state) { - $entity_type = $form['#entity_type']; - $bundle = $form['#bundle']; - /* @var \Drupal\Core\Entity\EntityFormInterface $entity_form */ - $entity_form = $form_state->getFormObject(); - /* @var EntityViewDisplay $entity_display */ - $entity_display = $entity_form->getEntity(); - - // Gather type information. - $instances = \Drupal::service('entity_field.manager')->getFieldDefinitions($entity_type, $bundle); - $table = &$form['fields']; - - // Get all persisted values for fields and plugin settings. - $form_state_plugin_settings = $form_state->get('plugin_settings'); - - // Field rows. - foreach ($instances as $key => $instance) { - if ($instance instanceof FieldConfigInterface) { - - $settings = $entity_display->getComponent($key); - if (empty($settings)) { - continue; - } - - if (isset($form_state_plugin_settings[$key])) { - $settings = array_merge($settings, $form_state_plugin_settings[$key]); - } - - // Import field settings and merge with Field API settings. - if (!isset($form_state_plugin_settings[$key])) { - $form_state_plugin_settings[$key] = isset($settings['third_party_settings']['ds']) ? $settings['third_party_settings']['ds'] : []; - } - - if ($form_state->get('plugin_settings_edit') == $key) { - $table[$key]['plugin']['settings_edit_form']['actions']['save_settings']['#validate'] = ['ds_field_ui_fields_validate']; - $table[$key]['plugin']['settings_edit_form']['actions']['cancel_settings']['#validate'] = ['ds_field_ui_fields_validate']; - } - else { - if (!empty($table[$key]['settings_summary'])) { - ds_field_row_form_format_summary_construct($table, $key, $form_state); - } - } - } - } - - // Set updated plugin settings. - $form_state->set('plugin_settings', $form_state_plugin_settings); -} - -/** - * Helper function for building the formatter settings. - */ -function ds_field_row_form_format_construct(&$table, $key, $settings_form, FormStateInterface $form_state) { - $build_info = $form_state->getBuildInfo(); - $base_button = [ - '#submit' => [ - [$build_info['callback_object'], 'multistepSubmit'], - ], - '#validate' => [ - 'ds_field_ui_fields_validate', - ], - '#ajax' => [ - 'callback' => [$build_info['callback_object'], 'multistepAjax'], - 'wrapper' => 'field-display-overview-wrapper', - 'effect' => 'fade', - ], - '#field_name' => $key, - ]; - $table[$key]['plugin']['settings_edit'] = [ - '#type' => 'container', - '#attributes' => ['class' => ['field-plugin-settings-edit-form']], - '#parents' => ['fields', $key, 'settings_edit_form'], - '#weight' => -5, - // Create a settings form where hooks can pick in. - 'settings' => $settings_form, - 'actions' => [ - '#type' => 'actions', - 'save_settings' => $base_button + [ - '#type' => 'submit', - '#name' => $key . '_plugin_settings_update', - '#value' => t('Update'), - '#op' => 'update', - ], - 'cancel_settings' => $base_button + [ - '#type' => 'submit', - '#name' => $key . '_plugin_settings_cancel', - '#value' => t('Cancel'), - '#op' => 'cancel', - // Do not check errors for the 'Cancel' button. - '#limit_validation_errors' => [], - ], - ], - ]; - $table[$key]['#attributes']['class'][] = 'field-plugin-settings-editing'; - $table[$key]['plugin']['type']['#attributes']['class'] = ['visually-hidden']; -} - -/** - * Helper function for formatter summary settings. - */ -function ds_field_row_form_format_summary_construct(&$table, $key, FormStateInterface $form_state) { - $build_info = $form_state->getBuildInfo(); - - $base_button = [ - '#submit' => [[$build_info['callback_object'], 'multistepSubmit']], - '#ajax' => [ - 'callback' => [$build_info['callback_object'], 'multistepAjax'], - 'wrapper' => 'field-display-overview-wrapper', - 'effect' => 'fade', - ], - '#field_name' => $key, - ]; - - // Add the configure button. - $table[$key]['settings_edit'] = $base_button + [ - '#type' => 'image_button', - '#name' => $key . '_plugin_settings_edit', - '#src' => 'core/misc/icons/787878/cog.svg', - '#attributes' => ['class' => ['field-plugin-settings-edit'], 'alt' => t('Edit')], - '#op' => 'edit', - // Do not check errors for the 'Edit' button, but make sure we get - // the value of the 'plugin type' select. - '#limit_validation_errors' => [['fields', $key, 'type']], - '#prefix' => '<div class="field-plugin-settings-edit-wrapper">', - '#suffix' => '</div>', - ]; -} - -/** - * Utility function to sort a multidimensional array by a value in a sub-array. - * - * @param array $a - * The array to sort. - * @param string $subkey - * The subkey to sort by. - * - * @return array - * The sorted array. - */ -function _ds_sort_fields(array $a, $subkey) { - $c = []; - foreach ($a as $k => $v) { - if (isset($v[$subkey])) { - $b[$k] = $v[$subkey]; - } - } - asort($b); - foreach ($b as $key => $val) { - $c[$key] = $a[$key]; - } - return $c; -} diff --git a/web/modules/ds/js/ds.admin.js b/web/modules/ds/js/ds.admin.js deleted file mode 100644 index 00dec9ed5d..0000000000 --- a/web/modules/ds/js/ds.admin.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * @file - * Javascript functionality for Display Suite's administration UI. - */ - -(function ($, Drupal) { - - 'use strict'; - - Drupal.behaviors.DSSummaries = { - attach: function (context) { - var $context = $(context); - $context.find('#edit-fs1').drupalSetSummary(function (context) { - var fieldtemplates = $('#edit-fs1-field-template', context); - - if (fieldtemplates.is(':checked')) { - var fieldtemplate = $('#edit-fs1-ft-default option:selected').text(); - return Drupal.t('Enabled') + ': ' + Drupal.t(fieldtemplate); - } - - return Drupal.t('Disabled'); - }); - } - }; - -})(jQuery, Drupal); diff --git a/web/modules/ds/modules/ds_devel/ds_devel.info.yml b/web/modules/ds/modules/ds_devel/ds_devel.info.yml deleted file mode 100644 index e04d4d2d31..0000000000 --- a/web/modules/ds/modules/ds_devel/ds_devel.info.yml +++ /dev/null @@ -1,14 +0,0 @@ -type: module -name: 'Display Suite Devel' -description: 'Development functionality for Display Suite.' -# core: 8.x -package: 'Display Suite' -dependencies: - - ds:ds - - devel:devel - -# Information added by Drupal.org packaging script on 2017-05-24 -version: '8.x-3.1' -core: '8.x' -project: 'ds' -datestamp: 1495660091 diff --git a/web/modules/ds/modules/ds_devel/ds_devel.links.task.yml b/web/modules/ds/modules/ds_devel/ds_devel.links.task.yml deleted file mode 100644 index 31adc8ea6d..0000000000 --- a/web/modules/ds/modules/ds_devel/ds_devel.links.task.yml +++ /dev/null @@ -1,3 +0,0 @@ -ds_devel.entities: - class: \Drupal\Core\Menu\LocalTaskDefault - deriver: \Drupal\ds_devel\Plugin\Derivative\DsDevelLocalTask diff --git a/web/modules/ds/modules/ds_devel/ds_devel.module b/web/modules/ds/modules/ds_devel/ds_devel.module deleted file mode 100644 index ced6d038ba..0000000000 --- a/web/modules/ds/modules/ds_devel/ds_devel.module +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -/** - * @file - * Display Suite devel integration. - */ - -/** - * Implements hook_entity_type_alter(). - */ -function ds_devel_entity_type_alter(array &$entity_types) { - /* @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */ - foreach ($entity_types as $entity_type_id => $entity_type) { - if ($entity_type->hasViewBuilderClass() && $entity_type->hasLinkTemplate('canonical')) { - $entity_type->setLinkTemplate('devel-markup', $entity_type->getLinkTemplate('canonical') . '/devel/markup'); - } - } -} diff --git a/web/modules/ds/modules/ds_devel/ds_devel.services.yml b/web/modules/ds/modules/ds_devel/ds_devel.services.yml deleted file mode 100644 index a7cd5e6d6b..0000000000 --- a/web/modules/ds/modules/ds_devel/ds_devel.services.yml +++ /dev/null @@ -1,6 +0,0 @@ -services: - ds_devel.route_subscriber: - class: Drupal\ds_devel\Routing\RouteSubscriber - arguments: ['@entity.manager'] - tags: - - { name: event_subscriber } diff --git a/web/modules/ds/modules/ds_devel/src/Controller/DsDevelController.php b/web/modules/ds/modules/ds_devel/src/Controller/DsDevelController.php deleted file mode 100644 index 46388e388b..0000000000 --- a/web/modules/ds/modules/ds_devel/src/Controller/DsDevelController.php +++ /dev/null @@ -1,117 +0,0 @@ -<?php - -namespace Drupal\ds_devel\Controller; - -use Drupal\Component\Utility\Html; -use Drupal\Core\Controller\ControllerBase; -use Drupal\Core\Entity\EntityDisplayRepositoryInterface; -use Drupal\Core\Render\RendererInterface; -use Drupal\Core\Routing\RouteMatchInterface; -use Drupal\Core\Url; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\HttpFoundation\Request; - -/** - * Returns responses for Views UI routes. - */ -class DsDevelController extends ControllerBase { - - /** - * The entity display repository. - * - * @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface - */ - protected $entityDisplayRepository; - - /** - * The current request. - * - * @var \Symfony\Component\HttpFoundation\Request - */ - protected $currentRequest; - - /** - * The renderer. - * - * @var \Drupal\Core\Render\RendererInterface - */ - protected $renderer; - - /** - * DsDevelController constructor. - * - * @param \Symfony\Component\HttpFoundation\Request $currentRequest - * The current request. - * @param \Drupal\Core\Entity\EntityDisplayRepositoryInterface $displayRepository - * The display repository. - * @param \Drupal\Core\Render\RendererInterface $renderer - * The renderer service. - */ - public function __construct(Request $currentRequest, EntityDisplayRepositoryInterface $displayRepository, RendererInterface $renderer) { - $this->currentRequest = $currentRequest; - $this->entityDisplayRepository = $displayRepository; - $this->renderer = $renderer; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('request_stack')->getCurrentRequest(), - $container->get('entity_display.repository'), - $container->get('renderer') - ); - } - - /** - * Lists all instances of fields on any views. - * - * @param \Drupal\Core\Routing\RouteMatchInterface $route_match - * A RouteMatch object. - * - * @return array - * The Views fields report page. - */ - public function entityMarkup(RouteMatchInterface $route_match) { - - $parameter_name = $route_match->getRouteObject() - ->getOption('_devel_entity_type_id'); - $entity = $route_match->getParameter($parameter_name); - $entity_type_id = $entity->getEntityTypeId(); - - $key = $this->currentRequest->get('key', 'default'); - - $built_entity = $this->entityTypeManager() - ->getViewBuilder($entity_type_id) - ->view($entity, $key); - $markup = $this->renderer->render($built_entity); - - $links = []; - $active_view_modes = $this->entityDisplayRepository - ->getViewModeOptionsByBundle($entity_type_id, $entity->bundle()); - foreach ($active_view_modes as $id => $label) { - $links[] = [ - 'title' => $label, - 'url' => Url::fromRoute("entity.$entity_type_id.devel_markup", [$entity_type_id => $entity->id(), 'key' => $id]), - ]; - } - - $build['links'] = [ - '#theme' => 'links', - '#links' => $links, - '#prefix' => '<hr/><div>', - '#suffix' => '</div><hr />', - ]; - $build['markup'] = [ - '#markup' => '<code><pre>' . Html::escape($markup) . '</pre></code>', - '#cache' => [ - 'max-age' => 0, - ], - '#allowed_tags' => ['code', 'pre'], - ]; - - return $build; - } - -} diff --git a/web/modules/ds/modules/ds_devel/src/Plugin/Derivative/DsDevelLocalTask.php b/web/modules/ds/modules/ds_devel/src/Plugin/Derivative/DsDevelLocalTask.php deleted file mode 100644 index 2368370b69..0000000000 --- a/web/modules/ds/modules/ds_devel/src/Plugin/Derivative/DsDevelLocalTask.php +++ /dev/null @@ -1,74 +0,0 @@ -<?php - -namespace Drupal\ds_devel\Plugin\Derivative; - -use Drupal\Component\Plugin\Derivative\DeriverBase; -use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface; -use Drupal\Core\StringTranslation\StringTranslationTrait; -use Drupal\Core\StringTranslation\TranslationInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Provides local task definitions for all entity bundles. - */ -class DsDevelLocalTask extends DeriverBase implements ContainerDeriverInterface { - - use StringTranslationTrait; - - /** - * The entity manager. - * - * @var \Drupal\Core\Entity\EntityTypeManagerInterface - */ - protected $entityTypeManager; - - /** - * Creates an DevelLocalTask object. - * - * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager - * The entity manager. - * @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation - * The translation manager. - */ - public function __construct(EntityTypeManagerInterface $entity_type_manager, TranslationInterface $string_translation) { - $this->entityTypeManager = $entity_type_manager; - $this->stringTranslation = $string_translation; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, $base_plugin_id) { - return new static( - $container->get('entity_type.manager'), - $container->get('string_translation') - ); - } - - /** - * {@inheritdoc} - */ - public function getDerivativeDefinitions($base_plugin_definition) { - $this->derivatives = []; - - foreach ($this->entityTypeManager->getDefinitions() as $entity_type_id => $entity_type) { - $has_markup_path = $entity_type->hasLinkTemplate('devel-markup'); - if ($has_markup_path) { - $this->derivatives["$entity_type_id.devel_markup_tab"] = [ - 'route_name' => "entity.$entity_type_id.devel_markup", - 'weight' => 100, - 'title' => $this->t('Markup'), - 'parent_id' => "devel.entities:$entity_type_id.devel_tab", - ]; - } - } - - foreach ($this->derivatives as &$entry) { - $entry += $base_plugin_definition; - } - - return $this->derivatives; - } - -} diff --git a/web/modules/ds/modules/ds_devel/src/Routing/RouteSubscriber.php b/web/modules/ds/modules/ds_devel/src/Routing/RouteSubscriber.php deleted file mode 100644 index 4c12525ec8..0000000000 --- a/web/modules/ds/modules/ds_devel/src/Routing/RouteSubscriber.php +++ /dev/null @@ -1,75 +0,0 @@ -<?php - -namespace Drupal\ds_devel\Routing; - -use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\Routing\RouteSubscriberBase; -use Drupal\Core\Routing\RoutingEvents; -use Symfony\Component\Routing\Route; -use Symfony\Component\Routing\RouteCollection; - -/** - * Subscriber for Devel routes. - */ -class RouteSubscriber extends RouteSubscriberBase { - - /** - * The entity manager service. - * - * @var \Drupal\Core\Entity\EntityTypeManagerInterface - */ - protected $entityTypeManager; - - /** - * Constructs a new RouteSubscriber object. - * - * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager - * The entity type manager. - */ - public function __construct(EntityTypeManagerInterface $entity_type_manager) { - $this->entityTypeManager = $entity_type_manager; - } - - /** - * {@inheritdoc} - */ - protected function alterRoutes(RouteCollection $collection) { - foreach ($this->entityTypeManager->getDefinitions() as $entity_type_id => $entity_type) { - if ($entity_type->hasLinkTemplate('devel-markup')) { - $options = [ - '_admin_route' => TRUE, - '_devel_entity_type_id' => $entity_type_id, - 'parameters' => [ - $entity_type_id => [ - 'type' => 'entity:' . $entity_type_id, - ], - ], - ]; - - if ($devel_render = $entity_type->getLinkTemplate('devel-markup')) { - $route = new Route( - $devel_render, - [ - '_controller' => '\Drupal\ds_devel\Controller\DsDevelController::entityMarkup', - '_title' => 'Devel Render', - ], - ['_permission' => 'access devel information'], - $options - ); - - $collection->add("entity.$entity_type_id.devel_markup", $route); - } - } - } - } - - /** - * {@inheritdoc} - */ - public static function getSubscribedEvents() { - $events = parent::getSubscribedEvents(); - $events[RoutingEvents::ALTER] = ['onAlterRoutes', 100]; - return $events; - } - -} diff --git a/web/modules/ds/modules/ds_extras/README.txt b/web/modules/ds/modules/ds_extras/README.txt deleted file mode 100644 index 36e2c6233a..0000000000 --- a/web/modules/ds/modules/ds_extras/README.txt +++ /dev/null @@ -1,11 +0,0 @@ - -The extras module contains functionality that is not often used. It holds -following functionality: - - - block region: add regions which will be exposed as blocks. - - extra fields: expose extra fields defined by other modules. - - field permissions: add view permissions on DS fields. - - hidden region: region which in case it has fields will not be printed. - - switch view mode field: switch from one view mode to another inline. - -Any other functionality will be included in this module. diff --git a/web/modules/ds/modules/ds_extras/config/install/ds_extras.settings.yml b/web/modules/ds/modules/ds_extras/config/install/ds_extras.settings.yml deleted file mode 100644 index 72fe56d493..0000000000 --- a/web/modules/ds/modules/ds_extras/config/install/ds_extras.settings.yml +++ /dev/null @@ -1,9 +0,0 @@ -fields_extra: false -fields_extra_list: { } -field_permissions: false -hidden_region: false -override_node_revision: false -override_node_revision_view_mode: 'full' -region_to_block: false -region_blocks: { } -switch_field: false diff --git a/web/modules/ds/modules/ds_extras/config/optional/core.entity_view_mode.node.revision.yml b/web/modules/ds/modules/ds_extras/config/optional/core.entity_view_mode.node.revision.yml deleted file mode 100644 index 05f4c94799..0000000000 --- a/web/modules/ds/modules/ds_extras/config/optional/core.entity_view_mode.node.revision.yml +++ /dev/null @@ -1,10 +0,0 @@ -id: node.revision -label: 'Revision' -status: false -cache: true -targetEntityType: node -dependencies: - enforced: - module: - - ds_extras - - node diff --git a/web/modules/ds/modules/ds_extras/config/schema/ds_extras.schema.yml b/web/modules/ds/modules/ds_extras/config/schema/ds_extras.schema.yml deleted file mode 100644 index b802b5a041..0000000000 --- a/web/modules/ds/modules/ds_extras/config/schema/ds_extras.schema.yml +++ /dev/null @@ -1,46 +0,0 @@ -# Schema for the configuration files of the Display Suite extras module. - -ds_extras.settings: - type: config_object - label: 'Display Suite extra settings' - mapping: - region_blocks: - type: sequence - label: 'Region blocks' - sequence: - - type: mapping - label: Region block - mapping: - title: - type: string - label: Title - info: - type: string - label: Info - fields_extra: - type: boolean - label: 'Add extra fields' - fields_extra_list: - type: sequence - label: 'List of extra fields' - sequence: - - type: string - label: 'Extra field' - field_permissions: - type: boolean - label: 'Field permissions enabled' - switch_field: - type: boolean - label: 'Add a switch view mode field' - hidden_region: - type: boolean - label: 'Add a hidden region' - region_to_block: - type: boolean - label: 'Region to block' - override_node_revision: - type: boolean - label: 'Override node revision callback' - override_node_revision_view_mode: - type: string - label: 'The view mode of the node revision override' diff --git a/web/modules/ds/modules/ds_extras/ds_extras.info.yml b/web/modules/ds/modules/ds_extras/ds_extras.info.yml deleted file mode 100644 index 3080e5cc81..0000000000 --- a/web/modules/ds/modules/ds_extras/ds_extras.info.yml +++ /dev/null @@ -1,14 +0,0 @@ -type: module -name: 'Display Suite Extras' -description: 'Contains additional features for Display Suite.' -# core: 8.x -package: 'Display Suite' -configure: admin/structure/ds/settings -dependencies: - - ds:ds - -# Information added by Drupal.org packaging script on 2017-05-24 -version: '8.x-3.1' -core: '8.x' -project: 'ds' -datestamp: 1495660091 diff --git a/web/modules/ds/modules/ds_extras/ds_extras.install b/web/modules/ds/modules/ds_extras/ds_extras.install deleted file mode 100644 index 751c9a8bf0..0000000000 --- a/web/modules/ds/modules/ds_extras/ds_extras.install +++ /dev/null @@ -1,39 +0,0 @@ -<?php - -/** - * @file - * Installs the Display Suite Extras module. - */ - -/** - * Implements hook_install(). - */ -function ds_extras_install() { - module_set_weight('ds_extras', 2); -} - -/** - * Copy config to new structure. - */ -function ds_extras_update_8001() { - // Load the original config file. - $original_config = \Drupal::configFactory()->getEditable('ds.extras'); - - // Copy to the new location. - $config = \Drupal::configFactory()->getEditable('ds_extras.settings') - ->set('fields_extra', $original_config->get('fields_extra')) - ->set('fields_extra_list', $original_config->get('fields_extra')) - ->set('switch_view_mode', $original_config->get('fields_extra')) - ->set('field_permissions', $original_config->get('fields_extra')) - ->set('switch_field', $original_config->get('fields_extra')) - ->set('hidden_region', $original_config->get('fields_extra')) - ->set('override_node_revision', $original_config->get('override_node_revision')) - ->set('override_node_revision_view_mode', $original_config->get('override_node_revision_view_mode')) - ->set('region_to_block', $original_config->get('region_to_block')) - ->set('region_blocks', $original_config->get('region_blocks')); - - $config->save(); - - // Delete the old config file. - $original_config->delete(); -} diff --git a/web/modules/ds/modules/ds_extras/ds_extras.libraries.yml b/web/modules/ds/modules/ds_extras/ds_extras.libraries.yml deleted file mode 100644 index da5efc836c..0000000000 --- a/web/modules/ds/modules/ds_extras/ds_extras.libraries.yml +++ /dev/null @@ -1,15 +0,0 @@ -admin: - version: VERSION - js: - js/ds_extras.admin.js: {} - dependencies: - - core/jquery - - core/drupal - - core/drupal.form -switch_view_mode: - version: VERSION - js: - js/ds_extras.js: {} - dependencies: - - core/jquery - - core/drupal diff --git a/web/modules/ds/modules/ds_extras/ds_extras.module b/web/modules/ds/modules/ds_extras/ds_extras.module deleted file mode 100644 index 2d3b7d40db..0000000000 --- a/web/modules/ds/modules/ds_extras/ds_extras.module +++ /dev/null @@ -1,436 +0,0 @@ -<?php - -/** - * @file - * Display Suite extras main functions. - */ - -use Drupal\Component\Utility\Html; -use Drupal\Component\Utility\Unicode; -use Drupal\Core\Entity\Display\EntityDisplayInterface; -use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Render\Element; -use Drupal\Core\Url; - -/** - * Implements hook_layout_alter(). - */ -function ds_extras_layout_alter(&$definitions) { - if (\Drupal::config('ds_extras.settings')->get('hidden_region')) { - /** @var \Drupal\Core\Layout\LayoutDefinition $layout */ - foreach ($definitions as $key => $layout) { - $regions = $layout->getRegions(); - $regions['ds_hidden'] = ['label' => t('Hidden')]; - $layout->setRegions($regions); - } - } -} - -/** - * Implements hook_module_implements_alter(). - */ -function ds_extras_module_implements_alter(&$implementations, $hook) { - // Because it's possible to turn on/off features for DS extras, - // we'll unset hooks here if necessary which otherwise do nothing at all. - // Region to block. - $region_hooks = [ - 'ds_layout_region_alter', - 'entity_view_alter', - ]; - if (!\Drupal::config('ds_extras.settings')->get('region_to_block') && in_array($hook, $region_hooks)) { - unset($implementations['ds_extras']); - } - - // Extra fields. - $extra_fields_hooks = [ - 'field_extra_fields', - ]; - if (!\Drupal::config('ds_extras.settings')->get('fields_extra') && in_array($hook, $extra_fields_hooks)) { - unset($implementations['ds_extras']); - } -} - -/** - * Implements hook_form_FORM_ID_alter(). - */ -function ds_extras_form_entity_view_display_edit_form_alter(&$form, FormStateInterface $form_state) { - // Region to block only fires if there is a layout and we're working on the - // a view mode which is not equal to default. - $mode = $form_state->getFormObject()->getEntity()->getMode(); - if (isset($form['#ds_layout']) && $mode != 'default' && \Drupal::config('ds_extras.settings')->get('region_to_block')) { - // Get the entity_type, bundle and view mode. - $entity_type = $form['#entity_type']; - $bundle = $form['#bundle']; - $view_mode = $mode; - - $region_blocks_options = []; - $region_blocks = \Drupal::config('ds_extras.settings')->get('region_blocks'); - - if (!empty($region_blocks)) { - foreach ($region_blocks as $key => $block) { - if ($block['info'] == "{$entity_type}_{$bundle}_{$view_mode}") { - $region_blocks_options[$key] = t('Remove') . ' ' . $block['title']; - } - } - } - - $form['region_to_block'] = [ - '#type' => 'details', - '#group' => 'additional_settings', - '#title' => t('Block regions (deprecated)'), - '#description' => t('Create additional regions in this layout which will be exposed as blocks.'), - ]; - $url = Url::fromUri('https://www.drupal.org/node/2754967'); - $link = Drupal::l(t('handbook page'), $url); - $form['region_to_block']['deprecated'] = [ - '#markup' => '<b>' . t('This functionality is not compatible with some caching modules. Read the @handbook for a better alternative.', ['@handbook' => $link]) . '</b>', - ]; - $form['region_to_block']['new_block_region'] = [ - '#type' => 'textfield', - '#title' => t('Region name'), - '#description' => t('Enter a name to create a new region.'), - ]; - $form['region_to_block']['new_block_region_key'] = [ - '#title' => t('Machine name'), - '#type' => 'machine_name', - '#default_value' => '', - '#maxlength' => 32, - '#required' => FALSE, - '#description' => t('The machine-readable name of this block region. This name must contain only lowercase letters and underscores. This name must be unique.'), - '#disabled' => FALSE, - '#machine_name' => [ - 'exists' => 'ds_extras_region_to_block_unique', - 'source' => ['region_to_block', 'new_block_region'], - ], - ]; - - if (!empty($region_blocks_options)) { - $form['region_to_block']['remove_block_region'] = [ - '#type' => 'checkboxes', - '#title' => t('Existing block regions'), - '#options' => $region_blocks_options, - '#description' => t('Check the regions you want to remove.'), - ]; - } - - $form['actions']['submit']['#submit'][] = 'ds_extras_block_submit'; - } -} - -/** - * Submit callback after Field UI submission of a views display. - */ -function ds_extras_vd_field_ui_submit($form, FormStateInterface $form_state) { - // Add the 'type' key to the extra title key so we can ditch the notice. - $form_state->setValue('fields', ['title' => ['type' => 'hidden']]); -} - -/** - * Submit callback: manage block regions. - */ -function ds_extras_block_submit($form, FormStateInterface $form_state) { - - // Create new region. - if ($new_block_region = $form_state->getValue('new_block_region')) { - - // Get the entity_type, bundle and view mode. - $entity_type = $form['#entity_type']; - $bundle = $form['#bundle']; - $view_mode = $form_state->getFormObject()->getEntity()->getMode(); - - $block = [ - 'title' => $new_block_region, - 'info' => "{$entity_type}_{$bundle}_{$view_mode}", - ]; - - $block_key = $form_state->getValue('new_block_region_key'); - $region_blocks = \Drupal::config('ds_extras.settings')->get('region_blocks'); - if (empty($region_blocks)) { - $region_blocks = []; - } - $region_blocks[$block_key] = $block; - \Drupal::configFactory()->getEditable('ds_extras.settings')->set('region_blocks', $region_blocks)->save(); - } - - // Remove a region. - if ($form_state->hasValue('remove_block_region')) { - $region_blocks = \Drupal::config('ds_extras.settings')->get('region_blocks'); - $region_removal_status = $form_state->getValue('remove_block_region'); - - foreach ($region_removal_status as $key => $value) { - if ($value !== 0 && $key == $value) { - unset($region_blocks[$key]); - - // Make sure there is no active block instance for this ds block region. - if (\Drupal::moduleHandler()->moduleExists('block')) { - $ids = \Drupal::entityQuery('block') - ->condition('plugin', 'ds_region_block:' . $key) - ->execute(); - $block_storage = \Drupal::service('entity_type.manager')->getStorage('block'); - foreach ($block_storage->loadMultiple($ids) as $block) { - $block->delete(); - } - } - } - } - - // Clear cached block and ds plugin defintions. - \Drupal::service('plugin.manager.block')->clearCachedDefinitions(); - \Drupal::service('plugin.manager.ds')->clearCachedDefinitions(); - - // Remove the region from ds settings. - \Drupal::configFactory()->getEditable('ds_extras.settings')->set('region_blocks', $region_blocks)->save(); - } -} - -/** - * Return unique region to block. - */ -function ds_extras_region_to_block_unique($name) { - $region_blocks = \Drupal::config('ds_extras.settings')->get('region_blocks'); - if (empty($region_blocks)) { - $region_blocks = []; - } - $value = strtr($name, ['-' => '_']); - return isset($region_blocks[$value]) ? TRUE : FALSE; -} - -/** - * Implements hook_form_FORM_ID_alter(). - */ -function ds_extras_form_ds_admin_form_alter(&$form, FormStateInterface $form_state) { - $config = \Drupal::configFactory()->getEditable('ds_extras.settings'); - - $form['fs2'] = [ - '#type' => 'details', - '#title' => t('Extra fields'), - '#group' => 'additional_settings', - '#weight' => 2, - '#tree' => TRUE, - ]; - - $form['fs2']['fields_extra'] = [ - '#type' => 'checkbox', - '#title' => t('Enable extra fields'), - '#description' => t('Make fields from other modules available on the "Manage display" screens.'), - '#default_value' => $config->get('fields_extra'), - ]; - - $form['fs2']['fields_extra_list'] = [ - '#type' => 'textarea', - '#description' => t('Enter fields line by line, where each line is a combination of entity type, bundle and field name. E.g. node|article|tweetbutton. It might be possible that the actual content of the field depends on configuration of that field/module.'), - '#default_value' => implode("\n", $config->get('fields_extra_list')), - '#states' => [ - 'visible' => [ - 'input[name="fs2[fields_extra]"]' => ['checked' => TRUE], - ], - ], - ]; - - $form['fs3']['field_permissions'] = [ - '#type' => 'checkbox', - '#title' => t('Field permissions'), - '#description' => t('Enables view permissions on all Display Suite fields.'), - '#default_value' => $config->get('field_permissions'), - ]; - - if (\Drupal::moduleHandler()->moduleExists('block')) { - $url = Url::fromUri('https://www.drupal.org/node/2754967'); - $link = Drupal::l(t('handbook page'), $url); - $form['fs3']['region_to_block'] = [ - '#type' => 'checkbox', - '#title' => t('Region to block (deprecated)'), - '#description' => t('Create additional regions exposed as block. Note: this will not work on the default view mode.') . '<br/>' . '<b>' . t('This functionality is not compatible with some caching modules. Read the @handbook for a better alternative.', ['@handbook' => $link]) . '</b>', - '#default_value' => $config->get('region_to_block'), - ]; - } - - $form['fs3']['switch_field'] = [ - '#type' => 'checkbox', - '#title' => t('View mode switcher'), - '#description' => t('Adds a field with links to switch view modes inline with Ajax. Only works for nodes at this time. It does not work in combination with the reset layout.'), - '#default_value' => $config->get('switch_field'), - ]; - - $form['fs3']['hidden_region'] = [ - '#type' => 'checkbox', - '#title' => t('Hidden region'), - '#description' => t('Add a hidden region to the layouts. Fields will be built but not printed.'), - '#default_value' => $config->get('hidden_region'), - ]; - - $form['fs3']['override_node_revision'] = [ - '#type' => 'checkbox', - '#title' => t('Custom node revision view mode'), - '#description' => t('Override the node revision page view with a custom view mode'), - '#default_value' => $config->get('override_node_revision'), - ]; - - $options = []; - $view_modes = \Drupal::service('entity_display.repository')->getViewModes('node'); - foreach ($view_modes as $key => $view_mode) { - $options[$key] = $view_mode['label']; - } - - $form['fs3']['override_node_revision_view_mode'] = [ - '#type' => 'select', - '#description' => t('The revision view mode'), - '#default_value' => $config->get('override_node_revision_view_mode'), - '#options' => $options, - '#states' => [ - 'visible' => [ - 'input[name="fs3[override_node_revision]"]' => ['checked' => TRUE], - ], - ], - ]; - - $form['#submit'][] = 'ds_extras_settings_submit'; - $form['#attached']['library'][] = 'ds_extras/admin'; -} - -/** - * Submit callback: Extras settings screen. - */ -function ds_extras_settings_submit($form, FormStateInterface $form_state) { - $values = $form_state->getValues(); - - $extra_fields = []; - if (!empty($values['fs2']['fields_extra_list'])) { - $extra_fields = explode("\n", str_replace("\r", '', $values['fs2']['fields_extra_list'])); - } - - $config = \Drupal::configFactory()->getEditable('ds_extras.settings') - ->set('fields_extra', $values['fs2']['fields_extra']) - ->set('fields_extra_list', $extra_fields) - ->set('field_permissions', $values['fs3']['field_permissions']) - ->set('switch_field', $values['fs3']['switch_field']) - ->set('hidden_region', $values['fs3']['hidden_region']) - ->set('override_node_revision', $values['fs3']['override_node_revision']) - ->set('override_node_revision_view_mode', $values['fs3']['override_node_revision_view_mode']); - if (\Drupal::moduleHandler()->moduleExists('block')) { - $config->set('region_to_block', $values['fs3']['region_to_block']); - } - $config->save(); - - // Mark the router items for rebuild. - \Drupal::service('router.builder')->setRebuildNeeded(); - - // Clear layout plugin caches. - \Drupal::service('plugin.manager.core.layout')->clearCachedDefinitions(); - -} - -/** - * Check DS fields access. - * - * @param string $field - * The machine name of the field. - * @param string $entity_type - * The name of the entity type. - * - * @return bool - * TRUE if the user has access to view this field in this entity type, FALSE - * otherwise. - */ -function ds_extras_ds_field_access($field, $entity_type) { - if (\Drupal::currentUser()->hasPermission('view ' . $field . ' on ' . $entity_type)) { - return TRUE; - } - return FALSE; -} - -/** - * Implements hook_entity_view_alter(). - */ -function ds_extras_entity_view_alter(&$build, EntityInterface $entity, EntityDisplayInterface $display) { - - $entity_type = $entity->getEntityTypeId(); - $bundle = $entity->bundle(); - $view_mode = $display->getMode(); - - $block_data = &drupal_static('ds_block_region'); - $region_blocks = \Drupal::config('ds_extras.settings')->get('region_blocks'); - - if (empty($region_blocks) || empty($build)) { - return; - } - - $properties = []; - foreach (Element::properties($build) as $property) { - $properties[$property] = $build[$property]; - } - $properties['#view_mode'] = $view_mode; - - if ($ds_settings = $display->getThirdPartySettings('ds')) { - foreach ($region_blocks as $block_key => $block) { - if ($block['info'] == "{$entity_type}_{$bundle}_{$view_mode}" && isset($ds_settings['regions'][$block_key]) && !empty($ds_settings['regions'][$block_key])) { - foreach ($ds_settings['regions'][$block_key] as $field) { - if (isset($build[$field])) { - $block_data[$block_key][$field] = $build[$field]; - unset($build[$field]); - } - } - if (isset($block_data[$block_key]) && is_array($block_data[$block_key])) { - $block_data[$block_key] += $properties; - } - } - } - } -} - -/** - * Implements hook_ds_layout_region_alter(). - */ -function ds_extras_ds_layout_region_alter($context, &$region_info) { - - $region_blocks = \Drupal::config('ds_extras.settings')->get('region_blocks'); - - // Bail out if region_blocks is empty or we are working on default view mode. - if (empty($region_blocks) || $context['view_mode'] == 'default') { - return; - } - - $entity_type = $context['entity_type']; - $bundle = $context['bundle']; - $view_mode = $context['view_mode']; - - foreach ($region_blocks as $block_key => $block) { - if ($block['info'] == "{$entity_type}_{$bundle}_{$view_mode}") { - $region_info['region_options'][$block_key] = $block['title']; - if (isset($region_info['table_regions'])) { - $region_info['table_regions'][$block_key] = [ - 'title' => Html::escape($block['title']), - 'message' => t('No fields are displayed in this region'), - ]; - } - } - } -} - -/** - * Implements hook_entity_extra_field_info(). - */ -function ds_extras_entity_extra_field_info() { - $extra = []; - - if (\Drupal::config('ds_extras.settings')->get('fields_extra')) { - $fields = \Drupal::config('ds_extras.settings')->get('fields_extra_list'); - if (empty($fields)) { - return $extra; - } - foreach ($fields as $field) { - $field = trim($field); - if (!empty($field)) { - list($entity, $bundle, $field_name) = explode('|', $field); - $extra[Html::escape($entity)][Html::escape($bundle)]['display'][$field_name] = [ - 'label' => Unicode::ucfirst(str_replace('_', ' ', Html::escape($field_name))), - 'description' => Unicode::ucfirst(str_replace('_', ' ', Html::escape($field_name))), - 'weight' => 0, - ]; - } - } - } - - return $extra; -} diff --git a/web/modules/ds/modules/ds_extras/ds_extras.permissions.yml b/web/modules/ds/modules/ds_extras/ds_extras.permissions.yml deleted file mode 100644 index 4fe5a7db37..0000000000 --- a/web/modules/ds/modules/ds_extras/ds_extras.permissions.yml +++ /dev/null @@ -1,2 +0,0 @@ -permission_callbacks: - - Drupal\ds_extras\ExtrasPermissions::extrasPermissions diff --git a/web/modules/ds/modules/ds_extras/ds_extras.routing.yml b/web/modules/ds/modules/ds_extras/ds_extras.routing.yml deleted file mode 100644 index 5a0fd2f085..0000000000 --- a/web/modules/ds/modules/ds_extras/ds_extras.routing.yml +++ /dev/null @@ -1,7 +0,0 @@ -ds_extras.switch_view_mode: - path: 'ds-switch-view-mode/{entityType}/{entityId}/{viewMode}' - defaults: - _controller: '\Drupal\ds_extras\Controller\DsExtrasController::switchViewMode' - requirements: - _permission: 'access content' - _custom_access: '\Drupal\ds_extras\Controller\DsExtrasController::accessSwitchViewMode' diff --git a/web/modules/ds/modules/ds_extras/ds_extras.services.yml b/web/modules/ds/modules/ds_extras/ds_extras.services.yml deleted file mode 100644 index 9c8b9a645a..0000000000 --- a/web/modules/ds/modules/ds_extras/ds_extras.services.yml +++ /dev/null @@ -1,5 +0,0 @@ -services: - ds_extras.route_subscriber: - class: Drupal\ds_extras\EventSubscriber\RouteSubscriber - tags: - - { name: event_subscriber } diff --git a/web/modules/ds/modules/ds_extras/js/ds_extras.admin.js b/web/modules/ds/modules/ds_extras/js/ds_extras.admin.js deleted file mode 100644 index 264a463b85..0000000000 --- a/web/modules/ds/modules/ds_extras/js/ds_extras.admin.js +++ /dev/null @@ -1,38 +0,0 @@ -/** - * @file - * Javascript functionality for the Display Suite Extras administration UI. - */ - -(function ($, Drupal) { - - 'use strict'; - - Drupal.behaviors.DSExtrasSummaries = { - attach: function (context) { - - $('#edit-fs2', context).drupalSetSummary(function (context) { - var extra_fields = $('#edit-fs2-fields-extra', context); - - if (extra_fields.is(':checked')) { - return Drupal.t('Enabled'); - } - - return Drupal.t('Disabled'); - }); - - $('#edit-fs3', context).drupalSetSummary(function (context) { - var values = []; - - $('input:checked', context).parent().each(function () { - values.push(Drupal.checkPlain($.trim($('.option', this).text()))); - }); - - if (values.length > 0) { - return values.join(', '); - } - return Drupal.t('Disabled'); - }); - } - }; - -})(jQuery, Drupal); diff --git a/web/modules/ds/modules/ds_extras/src/Controller/DsExtrasController.php b/web/modules/ds/modules/ds_extras/src/Controller/DsExtrasController.php deleted file mode 100644 index e68538f2ef..0000000000 --- a/web/modules/ds/modules/ds_extras/src/Controller/DsExtrasController.php +++ /dev/null @@ -1,84 +0,0 @@ -<?php - -namespace Drupal\ds_extras\Controller; - -use Drupal\Core\Access\AccessResult; -use Drupal\Core\Ajax\AjaxResponse; -use Drupal\Core\Ajax\ReplaceCommand; -use Drupal\Core\Controller\ControllerBase; -use Symfony\Component\HttpFoundation\Request; - -/** - * Returns responses for Display Suite Extra routes. - */ -class DsExtrasController extends ControllerBase { - - /** - * Returns an node through JSON. - * - * @param \Symfony\Component\HttpFoundation\Request $request - * The global request object. - * @param string $entityType - * The type of the requested entity. - * @param string $entityId - * The id of the requested entity. - * @param string $viewMode - * The view mode you wish to render for the requested entity. - * - * @return \Drupal\Core\Ajax\AjaxResponse - * An ajax response with the new view mode. - */ - public function switchViewMode(Request $request, $entityType, $entityId, $viewMode) { - $response = new AjaxResponse(); - $entity = $this->entityTypeManager() - ->getStorage($entityType) - ->load($entityId); - - if ($entity->access('view')) { - $element = $this->entityTypeManager() - ->getViewBuilder($entityType) - ->view($entity, $viewMode); - $content = \Drupal::service('renderer')->render($element, FALSE); - - $response->addCommand(new ReplaceCommand('.' . $request->get('selector'), $content)); - } - - return $response; - } - - /** - * Displays a node revision. - * - * @param int $node_revision - * The node revision ID. - * - * @return array - * An array suitable for drupal_render(). - */ - public function revisionShow($node_revision) { - /* @var \Drupal\node\NodeInterface $node */ - $node = $this->entityTypeManager() - ->getStorage('node') - ->loadRevision($node_revision); - - // Determine view mode. - $view_mode = \Drupal::config('ds_extras.settings') - ->get('override_node_revision_view_mode'); - - drupal_static('ds_view_mode', $view_mode); - - $page = node_view($node, $view_mode); - unset($page['nodes'][$node->id()]['#cache']); - - return $page; - } - - /** - * Checks access for the switch view mode route. - */ - public function accessSwitchViewMode() { - return $this->config('ds_extras.settings') - ->get('switch_field') ? AccessResult::allowed() : AccessResult::forbidden(); - } - -} diff --git a/web/modules/ds/modules/ds_extras/src/EventSubscriber/RouteSubscriber.php b/web/modules/ds/modules/ds_extras/src/EventSubscriber/RouteSubscriber.php deleted file mode 100644 index 0ade3b5e4b..0000000000 --- a/web/modules/ds/modules/ds_extras/src/EventSubscriber/RouteSubscriber.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php - -namespace Drupal\ds_extras\EventSubscriber; - -use Drupal\Core\Routing\RouteBuildEvent; -use Drupal\Core\Routing\RoutingEvents; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * Alter the node view route. - */ -class RouteSubscriber implements EventSubscriberInterface { - - /** - * {@inheritdoc} - */ - public static function getSubscribedEvents() { - $events[RoutingEvents::ALTER][] = ['alterRoutes', 100]; - return $events; - } - - /** - * Alters the routes. - * - * @param \Drupal\Core\Routing\RouteBuildEvent $event - * The event to process. - */ - public function alterRoutes(RouteBuildEvent $event) { - if (\Drupal::config('ds_extras.settings')->get('override_node_revision')) { - $route = $event->getRouteCollection()->get('entity.node.revision'); - if (!empty($route)) { - $route->setDefault('_controller', '\Drupal\ds_extras\Controller\DsExtrasController::revisionShow'); - } - } - } - -} diff --git a/web/modules/ds/modules/ds_extras/src/ExtrasPermissions.php b/web/modules/ds/modules/ds_extras/src/ExtrasPermissions.php deleted file mode 100644 index 6f3dd2fb91..0000000000 --- a/web/modules/ds/modules/ds_extras/src/ExtrasPermissions.php +++ /dev/null @@ -1,65 +0,0 @@ -<?php - -namespace Drupal\ds_extras; - -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; -use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\StringTranslation\StringTranslationTrait; -use Drupal\ds\Ds; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Provides dynamic permissions of the ds extras module. - */ -class ExtrasPermissions implements ContainerInjectionInterface { - - use StringTranslationTrait; - - /** - * The entity manager. - * - * @var \Drupal\Core\Entity\EntityTypeManagerInterface - */ - protected $entityTypeManager; - - /** - * Constructs a new FieldUiPermissions instance. - * - * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager - * The entity type manager. - */ - public function __construct(EntityTypeManagerInterface $entity_type_manager) { - $this->entityTypeManager = $entity_type_manager; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static($container->get('entity_type.manager')); - } - - /** - * Returns an array of ds extras permissions. - */ - public function extrasPermissions() { - $permissions = []; - - if (\Drupal::config('ds_extras.settings')->get('field_permissions')) { - $entities = $this->entityTypeManager->getDefinitions(); - foreach ($entities as $entity_type => $info) { - // @todo do this on all fields ? - // @todo hide switch field if enabled - $fields = Ds::getFields($entity_type); - foreach ($fields as $key => $finfo) { - $permissions['view ' . $key . ' on ' . $entity_type] = [ - 'title' => $this->t('View @field on @entity_type', ['@field' => $finfo['title'], '@entity_type' => $info->getLabel()]), - ]; - } - } - } - - return $permissions; - } - -} diff --git a/web/modules/ds/modules/ds_extras/src/Plugin/Block/DsRegionBlock.php b/web/modules/ds/modules/ds_extras/src/Plugin/Block/DsRegionBlock.php deleted file mode 100644 index be26546f5f..0000000000 --- a/web/modules/ds/modules/ds_extras/src/Plugin/Block/DsRegionBlock.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php - -namespace Drupal\ds_extras\Plugin\Block; - -use Drupal\Core\Block\BlockBase; - -/** - * Provides the region block plugin. - * - * @Block( - * id = "ds_region_block", - * admin_label = @Translation("Ds region block"), - * category = @Translation("Display Suite"), - * deriver = "Drupal\ds_extras\Plugin\Derivative\DsRegionBlock" - * ) - */ -class DsRegionBlock extends BlockBase { - - /** - * {@inheritdoc} - */ - public function build() { - $id = $this->getDerivativeId(); - $data = drupal_static('ds_block_region'); - - if (!empty($data[$id])) { - return [ - '#markup' => drupal_render_children($data[$id]), - ]; - } - else { - return []; - } - } - -} diff --git a/web/modules/ds/modules/ds_extras/src/Plugin/Derivative/DsRegionBlock.php b/web/modules/ds/modules/ds_extras/src/Plugin/Derivative/DsRegionBlock.php deleted file mode 100644 index 8785c726fe..0000000000 --- a/web/modules/ds/modules/ds_extras/src/Plugin/Derivative/DsRegionBlock.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php - -namespace Drupal\ds_extras\Plugin\Derivative; - -use Drupal\Component\Plugin\Derivative\DeriverBase; - -/** - * Provides block region definitions for ds blocks. - * - * @see \Drupal\ds_extras\Plugin\block\block\DsRegionBlock - */ -class DsRegionBlock extends DeriverBase { - - /** - * Implements \Drupal\Component\Plugin\Derivative\DerivativeInterface::getDerivativeDefinitions(). - */ - public function getDerivativeDefinitions($base_plugin_definition) { - $region_blocks = \Drupal::config('ds_extras.settings')->get('region_blocks'); - - if (empty($region_blocks)) { - return $this->derivatives; - } - - foreach ($region_blocks as $key => $block) { - $this->derivatives[$key] = $base_plugin_definition; - $this->derivatives[$key]['delta'] = $key; - $this->derivatives[$key]['admin_label'] = $block['title']; - } - - return $this->derivatives; - } - -} diff --git a/web/modules/ds/modules/ds_extras/src/Plugin/DsField/SwitchField.php b/web/modules/ds/modules/ds_extras/src/Plugin/DsField/SwitchField.php deleted file mode 100644 index c9186d432d..0000000000 --- a/web/modules/ds/modules/ds_extras/src/Plugin/DsField/SwitchField.php +++ /dev/null @@ -1,187 +0,0 @@ -<?php - -namespace Drupal\ds_extras\Plugin\DsField; - -use Drupal\Component\Utility\Html; -use Drupal\Core\Entity\EntityDisplayRepositoryInterface; -use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Url; -use Drupal\ds\Plugin\DsField\DsFieldBase; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Plugin that generates a link to switch view mode with via ajax. - * - * @DsField( - * id = "switch_field", - * title = @Translation("Switch field"), - * entity_type = "node" - * ) - */ -class SwitchField extends DsFieldBase { - - /** - * The EntityDisplayRepository service. - * - * @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface - */ - protected $entityDisplayRepository; - - /** - * The entity type manager. - * - * @var \Drupal\Core\Entity\EntityTypeManagerInterface - */ - protected $entityTypeManager; - - /** - * Constructs a Display Suite field plugin. - */ - public function __construct($configuration, $plugin_id, $plugin_definition, EntityDisplayRepositoryInterface $entity_display_repository, EntityTypeManagerInterface $entity_type_manager) { - $this->entityDisplayRepository = $entity_display_repository; - $this->entityTypeManager = $entity_type_manager; - - parent::__construct($configuration, $plugin_id, $plugin_definition); - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $container->get('entity_display.repository'), - $container->get('entity_type.manager') - ); - } - - /** - * {@inheritdoc} - */ - public function build() { - $settings = $this->getConfiguration(); - - if (!empty($settings)) { - /* @var \Drupal\Core\Entity\EntityInterface $entity */ - $entity = $this->entity(); - - // Basic route parameters. - $route_parameters = [ - 'entityType' => $entity->getEntityTypeId(), - 'entityId' => $entity->id(), - ]; - - $selector = $this->viewMode() == 'default' ? 'full' : $this->viewMode(); - // Basic route options. - $route_options = [ - 'query' => [ - 'selector' => 'view-mode-' . $selector, - ], - 'attributes' => [ - 'class' => [ - 'use-ajax', - ], - ], - ]; - - foreach ($settings['vms'] as $key => $value) { - // If the label is empty, do not create a link. - if (!empty($value)) { - $route_parameters['viewMode'] = $key == 'default' ? 'full' : $key; - $items[] = \Drupal::l($value, Url::fromRoute('ds_extras.switch_view_mode', $route_parameters, $route_options)); - } - } - } - - $output = []; - if (!empty($items)) { - $output = [ - '#theme' => 'item_list', - '#items' => $items, - // Add the AJAX library to the field for inline switching support. - '#attached' => [ - 'library' => [ - 'core/drupal.ajax', - ], - ], - ]; - } - - return $output; - } - - /** - * {@inheritdoc} - */ - public function settingsForm($form, FormStateInterface $form_state) { - $entity_type = $this->getEntityTypeId(); - $bundle = $this->bundle(); - $view_modes = $this->entityDisplayRepository->getViewModes($entity_type); - - $form['info'] = [ - '#markup' => $this->t('Enter a label for the link for the view modes you want to switch to.<br />Leave empty to hide link. They will be localized.'), - ]; - - $config = $this->getConfiguration(); - $config = isset($config['vms']) ? $config['vms'] : []; - foreach ($view_modes as $key => $value) { - $entity_display = $this->entityTypeManager - ->getStorage('entity_view_display') - ->load($entity_type . '.' . $bundle . '.' . $key); - if (!empty($entity_display)) { - if ($entity_display->status()) { - $form['vms'][$key] = [ - '#type' => 'textfield', - '#default_value' => isset($config[$key]) ? $config[$key] : '', - '#size' => 20, - '#title' => Html::escape($value['label']), - ]; - } - } - } - - return $form; - } - - /** - * {@inheritdoc} - */ - public function settingsSummary($settings) { - $entity_type = $this->getEntityTypeId(); - $bundle = $this->bundle(); - $settings = isset($settings['vms']) ? $settings['vms'] : []; - $view_modes = $this->entityDisplayRepository->getViewModes($entity_type); - - $summary[] = 'View mode labels'; - - foreach ($view_modes as $key => $value) { - $entity_display = $this->entityTypeManager - ->getStorage('entity_view_display') - ->load($entity_type . '.' . $bundle . '.' . $key); - if (!empty($entity_display)) { - if ($entity_display->status()) { - $label = isset($settings[$key]) ? $settings[$key] : $key; - $summary[] = $key . ' : ' . $label; - } - } - } - - return $summary; - } - - /** - * {@inheritdoc} - */ - public function isAllowed() { - if (\Drupal::config('ds_extras.settings')->get('switch_field')) { - return TRUE; - } - - return FALSE; - } - -} diff --git a/web/modules/ds/modules/ds_switch_view_mode/ds_switch_view_mode.info.yml b/web/modules/ds/modules/ds_switch_view_mode/ds_switch_view_mode.info.yml deleted file mode 100644 index 2b735e8508..0000000000 --- a/web/modules/ds/modules/ds_switch_view_mode/ds_switch_view_mode.info.yml +++ /dev/null @@ -1,13 +0,0 @@ -type: module -name: 'Display Suite Switch View Mode' -description: 'Allows you to switch entity display per node on the node form.' -# core: 8.x -package: 'Display Suite' -dependencies: - - ds:ds - -# Information added by Drupal.org packaging script on 2017-05-24 -version: '8.x-3.1' -core: '8.x' -project: 'ds' -datestamp: 1495660091 diff --git a/web/modules/ds/modules/ds_switch_view_mode/ds_switch_view_mode.module b/web/modules/ds/modules/ds_switch_view_mode/ds_switch_view_mode.module deleted file mode 100644 index be8cafc642..0000000000 --- a/web/modules/ds/modules/ds_switch_view_mode/ds_switch_view_mode.module +++ /dev/null @@ -1,158 +0,0 @@ -<?php - -/** - * @file - * Display Suite Switch View mode. - */ - -use Drupal\Core\Entity\Entity\EntityViewDisplay; -use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Entity\EntityTypeInterface; -use Drupal\Core\Field\BaseFieldDefinition; -use Drupal\Core\Form\FormStateInterface; -use Drupal\ds\Ds; - -/** - * Implements hook_entity_base_field_info(). - */ -function ds_switch_view_mode_entity_base_field_info(EntityTypeInterface $entity_type) { - if ($entity_type->id() == 'node') { - // Add the switch field as a base field. - $fields = []; - - $fields['ds_switch'] = BaseFieldDefinition::create('string') - ->setLabel(t('DS switch')) - ->setName('ds_switch') - ->setRevisionable(TRUE) - ->setDescription(t('Holds the DS view mode of the node.')) - ->setSetting('default_value', '') - ->setPropertyConstraints('value', ['Length' => ['max' => 60]]); - - return $fields; - } -} - -/** - * Implements hook_entity_view_mode_alter(). - */ -function ds_switch_view_mode_entity_view_mode_alter(&$view_mode, EntityInterface $entity, $context) { - if ($entity->getEntityTypeId() == 'node' && node_is_page($entity) && !empty($entity->ds_switch->value) && $view_mode == 'full') { - $original_view_mode = $view_mode; - $view_mode = $entity->ds_switch->value; - \Drupal::moduleHandler()->alter('ds_switch_view_mode', $view_mode, $original_view_mode, $entity); - } -} - -/** - * Implements hook_form_BASE_FORM_ID_alter() for node_form. - * - * Adds the switch view mode form element. - */ -function ds_switch_view_mode_form_node_form_alter(&$form, FormStateInterface $form_state) { - // Switch full view mode. - /* @var Drupal\node\NodeInterface $node */ - $node = $form_state->getFormObject()->getEntity(); - - if (\Drupal::currentUser()->hasPermission('ds switch ' . $node->bundle()) || \Drupal::currentUser()->hasPermission('ds switch view mode')) { - // Get the view modes. - $ds_vm = \Drupal::service('entity_display.repository')->getViewModes('node'); - $layouts = []; - $options = ['' => t('Default')]; - foreach ($ds_vm as $key => $item) { - $overridden = FALSE; - $entity_display = EntityViewDisplay::load('node.' . $node->bundle() . '.' . $key); - if ($entity_display) { - $overridden = $entity_display->status(); - } - if ($overridden) { - $layout = Ds::getDisplay('node', $node->bundle(), $key, FALSE); - $layouts[$key] = $layout; - $options[$key] = $item['label']; - } - } - - // Add default layout settings. - $layouts[''] = Ds::getDisplay('node', $node->bundle(), 'default', FALSE); - - // Only fire if we have more than 1 option. - if (count($options) > 1) { - - if (!isset($form['ds_switch_view_mode'])) { - $form['ds_switch_view_mode'] = [ - '#type' => 'details', - '#title' => t('Display settings'), - '#weight' => 100, - '#group' => 'advanced', - ]; - } - - $form['ds_switch_view_mode']['ds_switch'] = [ - '#type' => 'select', - '#title' => t('View mode'), - '#options' => $options, - '#default_value' => $node->ds_switch->value, - '#description' => t('Switch to a different view mode to display the full page view of this node.'), - '#weight' => -1, - '#ajax' => [ - 'callback' => 'ds_switch_view_mode_switch_view_mode_preview_callback', - 'wrapper' => 'ds_switch_preview_wrapper', - ], - ]; - - $form['ds_switch_view_mode']['preview'] = [ - '#type' => 'container', - '#prefix' => '<div id="ds_switch_preview_wrapper">', - '#suffix' => '</div>', - ]; - - $mode = $form_state->getValue('ds_switch'); - if (!$mode) { - $mode = $node->get('ds_switch')->value; - } - $chosen_layout = $layouts[$mode]; - if (empty($chosen_layout)) { - if (isset($layouts['full'])) { - $chosen_layout = $layouts['full']; - } - else { - $chosen_layout = $layouts['']; - } - } - $layout_settings = $chosen_layout->getThirdPartySettings('ds'); - - $ds_layouts = Ds::getLayouts(); - $fallback_image = drupal_get_path('module', 'ds') . '/images/preview.png'; - - if (isset($layout_settings['layout'])) { - /** @var \Drupal\Core\Layout\LayoutDefinition $chosen_layout */ - $chosen_layout = $ds_layouts[$layout_settings['layout']['id']]; - $image = $chosen_layout->getIconPath(); - if (empty($image)) { - $image = $fallback_image; - } - } - else { - $image = $fallback_image; - } - $form['ds_switch_view_mode']['preview']['image'] = [ - '#markup' => '<div class="ds-layout-preview-image"><img src="' . base_path() . $image . '"/></div>', - ]; - } - } -} - -/** - * Ajax callback for _ds_field_ui_table_layouts_preview(). - */ -function ds_switch_view_mode_switch_view_mode_preview_callback($form, $form_state) { - return $form['ds_switch_view_mode']['preview']; -} - -/** - * Implements hook_panelizer_pre_view_builder_alter(). - */ -function ds_switch_view_mode_panelizer_pre_view_builder_alter(&$view_mode, EntityInterface $entity, &$langcode) { - if ($entity->getEntityTypeId() == 'node' && node_is_page($entity) && !empty($entity->ds_switch->value) && $view_mode == 'full') { - $view_mode = $entity->ds_switch->value; - } -} diff --git a/web/modules/ds/modules/ds_switch_view_mode/ds_switch_view_mode.permissions.yml b/web/modules/ds/modules/ds_switch_view_mode/ds_switch_view_mode.permissions.yml deleted file mode 100644 index 473c39ad97..0000000000 --- a/web/modules/ds/modules/ds_switch_view_mode/ds_switch_view_mode.permissions.yml +++ /dev/null @@ -1,5 +0,0 @@ -'ds switch view mode': - title: 'Switch the view mode of any content type' - -permission_callbacks: - - Drupal\ds_switch_view_mode\Permissions::permissions diff --git a/web/modules/ds/modules/ds_switch_view_mode/src/Permissions.php b/web/modules/ds/modules/ds_switch_view_mode/src/Permissions.php deleted file mode 100644 index 8d1ad3252e..0000000000 --- a/web/modules/ds/modules/ds_switch_view_mode/src/Permissions.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php - -namespace Drupal\ds_switch_view_mode; - -use Drupal\Core\StringTranslation\StringTranslationTrait; - -/** - * Provides dynamic permissions of the ds switch view mode module. - */ -class Permissions { - - use StringTranslationTrait; - - /** - * Constructs a Permissions object. - */ - public function __construct() { - // Empty constructor to prevent php 4 constructor error. - } - - /** - * Returns an array of ds switch view mode permissions. - */ - public function permissions() { - $permissions = []; - - foreach (node_type_get_names() as $key => $name) { - $permissions['ds switch ' . $key] = [ - 'title' => $this->t('Switch view modes on :type', [':type' => $name]), - ]; - } - - return $permissions; - } - -} diff --git a/web/modules/ds/src/Annotation/DsField.php b/web/modules/ds/src/Annotation/DsField.php deleted file mode 100644 index 29ff0205a1..0000000000 --- a/web/modules/ds/src/Annotation/DsField.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php - -namespace Drupal\ds\Annotation; - -use Drupal\Component\Annotation\Plugin; - -/** - * Defines a DsField annotation object. - * - * @Annotation - */ -class DsField extends Plugin { - - /** - * The plugin ID. - * - * @var string - */ - public $id; - - /** - * The human-readable name of the DS plugin. - * - * @var \Drupal\Core\Annotation\Translation - * - * @ingroup plugin_translatable - */ - public $title; - - /** - * The entity type this plugin should work on. - * - * @var string|array - */ - public $entity_type; - - /** - * An array of limits for showing this field. - * - * In the format: "bundle|view_mode". - * - * @var array - */ - public $ui_limit; - -} diff --git a/web/modules/ds/src/Annotation/DsFieldTemplate.php b/web/modules/ds/src/Annotation/DsFieldTemplate.php deleted file mode 100644 index 6c658588b7..0000000000 --- a/web/modules/ds/src/Annotation/DsFieldTemplate.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php - -namespace Drupal\ds\Annotation; - -use Drupal\Component\Annotation\Plugin; - -/** - * Defines a DsFieldTemplate annotation object. - * - * @Annotation - */ -class DsFieldTemplate extends Plugin { - - /** - * The plugin ID. - * - * @var string - */ - public $id; - - /** - * The human-readable name of the DS field layout plugin. - * - * @var \Drupal\Core\Annotation\Translation - * - * @ingroup plugin_translatable - */ - public $title; - - /** - * The theme function for this field layout. - * - * @var string - */ - public $theme; - -} diff --git a/web/modules/ds/src/Controller/DsController.php b/web/modules/ds/src/Controller/DsController.php deleted file mode 100644 index 55800dd244..0000000000 --- a/web/modules/ds/src/Controller/DsController.php +++ /dev/null @@ -1,158 +0,0 @@ -<?php - -namespace Drupal\ds\Controller; - -use Drupal\Core\Controller\ControllerBase; -use Drupal\Core\Entity\Entity\EntityViewDisplay; -use Drupal\Core\Routing\RouteMatchInterface; -use Drupal\Core\Url; -use Drupal\field_ui\FieldUI; -use Symfony\Component\HttpFoundation\RedirectResponse; - -/** - * Returns responses for Display Suite UI routes. - */ -class DsController extends ControllerBase { - - /** - * Lists all bundles per entity type. - * - * @return array - * The Views fields report page. - */ - public function listDisplays() { - $build = []; - - // All entities. - $entity_info = $this->entityTypeManager()->getDefinitions(); - - // Move node to the top. - if (isset($entity_info['node'])) { - $node_entity = $entity_info['node']; - unset($entity_info['node']); - $entity_info = array_merge(['node' => $node_entity], $entity_info); - } - - $field_ui_enabled = $this->moduleHandler()->moduleExists('field_ui'); - if (!$field_ui_enabled) { - $build['no_field_ui'] = [ - '#markup' => '<p>' . $this->t('You need to enable Field UI to manage the displays of entities.') . '</p>', - '#weight' => -10, - ]; - } - - if (isset($entity_info['comment'])) { - $comment_entity = $entity_info['comment']; - unset($entity_info['comment']); - $entity_info['comment'] = $comment_entity; - } - - foreach ($entity_info as $entity_type => $info) { - $base_table = $info->getBaseTable(); - if ($info->get('field_ui_base_route') && !empty($base_table)) { - $rows = []; - $bundles = \Drupal::service('entity_type.bundle.info')->getBundleInfo($entity_type); - foreach ($bundles as $bundle_type => $bundle) { - $row = []; - $operations = []; - $row[] = [ - 'data' => [ - '#plain_text' => $bundle['label'], - ], - ]; - - if ($field_ui_enabled) { - // Get the manage display URI. - $route = FieldUI::getOverviewRouteInfo($entity_type, $bundle_type); - if ($route) { - $operations['manage_display'] = [ - 'title' => $this->t('Manage display'), - 'url' => new Url("entity.entity_view_display.$entity_type.default", $route->getRouteParameters()), - ]; - } - } - - // Add operation links. - if (!empty($operations)) { - $row[] = [ - 'data' => [ - '#type' => 'operations', - '#subtype' => 'ds', - '#links' => $operations, - ], - ]; - } - else { - $row[] = ['data' => '']; - } - - $rows[] = $row; - } - - if (!empty($rows)) { - $header = [ - ['data' => $info->getLabel()], - [ - 'data' => $field_ui_enabled ? $this->t('operations') : '', - 'class' => 'ds-display-list-options', - ], - ]; - $build['list_' . $entity_type] = [ - '#theme' => 'table', - '#header' => $header, - '#rows' => $rows, - ]; - } - } - } - - $build['#attached']['library'][] = 'ds/admin'; - - return $build; - } - - /** - * Adds a contextual tab to entities. - * - * @param \Drupal\Core\Routing\RouteMatchInterface $route_match - * The route information. - * - * @return \Symfony\Component\HttpFoundation\RedirectResponse - * A redirect response pointing to the corresponding display. - */ - public function contextualTab(RouteMatchInterface $route_match) { - $parameter_name = $route_match->getRouteObject()->getOption('_ds_entity_type_id'); - $entity = $route_match->getParameter($parameter_name); - $entity_type_id = $entity->getEntityTypeId(); - - $destination = $entity->toUrl(); - - if (!empty($entity->ds_switch->value)) { - $view_mode = $entity->ds_switch->value; - } - else { - $view_mode = 'full'; - } - - // Get the manage display URI. - $route = FieldUI::getOverviewRouteInfo($entity_type_id, $entity->bundle()); - - /* @var $entity_display EntityDisplayBase */ - $entity_display = EntityViewDisplay::load($entity_type_id . '.' . $entity->bundle() . '.' . $view_mode); - - $route_parameters = $route->getRouteParameters(); - if ($entity_display && $entity_display->status() && $entity_display->getThirdPartySetting('ds', 'layout')) { - $route_parameters['view_mode_name'] = $view_mode; - $admin_route_name = "entity.entity_view_display.$entity_type_id.view_mode"; - } - else { - $admin_route_name = "entity.entity_view_display.$entity_type_id.default"; - } - $route->setOption('query', ['destination' => $destination->toString()]); - - $url = new Url($admin_route_name, $route_parameters, $route->getOptions()); - - return new RedirectResponse($url->setAbsolute(TRUE)->toString()); - } - -} diff --git a/web/modules/ds/src/Controller/FieldController.php b/web/modules/ds/src/Controller/FieldController.php deleted file mode 100644 index 878ce6cddf..0000000000 --- a/web/modules/ds/src/Controller/FieldController.php +++ /dev/null @@ -1,137 +0,0 @@ -<?php - -namespace Drupal\ds\Controller; - -use Drupal\Core\Config\StorageInterface; -use Drupal\Core\Controller\ControllerBase; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; -use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Url; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\HttpFoundation\RedirectResponse; - -/** - * Route controller fields. - */ -class FieldController extends ControllerBase implements ContainerInjectionInterface { - - /** - * The config storage. - * - * @var \Drupal\Core\Config\StorageInterface - */ - protected $storage; - - /** - * The module handler. - * - * @var \Drupal\Core\Extension\ModuleHandlerInterface - */ - protected $moduleHandler; - - /** - * Constructs a \Drupal\ds\Controller\FieldController object. - * - * @param \Drupal\Core\Config\StorageInterface $storage - * The configuration storage. - * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler - * The module handler. - */ - public function __construct(StorageInterface $storage, ModuleHandlerInterface $module_handler) { - $this->storage = $storage; - $this->moduleHandler = $module_handler; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('config.storage'), - $container->get('module_handler') - ); - } - - /** - * Builds a list of fields. - */ - public function fieldList() { - $custom_fields = $this->storage->listAll('ds.field.'); - if (!empty($custom_fields)) { - - $rows = []; - foreach ($custom_fields as $config) { - $field_value = $this->config($config)->get(); - $row = []; - $row[] = [ - 'data' => [ - '#plain_text' => $field_value['label'], - ], - ]; - $row[] = isset($field_value['type_label']) ? $field_value['type_label'] : $this->t('Unknown'); - $row[] = $field_value['id']; - $row[] = ucwords(str_replace('_', ' ', implode(', ', $field_value['entities']))); - - $operations = []; - $operations['edit'] = [ - 'title' => $this->t('Edit'), - 'url' => new Url('ds.manage_field', ['field_key' => $field_value['id']]), - ]; - $operations['delete'] = [ - 'title' => $this->t('Delete'), - 'url' => new Url('ds.delete_field', ['field_key' => $field_value['id']]), - ]; - - $this->moduleHandler->alter('ds_field_operations', $operations, $field_value); - - $row[] = [ - 'data' => [ - '#type' => 'operations', - '#subtype' => 'ds', - '#links' => $operations, - ], - ]; - - $rows[] = $row; - } - - $build = [ - '#theme' => 'table', - '#header' => [ - 'Label', - 'Type', - 'Machine name', - 'Entities', - 'Operations', - ], - '#rows' => $rows, - ]; - - } - else { - $build = [ - '#markup' => $this->t('No custom fields have been defined.'), - ]; - } - - return $build; - } - - /** - * Redirect to the correct manage callback. - */ - public function manageRedirect($field_key) { - $config = $this->config('ds.field.' . $field_key); - if ($field = $config->get()) { - $url = new Url('ds.manage_' . $field['type'] . '_field', ['field_key' => $field_key]); - if ($url->toString()) { - return new RedirectResponse($url->toString()); - } - } - - drupal_set_message($this->t('Field not found')); - $url = new Url('ds.fields_list'); - return new RedirectResponse($url->toString()); - } - -} diff --git a/web/modules/ds/src/Ds.php b/web/modules/ds/src/Ds.php deleted file mode 100644 index e2961ef752..0000000000 --- a/web/modules/ds/src/Ds.php +++ /dev/null @@ -1,210 +0,0 @@ -<?php - -namespace Drupal\ds; - -use Drupal\Component\Utility\Html; -use Drupal\Core\Entity\Display\EntityDisplayInterface; -use Drupal\Core\Entity\EntityInterface; - -/** - * Helper class that holds all the main Display Suite helper functions. - */ -class Ds { - - /** - * Gets all Display Suite fields. - * - * @param string $entity_type - * The name of the entity. - * - * @return array - * Collection of fields. - */ - public static function getFields($entity_type) { - static $static_fields; - - if (!isset($static_fields[$entity_type])) { - foreach (\Drupal::service('plugin.manager.ds')->getDefinitions() as $plugin_id => $plugin) { - // Needed to get derivatives working. - $plugin['plugin_id'] = $plugin_id; - if (is_array($plugin['entity_type'])) { - foreach ($plugin['entity_type'] as $plugin_entity_type) { - $static_fields[$plugin_entity_type][$plugin_id] = $plugin; - } - } - else { - $static_fields[$plugin['entity_type']][$plugin_id] = $plugin; - } - } - } - - return isset($static_fields[$entity_type]) ? $static_fields[$entity_type] : []; - } - - /** - * Gets the value for a Display Suite field. - * - * @param string $key - * The key of the field. - * @param array $field - * The configuration of a DS field. - * @param \Drupal\Core\Entity\EntityInterface $entity - * The current entity. - * @param string $view_mode - * The name of the view mode. - * @param \Drupal\Core\Entity\Display\EntityDisplayInterface $display - * The entity display object. - * @param array $build - * The current built of the entity. - * - * @return \Drupal\ds\Plugin\DsField\DsFieldInterface - * Field instance. - */ - public static function getFieldInstance($key, array $field, EntityInterface $entity, $view_mode, EntityDisplayInterface $display, array $build = []) { - $configuration = [ - 'field' => $field, - 'field_name' => $key, - 'entity' => $entity, - 'build' => $build, - 'view_mode' => $view_mode, - ]; - - // Load the plugin. - /* @var $field_instance \Drupal\ds\Plugin\DsField\DsFieldInterface */ - $field_instance = \Drupal::service('plugin.manager.ds')->createInstance($field['plugin_id'], $configuration); - - /* @var $display \Drupal\Core\Entity\Display\EntityDisplayInterface */ - if ($field_settings = $display->getThirdPartySetting('ds', 'fields')) { - $settings = isset($field_settings[$key]['settings']) ? $field_settings[$key]['settings'] : []; - // Unset field template settings. - if (isset($settings['ft'])) { - unset($settings['ft']); - } - - $field_instance->setConfiguration($settings); - } - - return $field_instance; - } - - /** - * Gets Display Suite layouts. - * - * @return \Drupal\Core\Layout\LayoutDefinition[] - * A list of layouts. - */ - public static function getLayouts() { - static $layouts = FALSE; - - if (!$layouts) { - // This can be called before ds_update_8003() has run. If that is the case - // return an empty array and don't static cache anything. - if (!\Drupal::hasService('plugin.manager.core.layout')) { - return []; - } - $layouts = \Drupal::service('plugin.manager.core.layout')->getDefinitions(); - } - - return $layouts; - } - - /** - * Gets a display for a given entity. - * - * @param string $entity_type - * The name of the entity. - * @param string $bundle - * The name of the bundle. - * @param string $view_mode - * The name of the view mode. - * @param bool $fallback - * Whether to fallback to default or not. - * - * @return array|bool - * The display. - */ - public static function getDisplay($entity_type, $bundle, $view_mode, $fallback = TRUE) { - /* @var $entity_display \Drupal\Core\Entity\Display\EntityDisplayInterface */ - $entity_manager = \Drupal::entityTypeManager(); - $entity_display = $entity_manager->getStorage('entity_view_display')->load($entity_type . '.' . $bundle . '.' . $view_mode); - if ($entity_display) { - $overridden = $entity_display->status(); - } - else { - $overridden = FALSE; - } - - if ($entity_display) { - return $entity_display; - } - - // In case $view_mode is not found, check if we have a default layout, - // but only if the view mode settings aren't overridden for this view mode. - if ($view_mode != 'default' && !$overridden && $fallback) { - /* @var $entity_default_display \Drupal\Core\Entity\Display\EntityDisplayInterface */ - $entity_manager = \Drupal::entityTypeManager(); - $entity_default_display = $entity_manager->getStorage('entity_view_display')->load($entity_type . '.' . $bundle . '.default'); - if ($entity_default_display) { - return $entity_default_display; - } - } - - return FALSE; - } - - /** - * Checks if we can go on with Display Suite. - * - * In some edge cases, a view might be inserted into the view of an entity, in - * which the same entity is available as well. This is simply not possible and - * will lead to infinite loops, so you can temporarily disable DS completely - * by setting this variable, either from code or visit the UI through - * admin/structure/ds/emergency. - */ - public static function isDisabled() { - return \Drupal::state()->get('ds.disabled', FALSE); - } - - /** - * Gets all Display Suite field layouts options. - * - * Mainly used by select fields. - * - * @return array - * List of field layouts. - */ - public static function getFieldLayoutOptions() { - $options = []; - foreach (\Drupal::service('plugin.manager.ds.field.layout')->getDefinitions() as $plugin_id => $plugin) { - $options[$plugin_id] = $plugin['title']; - } - return $options; - } - - /** - * Utility function to return CSS classes. - */ - public static function getClasses($name = 'region') { - static $classes = []; - - if (!isset($classes[$name])) { - $classes[$name] = []; - $custom_classes = \Drupal::config('ds.settings')->get('classes.' . $name); - if (!empty($custom_classes)) { - $classes[$name][''] = t('None'); - foreach ($custom_classes as $value) { - $classes_splitted = explode("|", $value); - $key = trim($classes_splitted[0]); - $friendly_name = isset($classes_splitted[1]) ? trim($classes_splitted[1]) : $key; - $classes[$name][Html::escape($key)] = $friendly_name; - } - } - // Prevent the name from being changed. - $name_clone = $name; - \Drupal::moduleHandler()->alter('ds_classes', $classes[$name], $name_clone); - } - - return $classes[$name]; - } - -} diff --git a/web/modules/ds/src/DsAttribute.php b/web/modules/ds/src/DsAttribute.php deleted file mode 100644 index be40732795..0000000000 --- a/web/modules/ds/src/DsAttribute.php +++ /dev/null @@ -1,34 +0,0 @@ -<?php - -namespace Drupal\ds; - -use Drupal\Core\Template\Attribute; - -/** - * Extends the core Attribute object. - */ -class DsAttribute extends Attribute { - - /** - * Merges Attributes objects into another one. - * - * @return \Drupal\ds\DsAttribute - * Merged attributes. - */ - public function mergeAttributes() { - $args = func_get_args(); - if ($args) { - $merged_array = $this->toArray(); - foreach ($args as $arg) { - if (is_object($arg)) { - $merged_array = array_merge_recursive($merged_array, $arg->toArray()); - } - } - foreach ($merged_array as $attribute => $value) { - $this->setAttribute($attribute, $value); - } - } - return $this; - } - -} diff --git a/web/modules/ds/src/Form/BlockFieldConfigForm.php b/web/modules/ds/src/Form/BlockFieldConfigForm.php deleted file mode 100644 index 1cd1b79c1f..0000000000 --- a/web/modules/ds/src/Form/BlockFieldConfigForm.php +++ /dev/null @@ -1,145 +0,0 @@ -<?php - -namespace Drupal\ds\Form; - -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Cache\CacheTagsInvalidatorInterface; -use Drupal\Core\Config\ConfigFactory; -use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\Extension\ModuleHandler; -use Drupal\Core\Plugin\Context\ContextRepositoryInterface; -use Drupal\Core\Plugin\ContextAwarePluginAssignmentTrait; -use Drupal\Core\Plugin\ContextAwarePluginInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Configure block fields. - */ -class BlockFieldConfigForm extends FieldFormBase implements ContainerInjectionInterface { - - use ContextAwarePluginAssignmentTrait; - - /** - * The context repository. - * - * @var \Drupal\Core\Plugin\Context\ContextRepositoryInterface - */ - protected $contextRepository; - - /** - * {@inheritdoc} - */ - public function __construct(ConfigFactory $config_factory, EntityTypeManagerInterface $entity_type_manager, CacheTagsInvalidatorInterface $cache_invalidator, ModuleHandler $module_handler, ContextRepositoryInterface $context_repository) { - parent::__construct($config_factory, $entity_type_manager, $cache_invalidator, $module_handler); - $this->contextRepository = $context_repository; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('config.factory'), - $container->get('entity_type.manager'), - $container->get('cache_tags.invalidator'), - $container->get('module_handler'), - $container->get('context.repository') - ); - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state, $field_key = '') { - // Fetch field. - $field = $this->config('ds.field.' . $field_key)->get(); - - // Save the field for future reuse. - $this->field = $field; - - // Create an instance of the block. - /* @var $block BlockPluginInterface */ - $manager = \Drupal::service('plugin.manager.block'); - $block_id = $field['properties']['block']; - $block = $manager->createInstance($block_id); - - // Set block config form default values. - if (isset($field['properties']['config'])) { - $block->setConfiguration($field['properties']['config']); - } - - // Get block config form. - $form = $block->blockForm($form, $form_state); - - // If the block is context aware, attach the mapping widget. - if ($block instanceof ContextAwarePluginInterface) { - $form['context_mapping'] = $this->addContextAssignmentElement($block, $this->contextRepository->getAvailableContexts()); - } - - if (!$form) { - return ['#markup' => $this->t("This block has no configuration options.")]; - } - - // Some form items require this (core block manager also sets this). - $form['#tree'] = TRUE; - - $form['submit'] = [ - '#type' => 'submit', - '#value' => $this->t('Save'), - '#weight' => 100, - ]; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function validateForm(array &$form, FormStateInterface $form_state) { - $field = $this->field; - - // Create an instance of the block. - /* @var $block BlockPluginInterface */ - $manager = \Drupal::service('plugin.manager.block'); - $block_id = $field['properties']['block']; - $block = $manager->createInstance($block_id); - - // Validate block config data using the block's validation handler. - $block->validateConfigurationForm($form, $form_state); - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - $field = $this->field; - - // Create an instance of the block. - /* @var $block BlockPluginInterface */ - $manager = \Drupal::service('plugin.manager.block'); - $block_id = $field['properties']['block']; - $block = $manager->createInstance($block_id); - - // Process block config data using the block's submit handler. - $block->blockSubmit($form, $form_state); - - // If the block is context aware, store the context mapping. - if ($block instanceof ContextAwarePluginInterface && $block->getContextDefinitions()) { - $context_mapping = $form_state->getValue('context_mapping', []); - $block->setContextMapping($context_mapping); - } - - $block_config = $block->getConfiguration(); - - // Clear cache tags. - $this->cacheInvalidator->invalidateTags($block->getCacheTags()); - - // Save block config. - $this->config('ds.field.' . $field['id'])->set('properties.config', $block_config)->save(); - - // Clear caches and redirect. - $this->finishSubmitForm($form, $form_state); - } - -} diff --git a/web/modules/ds/src/Form/BlockFieldForm.php b/web/modules/ds/src/Form/BlockFieldForm.php deleted file mode 100644 index a4eba211be..0000000000 --- a/web/modules/ds/src/Form/BlockFieldForm.php +++ /dev/null @@ -1,117 +0,0 @@ -<?php - -namespace Drupal\ds\Form; - -use Drupal\Core\Cache\Cache; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; -use Drupal\Core\Form\FormState; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Url; - -/** - * Configure block fields. - */ -class BlockFieldForm extends FieldFormBase implements ContainerInjectionInterface { - - /** - * The type of the dynamic ds field. - */ - const TYPE = 'block'; - - /** - * {@inheritdoc} - */ - public function getFormId() { - return 'ds_field_form'; - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state, $field_key = '') { - $form = parent::buildForm($form, $form_state, $field_key); - - $field = $this->field; - - $manager = \Drupal::service('plugin.manager.block'); - - $blocks = []; - foreach ($manager->getDefinitions() as $plugin_id => $plugin_definition) { - $blocks[$plugin_id] = $plugin_definition['admin_label']; - } - asort($blocks); - - $form['block_identity']['block'] = [ - '#type' => 'select', - '#options' => $blocks, - '#title' => $this->t('Block'), - '#required' => TRUE, - '#default_value' => isset($field['properties']['block']) ? $field['properties']['block'] : '', - ]; - - $form['use_block_title'] = [ - '#type' => 'checkbox', - '#title' => $this->t('Use block title as the field label'), - '#default_value' => isset($field['properties']['use_block_title']) ? $field['properties']['use_block_title'] : FALSE, - '#weight' => 90, - ]; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function getProperties(FormStateInterface $form_state) { - $properties['block'] = $form_state->getValue('block'); - - // Preserve existing block config. - $field_key = $form_state->getValue('id'); - $field = $this->config('ds.field.' . $field_key)->get(); - if (isset($field['properties']) && ($field['properties']['block'] == $properties['block'])) { - $properties = $field['properties']; - } - - // Save title checkbox. - $properties['use_block_title'] = $form_state->getValue('use_block_title'); - - return $properties; - } - - /** - * {@inheritdoc} - */ - public function getType() { - return BlockFieldForm::TYPE; - } - - /** - * {@inheritdoc} - */ - public function getTypeLabel() { - return 'Block field'; - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - parent::submitForm($form, $form_state); - - // Create an instance of the block to find out if it has a config form. - // Redirect to the block config form if there is one. - /* @var $block BlockPluginInterface */ - $manager = \Drupal::service('plugin.manager.block'); - $block_id = $this->field['properties']['block']; - $block = $manager->createInstance($block_id); - $block_config_form = $block->blockForm([], new FormState()); - if ($block_config_form) { - $url = new Url('ds.manage_block_field_config', ['field_key' => $this->field['id']]); - $form_state->setRedirectUrl($url); - } - - // Invalidate all blocks. - Cache::invalidateTags(['config:ds.block_base']); - } - -} diff --git a/web/modules/ds/src/Form/ChangeLayoutForm.php b/web/modules/ds/src/Form/ChangeLayoutForm.php deleted file mode 100644 index f63afb45ab..0000000000 --- a/web/modules/ds/src/Form/ChangeLayoutForm.php +++ /dev/null @@ -1,247 +0,0 @@ -<?php - -namespace Drupal\ds\Form; - -use Drupal\Core\Entity\EntityFieldManagerInterface; -use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\Form\FormBase; -use Drupal\Core\Form\FormStateInterface; -use Drupal\ds\Ds; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Provides a configuration form for configurable actions. - */ -class ChangeLayoutForm extends FormBase { - - /** - * The entity type manager. - * - * @var \Drupal\Core\Entity\EntityTypeManagerInterface - */ - protected $entityTypeManager; - - /** - * The entity field manager. - * - * @var \Drupal\Core\Entity\EntityFieldManagerInterface - */ - protected $entityFieldManager; - - /** - * ChangeLayoutForm constructor. - * - * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager - * The entity type manager. - * @param \Drupal\Core\Entity\EntityFieldManagerInterface $entityFieldManager - * The entity field manager. - */ - public function __construct(EntityTypeManagerInterface $entityTypeManager, EntityFieldManagerInterface $entityFieldManager) { - $this->entityTypeManager = $entityTypeManager; - $this->entityFieldManager = $entityFieldManager; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('entity_type.manager'), - $container->get('entity_field.manager') - ); - } - - /** - * {@inheritdoc} - */ - public function getFormId() { - return 'ds_change_layout'; - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state, $entity_type = '', $bundle = '', $display_mode = '', $new_layout = '') { - - $old_layout = NULL; - $all_layouts = Ds::getLayouts(); - - if (!empty($entity_type) && !empty($bundle) && !empty($display_mode)) { - $display = entity_get_display($entity_type, $bundle, $display_mode); - $old_layout = $display->getThirdPartySettings('ds'); - } - - if ($old_layout && isset($all_layouts[$new_layout])) { - - $new_layout_key = $new_layout; - $new_layout = $all_layouts[$new_layout]; - $old_layout_info = $all_layouts[$old_layout['layout']['id']]; - - $form['#entity_type'] = $entity_type; - $form['#entity_bundle'] = $bundle; - $form['#mode'] = $display_mode; - $form['#old_layout'] = $old_layout; - $form['#old_layout_info'] = $old_layout_info; - $form['#new_layout'] = $new_layout; - $form['#new_layout_key'] = $new_layout_key; - - $form['info'] = [ - '#markup' => $this->t('You are changing from @old to @new layout for @bundle in @view_mode view mode.', - [ - '@old' => $old_layout_info->getLabel(), - '@new' => $new_layout->getLabel(), - '@bundle' => $bundle, - '@view_mode' => $display_mode, - ] - ), - '#prefix' => "<div class='change-ds-layout-info'>", - '#suffix' => "</div>", - ]; - - // Old region options. - $regions = []; - foreach ($old_layout_info->getRegions() as $key => $info) { - $regions[$key] = $info['label']; - } - - // Let other modules alter the regions. - // For old regions. - $context = [ - 'entity_type' => $entity_type, - 'bundle' => $bundle, - 'view_mode' => $display_mode, - ]; - $region_info = [ - 'region_options' => $regions, - ]; - \Drupal::moduleHandler()->alter('ds_layout_region', $context, $region_info); - $regions = $region_info['region_options']; - - $save_regions = []; - foreach ($regions as $key => $info) { - $save_regions[$key] = [ - 'label' => $info, - ]; - } - $form['#old_layout_info']->setRegions($save_regions); - - // For new regions. - $new_regions = []; - foreach ($new_layout->getRegions() as $key => $info) { - $new_regions[$key] = $info['label']; - } - $region_info = [ - 'region_options' => $new_regions, - ]; - \Drupal::moduleHandler()->alter('ds_layout_region', $context, $region_info); - $new_layout->setRegions($region_info['region_options']); - - // Display the region options. - $selectable_regions = ['' => $this->t('- None -')] + $new_layout->getRegions(); - $form['regions_pre']['#markup'] = '<div class="ds-layout-regions">'; - foreach ($regions as $region => $region_title) { - $form['region_' . $region] = [ - '#type' => 'container', - ]; - $form['region_' . $region]['ds_label_' . $region] = [ - '#markup' => 'Fields in <span class="change-ds-layout-old-region"> ' . $region_title . '</span> go into', - ]; - $form['region_' . $region]['ds_' . $region] = [ - '#type' => 'select', - '#options' => $layout_options = $selectable_regions, - '#default_value' => $region, - ]; - } - $form['regions_post']['#markup'] = '</div>'; - - // Show previews from old and new layouts. - $form['preview'] = [ - '#type' => 'container', - '#prefix' => '<div class="ds-layout-preview">', - '#suffix' => '</div>', - ]; - - $fallback_image = drupal_get_path('module', 'ds') . '/images/preview.png'; - $old_image = $old_layout_info->getIconPath() ?: $fallback_image; - $new_image = $new_layout->getIconPath() ?: $fallback_image; - $arrow = drupal_get_path('module', 'ds') . '/images/arrow.png'; - - $form['preview']['old_layout'] = [ - '#markup' => '<div class="ds-layout-preview-image"><img src="' . base_path() . $old_image . '"/></div>', - ]; - $form['preview']['arrow'] = [ - '#markup' => '<div class="ds-layout-preview-arrow"><img src="' . base_path() . $arrow . '"/></div>', - ]; - $form['preview']['new_layout'] = [ - '#markup' => '<div class="ds-layout-preview-image"><img src="' . base_path() . $new_image . '"/></div>', - ]; - $form['#attached']['library'][] = 'ds/admin'; - - // Submit button. - $form['actions'] = ['#type' => 'actions']; - $form['actions']['submit'] = [ - '#type' => 'submit', - '#value' => $this->t('Save'), - '#prefix' => '<div class="ds-layout-change-save">', - '#suffix' => '</div>', - ]; - } - else { - $form['nothing'] = ['#markup' => $this->t('No valid configuration found.')]; - } - - return $form; - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - // Prepare some variables. - $old_layout = $form['#old_layout']; - $new_layout = $form['#new_layout']; - $old_layout_info = $form['#old_layout_info']; - $new_layout_key = $form['#new_layout_key']; - $entity_type = $form['#entity_type']; - $bundle = $form['#entity_bundle']; - $display_mode = $form['#mode']; - - // Create new third party settings. - $third_party_settings = $old_layout; - $third_party_settings['layout']['id'] = $new_layout_key; - if ($library = $new_layout->getLibrary()) { - $third_party_settings['layout']['library'] = $library; - } - unset($third_party_settings['regions']); - - // Map old regions to new ones. - foreach ($old_layout_info->getRegions() as $region => $region_title) { - $new_region = $form_state->getValue('ds_' . $region); - if ($new_region != '' && isset($old_layout['regions'][$region])) { - foreach ($old_layout['regions'][$region] as $field) { - if (!isset($third_party_settings['regions'][$new_region])) { - $third_party_settings['regions'][$new_region] = []; - } - $third_party_settings['regions'][$new_region][] = $field; - } - } - } - - // Save configuration. - /* @var $entity_display \Drupal\Core\Entity\Display\EntityDisplayInterface*/ - $entity_display = $this->entityTypeManager - ->getStorage('entity_view_display') - ->load($entity_type . '.' . $bundle . '.' . $display_mode); - foreach (array_keys($third_party_settings) as $key) { - $entity_display->setThirdPartySetting('ds', $key, $third_party_settings[$key]); - } - $entity_display->save(); - - // Clear entity info cache. - $this->entityFieldManager->clearCachedFieldDefinitions(); - - // Show message. - drupal_set_message(t('The layout change has been saved.')); - } - -} diff --git a/web/modules/ds/src/Form/ClassesForm.php b/web/modules/ds/src/Form/ClassesForm.php deleted file mode 100644 index 0971f41d8d..0000000000 --- a/web/modules/ds/src/Form/ClassesForm.php +++ /dev/null @@ -1,81 +0,0 @@ -<?php - -namespace Drupal\ds\Form; - -use Drupal\Core\Form\ConfigFormBase; -use Drupal\Core\Form\FormStateInterface; - -/** - * Configures classes used by wrappers and regions. - */ -class ClassesForm extends ConfigFormBase { - - /** - * {@inheritdoc} - */ - public function getFormId() { - return 'ds_classes_form'; - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state) { - $config = $this->config('ds.settings'); - - $form['regions'] = [ - '#type' => 'textarea', - '#title' => $this->t('CSS classes for regions'), - '#default_value' => implode("\n", $config->get('classes.region')), - '#description' => t('Configure CSS classes which you can add to regions on the "manage display" screens. Add multiple CSS classes line by line.<br />If you want to have a friendly name, separate class and friendly name by |, but this is not required. eg:<br /><em>class_name_1<br />class_name_2|Friendly name<br />class_name_3</em>'), - ]; - - // Only show field classes if DS extras module is enabled. - if (\Drupal::moduleHandler()->moduleExists('ds_extras')) { - $form['fields'] = [ - '#type' => 'textarea', - '#title' => $this->t('CSS classes for fields'), - '#default_value' => implode("\n", $config->get('classes.field')), - '#description' => $this->t('Configure CSS classes which you can add to fields on the "manage display" screens. Add multiple CSS classes line by line.<br />If you want to have a friendly name, separate class and friendly name by |, but this is not required. eg:<br /><em>class_name_1<br />class_name_2|Friendly name<br />class_name_3</em>'), - ]; - } - - return parent::buildForm($form, $form_state); - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - parent::submitForm($form, $form_state); - - // Prepare region classes. - $region_classes = []; - $regions = $form_state->getValue('regions'); - if (!empty($regions)) { - $region_classes = explode("\n", str_replace("\r", '', $form_state->getValue('regions'))); - } - - // Prepare field classes. - $field_classes = []; - $fields = $form_state->getValue('fields'); - if (!empty($fields)) { - $field_classes = explode("\n", str_replace("\r", '', $form_state->getValue('fields'))); - } - - $config = $this->config('ds.settings'); - $config->set('classes.region', $region_classes) - ->set('classes.field', $field_classes) - ->save(); - } - - /** - * {@inheritdoc} - */ - protected function getEditableConfigNames() { - return [ - 'ds.settings', - ]; - } - -} diff --git a/web/modules/ds/src/Form/CopyFieldForm.php b/web/modules/ds/src/Form/CopyFieldForm.php deleted file mode 100644 index e3f4057a6e..0000000000 --- a/web/modules/ds/src/Form/CopyFieldForm.php +++ /dev/null @@ -1,77 +0,0 @@ -<?php - -namespace Drupal\ds\Form; - -use Drupal\Core\Form\FormStateInterface; - -/** - * Configure block fields. - */ -class CopyFieldForm extends FieldFormBase { - - /** - * The type of the dynamic ds field. - */ - const TYPE = 'copy'; - - /** - * {@inheritdoc} - */ - public function getFormId() { - return 'ds_field_form'; - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state, $field_key = '') { - $form = parent::buildForm($form, $form_state, $field_key); - $field = $this->field; - - $manager = \Drupal::service('plugin.manager.ds'); - - $fields = []; - foreach ($manager->getDefinitions() as $plugin_id => $plugin_definition) { - $entity_label = ''; - if (isset($plugin_definition['entity_type'])) { - $entity_label .= ucfirst(str_replace('_', ' ', $plugin_definition['entity_type'])) . ' - '; - } - $fields[$plugin_id] = $entity_label . $plugin_definition['title']; - } - asort($fields); - - $form['ds_field_identity']['ds_plugin'] = [ - '#type' => 'select', - '#options' => $fields, - '#title' => $this->t('Fields'), - '#required' => TRUE, - '#default_value' => isset($field['properties']['ds_plugin']) ? $field['properties']['ds_plugin'] : '', - ]; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function getProperties(FormStateInterface $form_state) { - return [ - 'ds_plugin' => $form_state->getValue('ds_plugin'), - ]; - } - - /** - * {@inheritdoc} - */ - public function getType() { - return CopyFieldForm::TYPE; - } - - /** - * {@inheritdoc} - */ - public function getTypeLabel() { - return 'Copy field'; - } - -} diff --git a/web/modules/ds/src/Form/EmergencyForm.php b/web/modules/ds/src/Form/EmergencyForm.php deleted file mode 100644 index 076fcc5593..0000000000 --- a/web/modules/ds/src/Form/EmergencyForm.php +++ /dev/null @@ -1,188 +0,0 @@ -<?php - -namespace Drupal\ds\Form; - -use Drupal\Core\Config\ConfigFactory; -use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Form\ConfigFormBase; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\State\StateInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Emergency form for DS. - */ -class EmergencyForm extends ConfigFormBase { - - /** - * State object. - * - * @var \Drupal\Core\State\State - */ - protected $state; - - /** - * The module handler. - * - * @var \Drupal\Core\Extension\ModuleHandlerInterface - */ - protected $moduleHandler; - - /** - * Constructs a \Drupal\ds\Form\EmergencyForm object. - * - * @param \Drupal\Core\Config\ConfigFactory $config_factory - * The config factory. - * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler - * The module handler. - * @param \Drupal\Core\State\StateInterface $state - * The state key value store. - */ - public function __construct(ConfigFactory $config_factory, ModuleHandlerInterface $module_handler, StateInterface $state) { - parent::__construct($config_factory); - $this->moduleHandler = $module_handler; - $this->state = $state; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('config.factory'), - $container->get('module_handler'), - $container->get('state') - ); - } - - /** - * {@inheritdoc} - */ - public function getFormId() { - return 'ds_emergy_form'; - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state) { - - $form['ds_fields_error'] = [ - '#type' => 'fieldset', - '#title' => $this->t('Fields error'), - ]; - - $form['ds_fields_error']['disable'] = [ - '#type' => 'html_tag', - '#tag' => 'p', - '#value' => $this->t('In case you get an error after configuring a layout printing a message like "Fatal error: Unsupported operand types", you can temporarily disable adding fields from DS. You probably are trying to render an node inside a node, for instance through a view, which is simply not possible. See <a href="http://drupal.org/node/1264386">http://drupal.org/node/1264386</a>.'), - ]; - - $form['ds_fields_error']['submit'] = [ - '#type' => 'submit', - '#value' => ($this->state->get('ds.disabled', FALSE) ? $this->t('Enable attaching fields') : $this->t('Disable attaching fields')), - '#submit' => ['::submitFieldAttach'], - '#weight' => 1, - ]; - - if ($this->moduleHandler->moduleExists('ds_extras')) { - $region_blocks = $this->config('ds_extras.settings')->get('region_blocks'); - if (!empty($region_blocks)) { - - $region_blocks_options = []; - foreach ($region_blocks as $key => $info) { - $region_blocks_options[$key] = $info['title']; - } - - $form['region_to_block'] = [ - '#type' => 'fieldset', - '#title' => $this->t('Block regions'), - ]; - - $form['region_to_block']['remove_block_region'] = [ - '#type' => 'checkboxes', - '#options' => $region_blocks_options, - '#description' => $this->t('In case you renamed a content type, you will not see the configured block regions anymore, however the block on the block settings page is still available. On this screen you can remove orphaned block regions.'), - ]; - - $form['region_to_block']['submit'] = [ - '#type' => 'submit', - '#value' => $this->t('Remove block regions'), - '#submit' => ['::submitRegionToBlock'], - '#weight' => 1, - ]; - } - } - - return $form; - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - // empty. - } - - /** - * Submit callback for the fields error form. - */ - public function submitFieldAttach(array &$form, FormStateInterface $form_state) { - $this->state->set('ds.disabled', ($this->state->get('ds.disabled', FALSE) ? FALSE : TRUE)); - drupal_set_message(t('The configuration options have been saved.')); - } - - /** - * Submit callback for the region to block form. - */ - public function submitRegionToBlock(array &$form, FormStateInterface $form_state) { - if ($form_state->getValue('remove_block_region')) { - $save = FALSE; - $region_blocks = $this->config('ds_extras.settings')->get('region_blocks'); - $remove = $form_state->getValue('remove_block_region'); - foreach ($remove as $key => $value) { - if ($value !== 0 && $key == $value) { - $save = TRUE; - - // Make sure there is no active block instance for this ds block - // region. - if (\Drupal::moduleHandler()->moduleExists('block')) { - $ids = \Drupal::entityQuery('block') - ->condition('plugin', 'ds_region_block:' . $key) - ->execute(); - /* @var \Drupal\block\BlockInterface $block_storage */ - $block_storage = \Drupal::service('entity_type.manager')->getStorage('block'); - foreach ($block_storage->loadMultiple($ids) as $block) { - $block->delete(); - } - } - - unset($region_blocks[$key]); - } - } - - if ($save) { - drupal_set_message(t('Block regions were removed.')); - - // Clear cached block and ds plugin definitions. - \Drupal::service('plugin.manager.block')->clearCachedDefinitions(); - \Drupal::service('plugin.manager.ds')->clearCachedDefinitions(); - - $this->config('ds_extras.settings')->set('region_blocks', $region_blocks)->save(); - } - } - else { - drupal_set_message($this->t('No block regions were removed.')); - } - } - - /** - * {@inheritdoc} - */ - protected function getEditableConfigNames() { - return [ - 'ds_extras.settings', - ]; - } - -} diff --git a/web/modules/ds/src/Form/FieldDeleteForm.php b/web/modules/ds/src/Form/FieldDeleteForm.php deleted file mode 100644 index 295c01516b..0000000000 --- a/web/modules/ds/src/Form/FieldDeleteForm.php +++ /dev/null @@ -1,117 +0,0 @@ -<?php - -namespace Drupal\ds\Form; - -use Drupal\Core\Cache\CacheTagsInvalidatorInterface; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; -use Drupal\Core\Form\ConfigFormBaseTrait; -use Drupal\Core\Form\ConfirmFormBase; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Url; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\HttpFoundation\Request; - -/** - * Provides a form to delete a DS field. - */ -class FieldDeleteForm extends ConfirmFormBase implements ContainerInjectionInterface { - - use ConfigFormBaseTrait; - - /** - * Holds the cache invalidator. - * - * @var \Drupal\Core\Cache\CacheTagsInvalidatorInterface - */ - protected $cacheInvalidator; - - /** - * The field being deleted. - * - * @var array - */ - protected $field; - - /** - * Constructs a FieldDeleteForm object. - * - * @param \Drupal\Core\Cache\CacheTagsInvalidatorInterface $cache_invalidator - * The cache invalidator. - */ - public function __construct(CacheTagsInvalidatorInterface $cache_invalidator) { - $this->cacheInvalidator = $cache_invalidator; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static($container->get('cache_tags.invalidator')); - } - - /** - * {@inheritdoc} - */ - public function getQuestion() { - return $this->t('Are you sure you want to delete @field ?', ['@field' => $this->field['label']]); - } - - /** - * {@inheritdoc} - */ - public function getCancelUrl() { - return new Url('ds.fields_list'); - } - - /** - * {@inheritdoc} - */ - public function getFormId() { - return 'field_delete_form'; - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state, Request $request = NULL, $field_key = '') { - $config = $this->config('ds.field.' . $field_key); - $this->field = $config->get(); - - if (empty($this->field)) { - drupal_set_message(t('Field not found.')); - return new RedirectResponse('/admin/structure/ds/fields'); - } - - return parent::buildForm($form, $form_state, $request); - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - $field = $this->field; - - // Remove field and clear caches. - $this->config('ds.field.' . $field['id'])->delete(); - $this->cacheInvalidator->invalidateTags(['ds_fields_info']); - - // Also clear the ds plugin cache. - \Drupal::service('plugin.manager.ds')->clearCachedDefinitions(); - - // Redirect. - $url = new Url('ds.fields_list'); - $form_state->setRedirectUrl($url); - drupal_set_message(t('The field @field has been deleted.', ['@field' => $field['label']])); - } - - /** - * {@inheritdoc} - */ - protected function getEditableConfigNames() { - return [ - 'ds.field.' . $this->field['id'], - ]; - } - -} diff --git a/web/modules/ds/src/Form/FieldFormBase.php b/web/modules/ds/src/Form/FieldFormBase.php deleted file mode 100644 index 812ff1bde6..0000000000 --- a/web/modules/ds/src/Form/FieldFormBase.php +++ /dev/null @@ -1,251 +0,0 @@ -<?php - -namespace Drupal\ds\Form; - -use Drupal\Component\Utility\Unicode; -use Drupal\Core\Cache\CacheTagsInvalidatorInterface; -use Drupal\Core\Config\ConfigFactory; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; -use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\Extension\ModuleHandler; -use Drupal\Core\Form\ConfigFormBase; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Url; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Base form for fields. - */ -class FieldFormBase extends ConfigFormBase implements ContainerInjectionInterface { - - /** - * Holds the entity type manager. - * - * @var \Drupal\Core\Entity\EntityTypeManager - */ - protected $entityTypeManager; - - /** - * Holds the cache invalidator. - * - * @var \Drupal\Core\Cache\CacheTagsInvalidatorInterface - */ - protected $cacheInvalidator; - - /** - * Drupal module handler. - * - * @var \Drupal\Core\Extension\ModuleHandler - */ - protected $moduleHandler; - - /** - * The field properties. - * - * @var array - */ - protected $field; - - /** - * Constructs a \Drupal\system\CustomFieldFormBase object. - * - * @param \Drupal\Core\Config\ConfigFactory $config_factory - * The factory for configuration objects. - * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager - * The entity type manager. - * @param \Drupal\Core\Cache\CacheTagsInvalidatorInterface $cache_invalidator - * The cache invalidator. - * @param \Drupal\Core\Extension\ModuleHandler $module_handler - * The module handler. - */ - public function __construct(ConfigFactory $config_factory, EntityTypeManagerInterface $entity_type_manager, CacheTagsInvalidatorInterface $cache_invalidator, ModuleHandler $module_handler) { - parent::__construct($config_factory); - $this->entityTypeManager = $entity_type_manager; - $this->cacheInvalidator = $cache_invalidator; - $this->moduleHandler = $module_handler; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('config.factory'), - $container->get('entity_type.manager'), - $container->get('cache_tags.invalidator'), - $container->get('module_handler') - ); - } - - /** - * {@inheritdoc} - */ - public function getFormId() { - return 'ds_custom_field_form'; - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state, $field_key = '') { - // Initialize field. - $field = []; - - // Fetch field if it already exists. - if (!empty($field_key)) { - $field = $this->config('ds.field.' . $field_key)->get(); - } - - // Save the field for future reuse. - $this->field = $field; - - $form['name'] = [ - '#title' => $this->t('Label'), - '#type' => 'textfield', - '#default_value' => isset($field['label']) ? $field['label'] : '', - '#description' => $this->t('The human-readable label of the field.'), - '#maxlength' => 128, - '#required' => TRUE, - '#size' => 30, - ]; - - $form['id'] = [ - '#type' => 'machine_name', - '#default_value' => isset($field['id']) ? $field['id'] : '', - '#maxlength' => 32, - '#description' => $this->t('The machine-readable name of this field. This name must contain only lowercase letters and underscores. This name must be unique.'), - '#disabled' => !empty($field['id']), - '#machine_name' => [ - 'exists' => [$this, 'uniqueFieldName'], - 'source' => ['name'], - ], - ]; - - $entity_options = []; - $entities = $this->entityTypeManager->getDefinitions(); - foreach ($entities as $entity_type => $entity_info) { - if ($entity_info->get('field_ui_base_route') || $entity_type == 'ds_views') { - $entity_options[$entity_type] = Unicode::ucfirst(str_replace('_', ' ', $entity_type)); - } - } - $form['entities'] = [ - '#title' => $this->t('Entities'), - '#description' => $this->t('Select the entities for which this field will be made available.'), - '#type' => 'checkboxes', - '#required' => TRUE, - '#options' => $entity_options, - '#default_value' => isset($field['entities']) ? $field['entities'] : [], - ]; - - $form['ui_limit'] = [ - '#title' => $this->t('Limit field'), - '#description' => $this->t('Limit this field on field UI per bundles and/or view modes. The values are in the form of $bundle|$view_mode, where $view_mode may be either a view mode set to use custom settings, or \'default\'. You may use * to select all, e.g article|*, *|full or *|*. Enter one value per line.'), - '#type' => 'textarea', - '#default_value' => isset($field['ui_limit']) ? $field['ui_limit'] : '', - ]; - - $form['submit'] = [ - '#type' => 'submit', - '#value' => $this->t('Save'), - '#weight' => 100, - ]; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - $field = []; - $field['id'] = $form_state->getValue('id'); - $field['label'] = $form_state->getValue('name'); - $field['ui_limit'] = $form_state->getValue('ui_limit'); - $field['properties'] = $this->getProperties($form_state); - $field['type'] = $this->getType(); - $field['type_label'] = $this->getTypeLabel(); - - $entities = $form_state->getValue('entities'); - foreach ($entities as $key => $value) { - if ($key !== $value) { - unset($entities[$key]); - } - } - $field['entities'] = $entities; - - // Save field to property. - $this->field = $field; - - // Save field values. - $this->config('ds.field.' . $field['id'])->setData($field)->save(); - - // Clear caches and redirect. - $this->finishSubmitForm($form, $form_state); - } - - /** - * {@inheritdoc} - */ - protected function getEditableConfigNames() { - if (isset($this->field, $this->field['id'])) { - return [ - 'ds.field.' . $this->field['id'], - ]; - } - else { - return []; - } - } - - /** - * Returns the properties for the custom field. - */ - public function getProperties(FormStateInterface $form_state) { - return []; - } - - /** - * Returns the type of the field. - */ - public function getType() { - return ''; - } - - /** - * Returns the admin label for the field on the field overview page. - */ - public function getTypeLabel() { - return ''; - } - - /** - * Returns whether a field machine name is unique. - */ - public function uniqueFieldName($name) { - $value = strtr($name, ['-' => '_']); - $config = $this->configFactory()->get('ds.field.' . $value); - if ($config->get()) { - return TRUE; - } - return FALSE; - } - - /** - * Finishes the submit. - */ - public function finishSubmitForm(array &$form, FormStateInterface $form_state) { - $field = $this->field; - - // Save field and clear ds_fields_info cache. - $this->cacheInvalidator->invalidateTags(['ds_fields_info']); - - // Also clear the ds plugin cache. - \Drupal::service('plugin.manager.ds')->clearCachedDefinitions(); - - // Redirect. - $url = new Url('ds.fields_list'); - $form_state->setRedirectUrl($url); - drupal_set_message(t('The field %field has been saved.', ['%field' => $field['label']])); - } - -} diff --git a/web/modules/ds/src/Form/SettingsForm.php b/web/modules/ds/src/Form/SettingsForm.php deleted file mode 100644 index d527db6b6e..0000000000 --- a/web/modules/ds/src/Form/SettingsForm.php +++ /dev/null @@ -1,210 +0,0 @@ -<?php - -namespace Drupal\ds\Form; - -use Drupal\Core\Config\ConfigFactory; -use Drupal\Core\Entity\EntityFieldManagerInterface; -use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Form\ConfigFormBase; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Routing\RouteBuilderInterface; -use Drupal\Core\Theme\Registry; -use Drupal\Core\Url; -use Drupal\ds\Ds; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Configures Display Suite settings for this site. - */ -class SettingsForm extends ConfigFormBase { - - /** - * The module handler. - * - * @var \Drupal\Core\Extension\ModuleHandlerInterface - */ - protected $moduleHandler; - - /** - * The theme registry used. - * - * @var \Drupal\Core\Theme\Registry - */ - protected $themeRegistry; - - /** - * The route builder. - * - * @var \Drupal\Core\Routing\RouteBuilderInterface - */ - protected $routeBuilder; - - /** - * The entity manager. - * - * @var \Drupal\Core\Entity\EntityFieldManagerInterface - */ - protected $entityFieldManager; - - /** - * Constructs a \Drupal\ds\Form\SettingsForm object. - * - * @param \Drupal\Core\Config\ConfigFactory $config_factory - * The factory for configuration objects. - * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler - * The module handler. - * @param \Drupal\Core\Theme\Registry $theme_registry - * The theme registry used. - * @param \Drupal\Core\Routing\RouteBuilderInterface $route_builder - * The route builder. - * @param \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager - * The entity field manager. - */ - public function __construct(ConfigFactory $config_factory, ModuleHandlerInterface $module_handler, Registry $theme_registry, RouteBuilderInterface $route_builder, EntityFieldManagerInterface $entity_field_manager) { - parent::__construct($config_factory); - - $this->moduleHandler = $module_handler; - $this->themeRegistry = $theme_registry; - $this->routeBuilder = $route_builder; - $this->entityFieldManager = $entity_field_manager; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('config.factory'), - $container->get('module_handler'), - $container->get('theme.registry'), - $container->get('router.builder'), - $container->get('entity_field.manager') - ); - } - - /** - * {@inheritdoc} - */ - public function getFormId() { - return 'ds_admin_form'; - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state) { - $config = $this->config('ds.settings'); - - $form['additional_settings'] = [ - '#type' => 'vertical_tabs', - '#attached' => [ - 'library' => ['ds/admin'], - ], - ]; - - $form['fs1'] = [ - '#type' => 'details', - '#title' => $this->t('Field Templates'), - '#group' => 'additional_settings', - '#weight' => 1, - '#tree' => TRUE, - '#collapsed' => FALSE, - ]; - - $form['fs1']['field_template'] = [ - '#type' => 'checkbox', - '#title' => $this->t('Enable Field Templates'), - '#description' => $this->t('Customize the labels and the HTML output of your fields.'), - '#default_value' => $config->get('field_template'), - ]; - - $theme_functions = Ds::getFieldLayoutOptions(); - $url = new Url('ds.classes'); - $description = $this->t('<br/>Default will output the field as defined in Drupal Core.<br/>' . - 'Reset will strip all HTML.<br/>' . - 'Minimal adds a simple wrapper around the field.<br/>' . - 'There is also an Expert Field Template that gives full control over the HTML, but can only be set per field.<br/><br/>' . - 'You can override this setting per field on the "Manage display" screens or when creating fields on the instance level.<br/><br/>' . - '<strong>Template suggestions</strong><br/>' . - 'You can create .html.twig files as well for these field theme functions, e.g. field--reset.html.twig, field--minimal.html.twig<br/><br/>' . - '<label>CSS classes</label>You can add custom CSS classes on the <a href=":url">classes form</a>. These classes can be added to fields using the Default Field Template.<br/><br/>' . - '<label>Advanced</label>You can create your own custom field templates plugin. See Drupal\ds_test\Plugin\DsFieldTemplate for an example.', [':url' => $url->toString()]); - - $form['fs1']['ft-default'] = [ - '#type' => 'select', - '#title' => $this->t('Default Field Template'), - '#options' => $theme_functions, - '#default_value' => $config->get('ft-default'), - '#description' => $description, - '#states' => [ - 'visible' => [ - 'input[name="fs1[field_template]"]' => ['checked' => TRUE], - ], - ], - ]; - - $form['fs1']['ft-show-colon'] = [ - '#type' => 'checkbox', - '#title' => $this->t('Show colon'), - '#default_value' => $config->get('ft-show-colon'), - '#description' => $this->t('Show the colon on the reset field template.'), - '#states' => [ - 'visible' => [ - 'select[name="fs1[ft-default]"]' => ['value' => 'reset'], - 'input[name="fs1[field_template]"]' => ['checked' => TRUE], - ], - ], - ]; - - $form['fs3'] = [ - '#type' => 'details', - '#title' => $this->t('Other'), - '#group' => 'additional_settings', - '#weight' => 3, - '#tree' => TRUE, - ]; - $form['fs3']['use_field_names'] = [ - '#type' => 'checkbox', - '#title' => $this->t('Use field names in templates'), - '#default_value' => $config->get('use_field_names'), - '#description' => $this->t('Use field names in twig templates instead of the key'), - ]; - - return parent::buildForm($form, $form_state); - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - parent::submitForm($form, $form_state); - - $values = $form_state->getValues(); - $this->config('ds.settings') - ->set('field_template', $values['fs1']['field_template']) - ->set('ft-default', $values['fs1']['ft-default']) - ->set('ft-show-colon', $values['fs1']['ft-show-colon']) - ->set('use_field_names', $values['fs3']['use_field_names']) - ->save(); - - $this->entityFieldManager->clearCachedFieldDefinitions(); - $this->moduleHandler->resetImplementations(); - $this->themeRegistry->reset(); - $this->routeBuilder->setRebuildNeeded(); - - \Drupal::cache('render')->deleteAll(); - if ($this->moduleHandler->moduleExists('dynamic_page_cache')) { - \Drupal::cache('dynamic_page_cache')->deleteAll(); - } - } - - /** - * {@inheritdoc} - */ - protected function getEditableConfigNames() { - return [ - 'ds.settings', - ]; - } - -} diff --git a/web/modules/ds/src/Form/TokenFieldForm.php b/web/modules/ds/src/Form/TokenFieldForm.php deleted file mode 100644 index ed57692820..0000000000 --- a/web/modules/ds/src/Form/TokenFieldForm.php +++ /dev/null @@ -1,85 +0,0 @@ -<?php - -namespace Drupal\ds\Form; - -use Drupal\Core\Form\FormStateInterface; - -/** - * Configures token fields. - */ -class TokenFieldForm extends FieldFormBase { - - /** - * The type of the dynamic ds field. - */ - const TYPE = 'token'; - - /** - * {@inheritdoc} - */ - public function getFormId() { - return 'ds_field_form'; - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state, $field_key = '') { - $form = parent::buildForm($form, $form_state, $field_key); - $field = $this->field; - - $form['content'] = [ - '#type' => 'text_format', - '#title' => $this->t('Field content'), - '#default_value' => isset($field['properties']['content']['value']) ? $field['properties']['content']['value'] : '', - '#format' => isset($field['properties']['content']['format']) ? $field['properties']['content']['format'] : 'plain_text', - '#base_type' => 'textarea', - '#required' => TRUE, - ]; - - // Token support. - if (\Drupal::moduleHandler()->moduleExists('token')) { - $form['tokens'] = [ - '#title' => $this->t('Tokens'), - '#type' => 'container', - '#states' => [ - 'invisible' => [ - 'input[name="use_token"]' => ['checked' => FALSE], - ], - ], - ]; - $form['tokens']['help'] = [ - '#theme' => 'token_tree_link', - '#token_types' => 'all', - '#global_types' => FALSE, - '#dialog' => TRUE, - ]; - } - - return $form; - } - - /** - * {@inheritdoc} - */ - public function getProperties(FormStateInterface $form_state) { - return [ - 'content' => $form_state->getValue('content'), - ]; - } - - /** - * {@inheritdoc} - */ - public function getType() { - return TokenFieldForm::TYPE; - } - - /** - * {@inheritdoc} - */ - public function getTypeLabel() { - return 'Token field'; - } - -} diff --git a/web/modules/ds/src/Plugin/Derivative/BundleField.php b/web/modules/ds/src/Plugin/Derivative/BundleField.php deleted file mode 100644 index 895d93abb9..0000000000 --- a/web/modules/ds/src/Plugin/Derivative/BundleField.php +++ /dev/null @@ -1,78 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\Derivative; - -use Drupal\Component\Plugin\Derivative\DeriverBase; -use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Provides a derivative for bundle fields. - */ -class BundleField extends DeriverBase implements ContainerDeriverInterface { - - /** - * Stores all entity row plugin information. - * - * @var array - */ - protected $derivatives = []; - - /** - * The base plugin ID that the derivative is for. - * - * @var string - */ - protected $basePluginId; - - /** - * The entity manager. - * - * @var \Drupal\Core\Entity\EntityTypeManagerInterface - */ - protected $entityTypeManager; - - /** - * Constructs a DsEntityRow object. - * - * @param string $base_plugin_id - * The base plugin ID. - * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager - * The entity manager. - */ - public function __construct($base_plugin_id, EntityTypeManagerInterface $entity_type_manager) { - $this->basePluginId = $base_plugin_id; - $this->entityTypeManager = $entity_type_manager; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, $base_plugin_id) { - return new static( - $base_plugin_id, - $container->get('entity_type.manager') - ); - } - - /** - * {@inheritdoc} - */ - public function getDerivativeDefinitions($base_plugin_definition) { - foreach ($this->entityTypeManager->getDefinitions() as $entity_type_id => $entity_type) { - $base_table = $entity_type->getBaseTable(); - if ($entity_type->get('field_ui_base_route') && !empty($base_table)) { - $this->derivatives[$entity_type_id] = $base_plugin_definition; - $this->derivatives[$entity_type_id] += [ - 'provider' => $entity_type_id, - 'title' => 'Bundle name', - 'entity_type' => $entity_type_id, - ]; - } - } - - return $this->derivatives; - } - -} diff --git a/web/modules/ds/src/Plugin/Derivative/DsEntityRow.php b/web/modules/ds/src/Plugin/Derivative/DsEntityRow.php deleted file mode 100644 index 2da1b74b7a..0000000000 --- a/web/modules/ds/src/Plugin/Derivative/DsEntityRow.php +++ /dev/null @@ -1,108 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\Derivative; - -use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface; -use Drupal\views\ViewsData; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Provides DS views row plugin definitions for all non-special entity types. - * - * @ingroup views_row_plugins - * - * @see \Drupal\ds\Plugin\views\row\EntityRow - */ -class DsEntityRow implements ContainerDeriverInterface { - - /** - * Stores all entity row plugin information. - * - * @var array - */ - protected $derivatives = []; - - /** - * The base plugin ID that the derivative is for. - * - * @var string - */ - protected $basePluginId; - - /** - * The entity manager. - * - * @var \Drupal\Core\Entity\EntityTypeManagerInterface - */ - protected $entityTypeManager; - - /** - * The views data service. - * - * @var \Drupal\views\ViewsData - */ - protected $viewsData; - - /** - * Constructs a DsEntityRow object. - * - * @param string $base_plugin_id - * The base plugin ID. - * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager - * The entity manager. - * @param \Drupal\views\ViewsData $views_data - * The views data service. - */ - public function __construct($base_plugin_id, EntityTypeManagerInterface $entity_type_manager, ViewsData $views_data) { - $this->basePluginId = $base_plugin_id; - $this->entityTypeManager = $entity_type_manager; - $this->viewsData = $views_data; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, $base_plugin_id) { - return new static( - $base_plugin_id, - $container->get('entity_type.manager'), - $container->get('views.views_data') - ); - } - - /** - * {@inheritdoc} - */ - public function getDerivativeDefinition($derivative_id, $base_plugin_definition) { - if (!empty($this->derivatives) && !empty($this->derivatives[$derivative_id])) { - return $this->derivatives[$derivative_id]; - } - $this->getDerivativeDefinitions($base_plugin_definition); - return $this->derivatives[$derivative_id]; - } - - /** - * {@inheritdoc} - */ - public function getDerivativeDefinitions($base_plugin_definition) { - foreach ($this->entityTypeManager->getDefinitions() as $entity_type_id => $entity_type) { - // Just add support for entity types which have a views integration. - if (($base_table = $entity_type->getBaseTable()) && $this->viewsData->get($base_table) && $this->entityTypeManager->hasHandler($entity_type_id, 'view_builder')) { - $this->derivatives[$entity_type_id] = [ - 'id' => 'ds_entity:' . $entity_type_id, - 'provider' => 'ds', - 'title' => 'Display Suite: ' . $entity_type->getLabel(), - 'help' => t('Display the @label', ['@label' => $entity_type->getLabel()]), - 'base' => [$entity_type->getDataTable() ?: $entity_type->getBaseTable()], - 'entity_type' => $entity_type_id, - 'display_types' => ['normal'], - 'class' => $base_plugin_definition['class'], - ]; - } - } - - return $this->derivatives; - } - -} diff --git a/web/modules/ds/src/Plugin/Derivative/DsLocalTask.php b/web/modules/ds/src/Plugin/Derivative/DsLocalTask.php deleted file mode 100644 index 189e2ca879..0000000000 --- a/web/modules/ds/src/Plugin/Derivative/DsLocalTask.php +++ /dev/null @@ -1,73 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\Derivative; - -use Drupal\Component\Plugin\Derivative\DeriverBase; -use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface; -use Drupal\Core\StringTranslation\StringTranslationTrait; -use Drupal\Core\StringTranslation\TranslationInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Provides local task definitions for all entity bundles. - */ -class DsLocalTask extends DeriverBase implements ContainerDeriverInterface { - - use StringTranslationTrait; - - /** - * The entity manager. - * - * @var \Drupal\Core\Entity\EntityTypeManagerInterface - */ - protected $entityTypeManager; - - /** - * Creates an DevelLocalTask object. - * - * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager - * The entity manager. - * @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation - * The translation manager. - */ - public function __construct(EntityTypeManagerInterface $entity_type_manager, TranslationInterface $string_translation) { - $this->entityTypeManager = $entity_type_manager; - $this->stringTranslation = $string_translation; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, $base_plugin_id) { - return new static( - $container->get('entity_type.manager'), - $container->get('string_translation') - ); - } - - /** - * {@inheritdoc} - */ - public function getDerivativeDefinitions($base_plugin_definition) { - $this->derivatives = []; - - foreach ($this->entityTypeManager->getDefinitions() as $entity_type_id => $entity_type) { - if ($entity_type->hasLinkTemplate('display')) { - $this->derivatives["$entity_type_id.display_tab"] = [ - 'route_name' => "entity.$entity_type_id.display", - 'weight' => 10, - 'title' => $this->t('Manage display'), - 'base_route' => "entity.$entity_type_id.canonical", - ]; - } - } - - foreach ($this->derivatives as &$entry) { - $entry += $base_plugin_definition; - } - - return $this->derivatives; - } - -} diff --git a/web/modules/ds/src/Plugin/Derivative/DynamicBlockField.php b/web/modules/ds/src/Plugin/Derivative/DynamicBlockField.php deleted file mode 100644 index 07acf2631a..0000000000 --- a/web/modules/ds/src/Plugin/Derivative/DynamicBlockField.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\Derivative; - -use Drupal\ds\Form\BlockFieldForm; - -/** - * Retrieves dynamic block field plugin definitions. - */ -class DynamicBlockField extends DynamicField { - - /** - * {@inheritdoc} - */ - protected function getType() { - return BlockFieldForm::TYPE; - } - -} diff --git a/web/modules/ds/src/Plugin/Derivative/DynamicCopyField.php b/web/modules/ds/src/Plugin/Derivative/DynamicCopyField.php deleted file mode 100644 index 676a6665c3..0000000000 --- a/web/modules/ds/src/Plugin/Derivative/DynamicCopyField.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\Derivative; - -use Drupal\ds\Form\CopyFieldForm; - -/** - * Retrieves dynamic ds field plugin definitions. - */ -class DynamicCopyField extends DynamicField { - - /** - * {@inheritdoc} - */ - protected function getType() { - return CopyFieldForm::TYPE; - } - -} diff --git a/web/modules/ds/src/Plugin/Derivative/DynamicField.php b/web/modules/ds/src/Plugin/Derivative/DynamicField.php deleted file mode 100644 index eb76794584..0000000000 --- a/web/modules/ds/src/Plugin/Derivative/DynamicField.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\Derivative; - -use Drupal\Component\Plugin\Derivative\DeriverBase; -use Drupal\Component\Utility\Html; - -/** - * Retrieves dynamic field plugin definitions. - */ -abstract class DynamicField extends DeriverBase { - - /** - * {@inheritdoc} - */ - public function getDerivativeDefinitions($base_plugin_definition) { - - $custom_fields = \Drupal::configFactory()->listAll('ds.field.'); - - foreach ($custom_fields as $config) { - $field = \Drupal::config($config)->get(); - if ($field['type'] == $this->getType()) { - foreach ($field['entities'] as $entity_type) { - $key = $this->getKey($entity_type, $field); - $this->derivatives[$key] = $base_plugin_definition; - $this->derivatives[$key] += [ - 'title' => \Drupal::translation()->translate(Html::escape($field['label'])), - 'properties' => $field['properties'], - 'entity_type' => $entity_type, - ]; - if (!empty($field['ui_limit'])) { - $this->derivatives[$key]['ui_limit'] = explode("\n", $field['ui_limit']); - // Ensure that all strings are trimmed, eg. don't have extra spaces, - // \r chars etc. - foreach ($this->derivatives[$key]['ui_limit'] as $k => $v) { - $this->derivatives[$key]['ui_limit'][$k] = trim($v); - } - } - } - } - } - - return $this->derivatives; - } - - /** - * {@inheritdoc} - */ - protected function getType() { - return ''; - } - - /** - * {@inheritdoc} - */ - protected function getKey($entity_type, $field) { - return $entity_type . '-' . $field['id']; - } - -} diff --git a/web/modules/ds/src/Plugin/Derivative/DynamicTokenField.php b/web/modules/ds/src/Plugin/Derivative/DynamicTokenField.php deleted file mode 100644 index 6a36c38fdf..0000000000 --- a/web/modules/ds/src/Plugin/Derivative/DynamicTokenField.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\Derivative; - -use Drupal\ds\Form\TokenFieldForm; - -/** - * Retrieves dynamic code field plugin definitions. - */ -class DynamicTokenField extends DynamicField { - - /** - * {@inheritdoc} - */ - protected function getType() { - return TokenFieldForm::TYPE; - } - -} diff --git a/web/modules/ds/src/Plugin/DsField/Block/BlockDescription.php b/web/modules/ds/src/Plugin/DsField/Block/BlockDescription.php deleted file mode 100644 index dc8bb27fc8..0000000000 --- a/web/modules/ds/src/Plugin/DsField/Block/BlockDescription.php +++ /dev/null @@ -1,105 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField\Block; - -use Drupal\ds\Plugin\DsField\DsFieldBase; -use Drupal\Component\Utility\Html; -use Drupal\Core\Form\FormStateInterface; - -/** - * Plugin that renders the title of a block. - * - * @DsField( - * id = "block_description", - * title = @Translation("Description"), - * entity_type = "block_content", - * provider = "block_content" - * ) - */ -class BlockDescription extends DsFieldBase { - - /** - * {@inheritdoc} - */ - public function build() { - $config = $this->getConfiguration(); - - $output = $this->entity()->label(); - - if (empty($output)) { - return []; - } - - $output = Html::escape($output); - - // Wrapper and class. - if (!empty($config['wrapper'])) { - $wrapper = Html::escape($config['wrapper']); - $class = (!empty($config['class'])) ? ' class="' . Html::escape($config['class']) . '"' : ''; - $output = '<' . $wrapper . $class . '>' . $output . '</' . $wrapper . '>'; - } - - return [ - '#markup' => $output, - ]; - } - - /** - * {@inheritdoc} - */ - public function settingsForm($form, FormStateInterface $form_state) { - $config = $this->getConfiguration(); - - $settings['wrapper'] = [ - '#type' => 'textfield', - '#title' => 'Wrapper', - '#default_value' => $config['wrapper'], - '#description' => $this->t('Eg: h1, h2, p'), - ]; - $settings['class'] = [ - '#type' => 'textfield', - '#title' => 'Class', - '#default_value' => $config['class'], - '#description' => $this->t('Put a class on the wrapper. Eg: block-title'), - ]; - - return $settings; - } - - /** - * {@inheritdoc} - */ - public function settingsSummary($settings) { - $config = $this->getConfiguration(); - - $summary = []; - $summary[] = 'Wrapper: ' . $config['wrapper']; - - if (!empty($config['class'])) { - $summary[] = 'Class: ' . $config['class']; - } - - return $summary; - } - - /** - * {@inheritdoc} - */ - public function defaultConfiguration() { - - $configuration = [ - 'wrapper' => 'h2', - 'class' => '', - ]; - - return $configuration; - } - - /** - * {@inheritdoc} - */ - protected function entityRenderKey() { - return 'label'; - } - -} diff --git a/web/modules/ds/src/Plugin/DsField/BlockBase.php b/web/modules/ds/src/Plugin/DsField/BlockBase.php deleted file mode 100644 index 21490d8ee4..0000000000 --- a/web/modules/ds/src/Plugin/DsField/BlockBase.php +++ /dev/null @@ -1,146 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField; - -use Drupal\Core\Plugin\ContainerFactoryPluginInterface; -use Drupal\Core\Plugin\Context\ContextHandlerInterface; -use Drupal\Core\Plugin\Context\ContextRepositoryInterface; -use Drupal\Core\Plugin\ContextAwarePluginInterface; -use Drupal\Core\Render\Element; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Drupal\Core\Block\BlockManagerInterface; - -/** - * The base plugin to create DS block fields. - */ -abstract class BlockBase extends DsFieldBase implements ContainerFactoryPluginInterface { - - /** - * The block. - * - * @var \Drupal\Core\Block\BlockPluginInterface - */ - protected $block; - - /** - * The BlockManager service. - * - * @var \Drupal\Core\Block\BlockManagerInterface - */ - protected $blockManager; - - /** - * The context handler. - * - * @var \Drupal\Core\Plugin\Context\ContextHandlerInterface - */ - protected $contextHandler; - - /** - * The context repository interface. - * - * @var \Drupal\Core\Plugin\Context\ContextRepositoryInterface - */ - protected $contextRepository; - - /** - * Constructs a Display Suite field plugin. - */ - public function __construct($configuration, $plugin_id, $plugin_definition, ContextHandlerInterface $contextHandler, ContextRepositoryInterface $contextRepository, BlockManagerInterface $block_manager) { - $this->blockManager = $block_manager; - $this->contextHandler = $contextHandler; - $this->contextRepository = $contextRepository; - - parent::__construct($configuration, $plugin_id, $plugin_definition); - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $container->get('context.handler'), - $container->get('context.repository'), - $container->get('plugin.manager.block') - ); - } - - /** - * {@inheritdoc} - */ - public function build() { - // Get block. - $block = $this->getBlock(); - - // Apply block config. - $block_config = $this->blockConfig(); - $block->setConfiguration($block_config); - - if ($block->access(\Drupal::currentUser())) { - // Inject context values. - if ($block instanceof ContextAwarePluginInterface) { - $contexts = $this->contextRepository->getRuntimeContexts(array_values($block->getContextMapping())); - $this->contextHandler->applyContextMapping($block, $contexts); - } - - $block_elements = $block->build(); - - // Merge cache contexts, tags and max-age. - if ($contexts = $block->getCacheContexts()) { - $block_elements['#cache']['contexts'] = (is_array($block_elements['#cache']['contexts']) ? $block_elements['#cache']['contexts'] : []); - $block_elements['#cache']['contexts'] = array_unique(array_merge($block_elements['#cache']['contexts'], $contexts)); - } - - if ($tags = $block->getCacheTags()) { - $block_elements['#cache']['tags'] = (is_array($block_elements['#cache']['tags']) ? $block_elements['#cache']['tags'] : []); - $block_elements['#cache']['tags'] = array_unique(array_merge($block_elements['#cache']['tags'], $tags)); - } - - // Add the block base config cache tag. - $block_elements['#cache']['tags'][] = 'config:ds.block_base'; - - if ($max_age = $block->getCacheMaxAge()) { - $block_elements['#cache']['max-age'] = $max_age; - } - - // Return an empty array if there is nothing to render. - return Element::isEmpty($block_elements) ? [] : $block_elements; - } - - return []; - } - - /** - * Returns the plugin ID of the block. - */ - protected function blockPluginId() { - return ''; - } - - /** - * Returns the config of the block. - */ - protected function blockConfig() { - return []; - } - - /** - * Return the block entity. - */ - protected function getBlock() { - if (!$this->block) { - // Create an instance of the block. - /* @var $block BlockPluginInterface */ - $block_id = $this->blockPluginId(); - $block = $this->blockManager->createInstance($block_id); - - $this->block = $block; - } - - return $this->block; - } - -} diff --git a/web/modules/ds/src/Plugin/DsField/Book/BookNavigation.php b/web/modules/ds/src/Plugin/DsField/Book/BookNavigation.php deleted file mode 100644 index 4792eb375f..0000000000 --- a/web/modules/ds/src/Plugin/DsField/Book/BookNavigation.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField\Book; - -use Drupal\ds\Plugin\DsField\DsFieldBase; - -/** - * Plugin that the book navigation. - * - * @DsField( - * id = "book_navigation", - * title = @Translation("Book navigation"), - * entity_type = "node", - * provider = "book" - * ) - */ -class BookNavigation extends DsFieldBase { - - /** - * {@inheritdoc} - */ - public function isAllowed() { - - // We only allow the 'full' view mode. - if ($this->viewMode() != 'full') { - return FALSE; - } - - // Get all the allowed types. - $types = \Drupal::config('book.settings')->get('allowed_types'); - - if (!empty($types)) { - foreach ($types as $type) { - if ($type) { - return TRUE; - } - } - } - - // Return false when there where no displays. - return FALSE; - } - -} diff --git a/web/modules/ds/src/Plugin/DsField/BundleField.php b/web/modules/ds/src/Plugin/DsField/BundleField.php deleted file mode 100644 index 460cc62d32..0000000000 --- a/web/modules/ds/src/Plugin/DsField/BundleField.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField; - -use Drupal\Core\Entity\EntityTypeManagerInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Defines a generic bundle field. - * - * @DsField( - * id = "bundle_field", - * deriver = "Drupal\ds\Plugin\Derivative\BundleField" - * ) - */ -class BundleField extends DsFieldBase { - - /** - * The EntityDisplayRepository service. - * - * @var \Drupal\Core\Entity\EntityTypeManagerInterface - */ - protected $entityTypeManager; - - /** - * Constructs a Display Suite field plugin. - */ - public function __construct($configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager) { - $this->entityTypeManager = $entity_type_manager; - - parent::__construct($configuration, $plugin_id, $plugin_definition); - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $container->get('entity.manager') - ); - } - - /** - * {@inheritdoc} - */ - public function build() { - $config = $this->getConfiguration(); - $entity = $this->entity(); - $bundles_info = $this->entityTypeManager->getBundleInfo($config['field']['entity_type']); - $output = $bundles_info[$entity->bundle()]['label']; - - return [ - '#markup' => $output, - ]; - } - -} diff --git a/web/modules/ds/src/Plugin/DsField/Comment/CommentAuthor.php b/web/modules/ds/src/Plugin/DsField/Comment/CommentAuthor.php deleted file mode 100644 index fc4831f6d2..0000000000 --- a/web/modules/ds/src/Plugin/DsField/Comment/CommentAuthor.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField\Comment; - -use Drupal\ds\Plugin\DsField\Field; - -/** - * Plugin that renders the author of a comment. - * - * @DsField( - * id = "comment_author", - * title = @Translation("Author"), - * entity_type = "comment", - * provider = "comment" - * ) - */ -class CommentAuthor extends Field { - - /** - * {@inheritdoc} - */ - protected function entityRenderKey() { - return 'name'; - } - -} diff --git a/web/modules/ds/src/Plugin/DsField/Comment/CommentChangedDate.php b/web/modules/ds/src/Plugin/DsField/Comment/CommentChangedDate.php deleted file mode 100644 index 93af3630fb..0000000000 --- a/web/modules/ds/src/Plugin/DsField/Comment/CommentChangedDate.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField\Comment; - -use Drupal\ds\Plugin\DsField\Date; - -/** - * Plugin that renders the changed date of a comment. - * - * @DsField( - * id = "comment_changed_date", - * title = @Translation("Last modified"), - * entity_type = "comment", - * provider = "comment" - * ) - */ -class CommentChangedDate extends Date { - - /** - * {@inheritdoc} - */ - public function getRenderKey() { - return 'changed'; - } - -} diff --git a/web/modules/ds/src/Plugin/DsField/Comment/CommentPostDate.php b/web/modules/ds/src/Plugin/DsField/Comment/CommentPostDate.php deleted file mode 100644 index c4d6b0655d..0000000000 --- a/web/modules/ds/src/Plugin/DsField/Comment/CommentPostDate.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField\Comment; - -use Drupal\ds\Plugin\DsField\Date; - -/** - * Plugin that renders the post date of a comment. - * - * @DsField( - * id = "comment_post_date", - * title = @Translation("Post date"), - * entity_type = "comment", - * provider = "comment" - * ) - */ -class CommentPostDate extends Date { - - /** - * Returns the entity render key for this field. - */ - public function getRenderKey() { - return 'created'; - } - -} diff --git a/web/modules/ds/src/Plugin/DsField/Comment/CommentTitle.php b/web/modules/ds/src/Plugin/DsField/Comment/CommentTitle.php deleted file mode 100644 index 44a3171b9e..0000000000 --- a/web/modules/ds/src/Plugin/DsField/Comment/CommentTitle.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField\Comment; - -use Drupal\ds\Plugin\DsField\Field; - -/** - * Plugin that renders the title of a comment. - * - * @DsField( - * id = "comment_title", - * title = @Translation("Title"), - * entity_type = "comment", - * provider = "comment" - * ) - */ -class CommentTitle extends Field { - - /** - * {@inheritdoc} - */ - protected function entityRenderKey() { - return 'subject'; - } - -} diff --git a/web/modules/ds/src/Plugin/DsField/Comment/CommentUser.php b/web/modules/ds/src/Plugin/DsField/Comment/CommentUser.php deleted file mode 100644 index 65b92f5a53..0000000000 --- a/web/modules/ds/src/Plugin/DsField/Comment/CommentUser.php +++ /dev/null @@ -1,77 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField\Comment; - -use Drupal\Core\Entity\EntityDisplayRepositoryInterface; -use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\ds\Plugin\DsField\Entity; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Plugin that renders a view mode. - * - * @DsField( - * id = "comment_user", - * title = @Translation("User"), - * entity_type = "comment", - * provider = "user" - * ) - */ -class CommentUser extends Entity { - - /** - * The entity manager. - * - * @var \Drupal\Core\Entity\EntityTypeManagerInterface - */ - protected $entityTypeManager; - - /** - * {@inheritdoc} - */ - public function __construct($configuration, $plugin_id, $plugin_definition, EntityDisplayRepositoryInterface $entity_display_repository, EntityTypeManagerInterface $entity_type_manager) { - $this->entityTypeManager = $entity_type_manager; - - parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_display_repository); - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $container->get('entity_display.repository'), - $container->get('entity_type.manager') - ); - } - - /** - * {@inheritdoc} - */ - public function build() { - $view_mode = $this->getEntityViewMode(); - - /* @var $comment \Drupal\comment\CommentInterface */ - $comment = $this->entity(); - $uid = $comment->getOwnerId(); - $user = $this->entityTypeManager - ->getStorage('user') - ->load($uid); - $build = $this->entityTypeManager - ->getViewBuilder('user') - ->view($user, $view_mode); - - return $build; - } - - /** - * {@inheritdoc} - */ - public function linkedEntity() { - return 'user'; - } - -} diff --git a/web/modules/ds/src/Plugin/DsField/Comment/CommentUserSignature.php b/web/modules/ds/src/Plugin/DsField/Comment/CommentUserSignature.php deleted file mode 100644 index 2a2b7c3a7b..0000000000 --- a/web/modules/ds/src/Plugin/DsField/Comment/CommentUserSignature.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField\Comment; - -use Drupal\ds\Plugin\DsField\User\UserSignature; -use Drupal\user\Entity\User; - -/** - * Plugin that renders the user signature of a comment. - * - * @DsField( - * id = "comment_user_signature", - * title = @Translation("User signature"), - * entity_type = "comment", - * provider = "comment" - * ) - */ -class CommentUserSignature extends UserSignature { - - /** - * {@inheritdoc} - */ - public function build() { - $comment = $this->entity(); - $user_id = $comment->uid->target_id; - $user = User::load($user_id); - - $key = $this->key(); - if (isset($user->{$key}->value)) { - $format = $this->format(); - return [ - '#type' => 'processed_text', - '#text' => $user->{$key}->value, - '#format' => $user->{$format}->value, - '#filter_types_to_skip' => [], - '#langcode' => '', - ]; - } - - return []; - } - -} diff --git a/web/modules/ds/src/Plugin/DsField/Date.php b/web/modules/ds/src/Plugin/DsField/Date.php deleted file mode 100644 index b843eb5a4f..0000000000 --- a/web/modules/ds/src/Plugin/DsField/Date.php +++ /dev/null @@ -1,90 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField; - -use Drupal\Core\Datetime\DateFormatterInterface; -use Drupal\Core\Entity\EntityTypeManagerInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * The base plugin to create DS post date plugins. - */ -abstract class Date extends DsFieldBase { - - /** - * The EntityDisplayRepository service. - * - * @var \Drupal\Core\Entity\EntityTypeManagerInterface - */ - protected $entityTypeManager; - - /** - * The date formatter service. - * - * @var \Drupal\Core\Datetime\DateFormatterInterface - */ - protected $dateFormatter; - - /** - * Constructs a Display Suite field plugin. - */ - public function __construct($configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, DateFormatterInterface $date_formatter) { - $this->entityTypeManager = $entity_type_manager; - $this->dateFormatter = $date_formatter; - - parent::__construct($configuration, $plugin_id, $plugin_definition); - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $container->get('entity_type.manager'), - $container->get('date.formatter') - ); - } - - /** - * {@inheritdoc} - */ - public function build() { - $field = $this->getFieldConfiguration(); - $date_format = str_replace('ds_post_date_', '', $field['formatter']); - $render_key = $this->getRenderKey(); - - return [ - '#markup' => $this->dateFormatter->format($this->entity()->{$render_key}->value, $date_format), - ]; - } - - /** - * {@inheritdoc} - */ - public function formatters() { - $date_types = $this->entityTypeManager->getStorage('date_format') - ->loadMultiple(); - - $date_formatters = []; - foreach ($date_types as $machine_name => $value) { - /* @var $value \Drupal\Core\Datetime\DateFormatterInterface */ - if ($value->isLocked()) { - continue; - } - $date_formatters['ds_post_date_' . $machine_name] = $this->t($value->id()); - } - - return $date_formatters; - } - - /** - * Returns the entity render key for this field. - */ - public function getRenderKey() { - return ''; - } - -} diff --git a/web/modules/ds/src/Plugin/DsField/DsFieldBase.php b/web/modules/ds/src/Plugin/DsField/DsFieldBase.php deleted file mode 100644 index ddc7f8f1ba..0000000000 --- a/web/modules/ds/src/Plugin/DsField/DsFieldBase.php +++ /dev/null @@ -1,181 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField; - -use Drupal\Core\Plugin\PluginBase; -use Drupal\Core\Form\FormStateInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Base class for all the ds plugins. - */ -abstract class DsFieldBase extends PluginBase implements DsFieldInterface { - - /** - * {@inheritdoc} - */ - public function __construct(array $configuration, $plugin_id, $plugin_definition) { - parent::__construct($configuration, $plugin_id, $plugin_definition); - - $this->configuration += $this->defaultConfiguration(); - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static( - $configuration, - $plugin_id, - $plugin_definition - ); - } - - /** - * {@inheritdoc} - */ - public function build() { - return []; - } - - /** - * {@inheritdoc} - */ - public function settingsForm($form, FormStateInterface $form_state) { - return []; - } - - /** - * {@inheritdoc} - */ - public function settingsSummary($settings) { - return []; - } - - /** - * {@inheritdoc} - */ - public function defaultConfiguration() { - return []; - } - - /** - * {@inheritdoc} - */ - public function getConfiguration() { - return $this->configuration; - } - - /** - * {@inheritdoc} - */ - public function setConfiguration(array $configuration) { - $this->configuration = $configuration + $this->configuration; - } - - /** - * {@inheritdoc} - */ - public function formatters() { - return []; - } - - /** - * {@inheritdoc} - */ - public function isAllowed() { - $definition = $this->getPluginDefinition(); - if (!isset($definition['ui_limit'])) { - return TRUE; - } - - $limits = $definition['ui_limit']; - foreach ($limits as $limit) { - if (strpos($limit, '|') !== FALSE) { - list($bundle_limit, $view_mode_limit) = explode('|', $limit); - - if (($bundle_limit == $this->bundle() || $bundle_limit == '*') && ($view_mode_limit == $this->viewMode() || $view_mode_limit == '*')) { - return TRUE; - } - } - } - - // When the current bundle view_mode combination is not allowed we shouldn't - // show the field. - return FALSE; - } - - /** - * {@inheritdoc} - */ - public function entity() { - return $this->configuration['entity']; - } - - /** - * {@inheritdoc} - */ - public function getEntityTypeId() { - if (isset($this->configuration['entity_type'])) { - return $this->configuration['entity_type']; - } - elseif ($entity = $this->entity()) { - /* @var $entity EntityInterface */ - return $entity->getEntityTypeId(); - } - else { - return ''; - } - } - - /** - * {@inheritdoc} - */ - public function bundle() { - return $this->configuration['bundle']; - } - - /** - * {@inheritdoc} - */ - public function viewMode() { - return $this->configuration['view_mode']; - } - - /** - * {@inheritdoc} - */ - public function getFieldConfiguration() { - return $this->configuration['field']; - } - - /** - * {@inheritdoc} - */ - public function getName() { - return $this->configuration['field_name']; - } - - /** - * {@inheritdoc} - */ - public function getTitle() { - return $this->configuration['field']['title']; - } - - /** - * {@inheritdoc} - */ - public function calculateDependencies() { - // By default there are no dependencies. - return []; - } - - /** - * {@inheritdoc} - */ - public function isMultiple() { - return FALSE; - } - -} diff --git a/web/modules/ds/src/Plugin/DsField/DsFieldInterface.php b/web/modules/ds/src/Plugin/DsField/DsFieldInterface.php deleted file mode 100644 index 449ceb8790..0000000000 --- a/web/modules/ds/src/Plugin/DsField/DsFieldInterface.php +++ /dev/null @@ -1,126 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField; - -use Drupal\Component\Plugin\ConfigurablePluginInterface; -use Drupal\Core\Plugin\ContainerFactoryPluginInterface; -use Drupal\Core\Form\FormStateInterface; - -/** - * Defines a common interface for all ds field plugins. - */ -interface DsFieldInterface extends ConfigurablePluginInterface, ContainerFactoryPluginInterface { - - /** - * Renders a field. - * - * @return array - * A renderable array representing the content of the field. - */ - public function build(); - - /** - * Returns the summary of the chosen settings. - * - * @param array $settings - * Contains the settings of the field. - * - * @return array - * A render array containing the summary. - */ - public function settingsSummary($settings); - - /** - * The form that holds the settings for this plugin. - * - * @param array $form - * The form definition array for the field configuration form. - * @param \Drupal\Core\Form\FormStateInterface $form_state - * The current state of the form. - * - * @return array - * The renderable form array representing the entire configuration form. - */ - public function settingsForm($form, FormStateInterface $form_state); - - /** - * Returns a list of possible formatters for this field. - * - * @return array - * A list of possible formatters. - */ - public function formatters(); - - /** - * Returns if the field is allowed on the field UI screen. - * - * @return bool - * TRUE when field allowed, FALSE otherwise. - */ - public function isAllowed(); - - /** - * Gets the current entity. - * - * @return \Drupal\Core\Entity\EntityInterface - * The current entity. - */ - public function entity(); - - /** - * Gets the current entity type. - * - * @return string - * The entity type ID. - */ - public function getEntityTypeId(); - - /** - * Gets the current bundle. - * - * @return string - * The configured bundle of the entity. - */ - public function bundle(); - - /** - * Gets the view mode. - * - * @return string - * The configured view mode. - */ - public function viewMode(); - - /** - * Gets the field configuration. - * - * @return array - * The configured field settings. - */ - public function getFieldConfiguration(); - - /** - * Gets the field name. - * - * @return string - * The field name. - */ - public function getName(); - - /** - * Returns the title of the field. - * - * @return string - * The configured field title. - */ - public function getTitle(); - - /** - * Defines if we are dealing with a multivalue field. - * - * @return bool - * TRUE when field has multiple values, FALSE otherwise. - */ - public function isMultiple(); - -} diff --git a/web/modules/ds/src/Plugin/DsField/DynamicBlockField.php b/web/modules/ds/src/Plugin/DsField/DynamicBlockField.php deleted file mode 100644 index 3bd139c5fc..0000000000 --- a/web/modules/ds/src/Plugin/DsField/DynamicBlockField.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField; - -use Drupal\views\Plugin\Block\ViewsBlock; - -/** - * Defines a generic dynamic block field. - * - * @DsField( - * id = "dynamic_block_field", - * deriver = "Drupal\ds\Plugin\Derivative\DynamicBlockField", - * provider = "block" - * ) - */ -class DynamicBlockField extends BlockBase { - - /** - * {@inheritdoc} - */ - protected function blockPluginId() { - $definition = $this->getPluginDefinition(); - return $definition['properties']['block']; - } - - /** - * {@inheritdoc} - */ - protected function blockConfig() { - $block_config = []; - $definition = $this->getPluginDefinition(); - if (isset($definition['properties']['config'])) { - $block_config = $definition['properties']['config']; - } - - return $block_config; - } - - /** - * Returns the title of the block. - */ - public function getTitle() { - $field = $this->getFieldConfiguration(); - $title = $field['title']; - - if (isset($field['properties']['use_block_title']) && $field['properties']['use_block_title'] == TRUE) { - /* @var $block BlockPluginInterface */ - $block = $this->getBlock(); - - if ($block instanceof ViewsBlock) { - $block_build = $block->build(); - if (!empty($block_build['#title'])) { - $title = $block_build['#title']; - } - } - else { - $title = $block->label(); - } - } - - return $title; - } - -} diff --git a/web/modules/ds/src/Plugin/DsField/DynamicCopyField.php b/web/modules/ds/src/Plugin/DsField/DynamicCopyField.php deleted file mode 100644 index 3a0263b76f..0000000000 --- a/web/modules/ds/src/Plugin/DsField/DynamicCopyField.php +++ /dev/null @@ -1,96 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField; - -use Drupal\Core\Form\FormStateInterface; -use Drupal\ds\Plugin\DsPluginManager; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Defines a generic dynamic field that holds a copy of an existing ds field. - * - * @DsField( - * id = "dynamic_copy_field", - * deriver = "Drupal\ds\Plugin\Derivative\DynamicCopyField", - * ) - */ -class DynamicCopyField extends DsFieldBase { - - /** - * The loaded instance. - * - * @var \Drupal\ds\Plugin\DsField\DsFieldInterface - */ - private $fieldInstance; - - /** - * Constructs a Display Suite field plugin. - */ - public function __construct($configuration, $plugin_id, $plugin_definition, DsPluginManager $plugin_Manager) { - parent::__construct($configuration, $plugin_id, $plugin_definition); - - $this->fieldInstance = $plugin_Manager->createInstance($plugin_definition['properties']['ds_plugin'], $configuration); - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $container->get('plugin.manager.ds') - ); - } - - /** - * {@inheritdoc} - */ - public function build() { - return $this->fieldInstance->build(); - } - - /** - * {@inheritdoc} - */ - public function settingsForm($form, FormStateInterface $form_state) { - return $this->fieldInstance->settingsForm($form, $form_state); - } - - /** - * {@inheritdoc} - */ - public function settingsSummary($settings) { - return $this->fieldInstance->settingsSummary($settings); - } - - /** - * {@inheritdoc} - */ - public function getConfiguration() { - return $this->fieldInstance->getConfiguration(); - } - - /** - * {@inheritdoc} - */ - public function setConfiguration(array $configuration) { - return $this->fieldInstance->setConfiguration($configuration); - } - - /** - * {@inheritdoc} - */ - public function defaultConfiguration() { - return []; - } - - /** - * {@inheritdoc} - */ - public function formatters() { - return $this->fieldInstance->formatters(); - } - -} diff --git a/web/modules/ds/src/Plugin/DsField/DynamicTokenField.php b/web/modules/ds/src/Plugin/DsField/DynamicTokenField.php deleted file mode 100644 index 4ab6bb85a5..0000000000 --- a/web/modules/ds/src/Plugin/DsField/DynamicTokenField.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField; - -/** - * Defines a generic dynamic code field. - * - * @DsField( - * id = "dynamic_token_field", - * deriver = "Drupal\ds\Plugin\Derivative\DynamicTokenField" - * ) - */ -class DynamicTokenField extends TokenBase { - - /** - * {@inheritdoc} - */ - public function content() { - $definition = $this->getPluginDefinition(); - return $definition['properties']['content']['value']; - } - - /** - * {@inheritdoc} - */ - public function format() { - $definition = $this->getPluginDefinition(); - return $definition['properties']['content']['format']; - } - -} diff --git a/web/modules/ds/src/Plugin/DsField/Entity.php b/web/modules/ds/src/Plugin/DsField/Entity.php deleted file mode 100644 index 0ad37a67a1..0000000000 --- a/web/modules/ds/src/Plugin/DsField/Entity.php +++ /dev/null @@ -1,116 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField; - -use Drupal\Core\Entity\EntityDisplayRepositoryInterface; -use Drupal\Core\Form\FormStateInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Renders an entity by a given view mode. - */ -abstract class Entity extends DsFieldBase { - - /** - * The EntityDisplayRepository service. - * - * @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface - */ - protected $entityDisplayRepository; - - /** - * Constructs a Display Suite field plugin. - */ - public function __construct($configuration, $plugin_id, $plugin_definition, EntityDisplayRepositoryInterface $entity_display_repository) { - $this->entityDisplayRepository = $entity_display_repository; - - parent::__construct($configuration, $plugin_id, $plugin_definition); - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $container->get('entity_display.repository') - ); - } - - /** - * {@inheritdoc} - */ - public function settingsForm($form, FormStateInterface $form_state) { - $entity = $this->linkedEntity(); - $view_modes = $this->entityDisplayRepository->getViewModes($entity); - - $options = []; - foreach ($view_modes as $id => $view_mode) { - $options[$id] = $view_mode['label']; - } - - $config = $this->getConfiguration(); - $form['entity_view_mode'] = [ - '#type' => 'select', - '#title' => 'View mode', - '#default_value' => $config['entity_view_mode'], - '#options' => $options, - ]; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function settingsSummary($settings) { - $entity = $this->linkedEntity(); - $view_modes = $this->entityDisplayRepository->getViewModes($entity); - - // When no view modes are found no summary is displayed. - if (empty($view_modes)) { - return ''; - } - - // Print the chosen view mode or the default one. - $config = $this->getConfiguration(); - $entity_view_mode = $config['entity_view_mode']; - $summary[] = 'View mode: ' . $view_modes[$entity_view_mode]['label']; - - return $summary; - } - - /** - * {@inheritdoc} - */ - public function defaultConfiguration() { - $entity = $this->linkedEntity(); - $view_modes = $this->entityDisplayRepository->getViewModes($entity); - reset($view_modes); - $default_view_mode = key($view_modes); - - $configuration = [ - 'entity_view_mode' => $default_view_mode, - ]; - - return $configuration; - } - - /** - * Gets the wanted entity. - */ - public function linkedEntity() { - return ''; - } - - /** - * Gets the view mode. - */ - public function getEntityViewMode() { - $config = $this->getConfiguration(); - return $config['entity_view_mode']; - } - -} diff --git a/web/modules/ds/src/Plugin/DsField/Field.php b/web/modules/ds/src/Plugin/DsField/Field.php deleted file mode 100644 index 73c83419a4..0000000000 --- a/web/modules/ds/src/Plugin/DsField/Field.php +++ /dev/null @@ -1,93 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField; - -use Drupal\Core\Template\Attribute; - -/** - * The base plugin to create DS fields. - */ -abstract class Field extends DsFieldBase { - - /** - * {@inheritdoc} - */ - public function build() { - $config = $this->getConfiguration(); - - // Initialize output. - $output = ''; - - // Basic string. - $entity_render_key = $this->entityRenderKey(); - - if (isset($config['link text'])) { - $output = $this->t($config['link text']); - } - elseif (!empty($entity_render_key) && isset($this->entity()->{$entity_render_key})) { - if ($this->getEntityTypeId() == 'user' && $entity_render_key == 'name') { - $output = $this->entity()->getUsername(); - } - else { - $output = $this->entity()->{$entity_render_key}->value; - } - } - - if (empty($output)) { - return []; - } - - $template = <<<TWIG -{% if wrapper %} -<{{ wrapper }}{{ attributes }}> -{% endif %} -{% if is_link %} - {{ link(output, entity_url) }} -{% else %} - {{ output }} -{% endif %} -{% if wrapper %} -</{{ wrapper }}> -{% endif %} -TWIG; - - // Sometimes it can be impossible to make a link to the entity, because it - // has no id as it has not yet been saved, e.g. when previewing an unsaved - // inline entity form. - $is_link = FALSE; - $entity_url = NULL; - if (!empty($this->entity()->id())) { - $is_link = !empty($config['link']); - $entity_url = $this->entity()->toUrl(); - if (!empty($config['link class'])) { - $entity_url->setOption('attributes', ['class' => explode(' ', $config['link class'])]); - } - } - - // Build the attributes. - $attributes = new Attribute(); - if (!empty($config['class'])) { - $attributes->addClass($config['class']); - } - - return [ - '#type' => 'inline_template', - '#template' => $template, - '#context' => [ - 'is_link' => $is_link, - 'wrapper' => !empty($config['wrapper']) ? $config['wrapper'] : '', - 'attributes' => $attributes, - 'entity_url' => $entity_url, - 'output' => $output, - ], - ]; - } - - /** - * Returns the entity render key for this field. - */ - protected function entityRenderKey() { - return ''; - } - -} diff --git a/web/modules/ds/src/Plugin/DsField/Link.php b/web/modules/ds/src/Plugin/DsField/Link.php deleted file mode 100644 index 4c26a6d3dd..0000000000 --- a/web/modules/ds/src/Plugin/DsField/Link.php +++ /dev/null @@ -1,82 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField; - -use Drupal\Core\Form\FormStateInterface; - -/** - * Plugin that renders a link. - */ -abstract class Link extends Field { - - /** - * {@inheritdoc} - */ - public function settingsForm($form, FormStateInterface $form_state) { - $config = $this->getConfiguration(); - - $form['link text'] = [ - '#type' => 'textfield', - '#title' => 'Link text', - '#default_value' => $config['link text'], - ]; - $form['link class'] = [ - '#type' => 'textfield', - '#title' => 'Link class', - '#default_value' => $config['link class'], - '#description' => $this->t('Put a class on the link. Eg: btn btn-default'), - ]; - $form['wrapper'] = [ - '#type' => 'textfield', - '#title' => 'Wrapper', - '#default_value' => $config['wrapper'], - '#description' => $this->t('Eg: h1, h2, p'), - ]; - $form['class'] = [ - '#type' => 'textfield', - '#title' => 'Class', - '#default_value' => $config['class'], - '#description' => $this->t('Put a class on the wrapper. Eg: block-title'), - ]; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function settingsSummary($settings) { - $config = $this->getConfiguration(); - - $summary = []; - $summary[] = 'Link text: ' . $config['link text']; - if (!empty($config['link class'])) { - $summary[] = 'Link class: ' . $config['link class']; - } - if (!empty($config['wrapper'])) { - $summary[] = 'Wrapper: ' . $config['wrapper']; - } - if (!empty($config['class'])) { - $summary[] = 'Class: ' . $config['class']; - } - - return $summary; - } - - /** - * {@inheritdoc} - */ - public function defaultConfiguration() { - - $configuration = [ - 'link text' => 'Read more', - 'link class' => '', - 'wrapper' => '', - 'class' => '', - 'link' => 1, - ]; - - return $configuration; - } - -} diff --git a/web/modules/ds/src/Plugin/DsField/Markup.php b/web/modules/ds/src/Plugin/DsField/Markup.php deleted file mode 100644 index f23f509545..0000000000 --- a/web/modules/ds/src/Plugin/DsField/Markup.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField; - -/** - * DS field markup base field. - */ -abstract class Markup extends DsFieldBase { - - /** - * {@inheritdoc} - */ - public function build() { - $key = $this->key(); - if (isset($this->entity()->{$key}->value)) { - $format = $this->format(); - - return [ - '#type' => 'processed_text', - '#text' => $this->entity()->{$key}->value, - '#format' => $format, - '#filter_types_to_skip' => [], - '#langcode' => '', - ]; - } - - return []; - } - - /** - * Gets the key of the field that needs to be rendered. - */ - protected function key() { - return ''; - } - - /** - * Gets the text format. - */ - protected function format() { - return 'filtered_html'; - } - -} diff --git a/web/modules/ds/src/Plugin/DsField/Node/NodeAuthor.php b/web/modules/ds/src/Plugin/DsField/Node/NodeAuthor.php deleted file mode 100644 index 5e85d9b841..0000000000 --- a/web/modules/ds/src/Plugin/DsField/Node/NodeAuthor.php +++ /dev/null @@ -1,73 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField\Node; - -use Drupal\ds\Plugin\DsField\DsFieldBase; - -/** - * Plugin that renders the author of a node. - * - * @DsField( - * id = "node_author", - * title = @Translation("Author"), - * entity_type = "node", - * provider = "node" - * ) - */ -class NodeAuthor extends DsFieldBase { - - /** - * {@inheritdoc} - */ - public function build() { - /* @var $node NodeInterface */ - $node = $this->entity(); - - /* @var $user UserInterface */ - $user = $node->getOwner(); - - // Users without a user name are anonymous users. These are never linked. - if (empty($user->name)) { - return [ - '#plain_text' => \Drupal::config('user.settings')->get('anonymous'), - ]; - } - - $field = $this->getFieldConfiguration(); - if ($field['formatter'] == 'author') { - return [ - '#markup' => $user->getUsername(), - '#cache' => [ - 'tags' => $user->getCacheTags(), - ], - ]; - } - - if ($field['formatter'] == 'author_linked') { - return [ - '#theme' => 'username', - '#account' => $user, - '#cache' => [ - 'tags' => $user->getCacheTags(), - ], - ]; - } - - // Otherwise return an empty array. - return []; - } - - /** - * {@inheritdoc} - */ - public function formatters() { - - $formatters = [ - 'author' => $this->t('Author'), - 'author_linked' => $this->t('Author linked to profile'), - ]; - - return $formatters; - } - -} diff --git a/web/modules/ds/src/Plugin/DsField/Node/NodeChangedDate.php b/web/modules/ds/src/Plugin/DsField/Node/NodeChangedDate.php deleted file mode 100644 index 6c447d561a..0000000000 --- a/web/modules/ds/src/Plugin/DsField/Node/NodeChangedDate.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField\Node; - -use Drupal\ds\Plugin\DsField\Date; - -/** - * Plugin that renders the post date of a node. - * - * @DsField( - * id = "node_changed_date", - * title = @Translation("Last modified"), - * entity_type = "node", - * provider = "node" - * ) - */ -class NodeChangedDate extends Date { - - /** - * {@inheritdoc} - */ - public function getRenderKey() { - return 'changed'; - } - -} diff --git a/web/modules/ds/src/Plugin/DsField/Node/NodeLink.php b/web/modules/ds/src/Plugin/DsField/Node/NodeLink.php deleted file mode 100644 index b35d84ea2f..0000000000 --- a/web/modules/ds/src/Plugin/DsField/Node/NodeLink.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField\Node; - -use Drupal\ds\Plugin\DsField\Link; - -/** - * Plugin that renders the 'read more' link of a node. - * - * @DsField( - * id = "node_link", - * title = @Translation("Read more"), - * entity_type = "node", - * provider = "node" - * ) - */ -class NodeLink extends Link { - -} diff --git a/web/modules/ds/src/Plugin/DsField/Node/NodeLinks.php b/web/modules/ds/src/Plugin/DsField/Node/NodeLinks.php deleted file mode 100644 index fb27750eb0..0000000000 --- a/web/modules/ds/src/Plugin/DsField/Node/NodeLinks.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField\Node; - -use Drupal\ds\Plugin\DsField\DsFieldBase; - -/** - * Plugin that renders the links of the node entity. - * - * @DsField( - * id = "node_links", - * title = @Translation("Links"), - * entity_type = "node", - * provider = "node" - * ) - */ -class NodeLinks extends DsFieldBase { - -} diff --git a/web/modules/ds/src/Plugin/DsField/Node/NodePostDate.php b/web/modules/ds/src/Plugin/DsField/Node/NodePostDate.php deleted file mode 100644 index eab47d317d..0000000000 --- a/web/modules/ds/src/Plugin/DsField/Node/NodePostDate.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField\Node; - -use Drupal\ds\Plugin\DsField\Date; - -/** - * Plugin that renders the post date of a node. - * - * @DsField( - * id = "node_post_date", - * title = @Translation("Post date"), - * entity_type = "node", - * provider = "node" - * ) - */ -class NodePostDate extends Date { - - /** - * {@inheritdoc} - */ - public function getRenderKey() { - return 'created'; - } - -} diff --git a/web/modules/ds/src/Plugin/DsField/Node/NodeSubmittedBy.php b/web/modules/ds/src/Plugin/DsField/Node/NodeSubmittedBy.php deleted file mode 100644 index 0e4e14ebc1..0000000000 --- a/web/modules/ds/src/Plugin/DsField/Node/NodeSubmittedBy.php +++ /dev/null @@ -1,85 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField\Node; - -use Drupal\Core\Datetime\DateFormatterInterface; -use Drupal\Core\Url; -use Drupal\ds\Plugin\DsField\Date; -use Drupal\Core\Render\Renderer; -use Drupal\Core\Entity\EntityTypeManagerInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Plugin that renders the submitted by field. - * - * @DsField( - * id = "node_submitted_by", - * title = @Translation("Submitted by"), - * entity_type = "node", - * provider = "node" - * ) - */ -class NodeSubmittedBy extends Date { - - /** - * Drupal core Render service. - * - * @var \Drupal\Core\Render\Renderer - */ - protected $renderer; - - /** - * Constructs a Display Suite field plugin. - */ - public function __construct($configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, Renderer $renderer, DateFormatterInterface $date_service) { - $this->renderer = $renderer; - - parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_type_manager, $date_service); - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $container->get('entity_type.manager'), - $container->get('renderer'), - $container->get('date.formatter') - ); - } - - /** - * {@inheritdoc} - */ - public function build() { - $field = $this->getFieldConfiguration(); - - /* @var $node \Drupal\node\NodeInterface */ - $node = $this->entity(); - - /* @var $account \Drupal\user\UserInterface */ - $account = $node->getOwner(); - - $date_format = str_replace('ds_post_date_', '', $field['formatter']); - $user_name = [ - '#theme' => 'username', - '#account' => $account, - ]; - return [ - '#markup' => $this->t('Submitted by <a href=":user_link">@user</a> on @date.', - [ - '@user' => $this->renderer->render($user_name), - '@date' => $this->dateFormatter->format($this->entity()->created->value, $date_format), - ':user_link' => Url::fromUri('entity:user/' . $account->id())->toString(), - ] - ), - '#cache' => [ - 'tags' => $account->getCacheTags(), - ], - ]; - } - -} diff --git a/web/modules/ds/src/Plugin/DsField/Node/NodeTitle.php b/web/modules/ds/src/Plugin/DsField/Node/NodeTitle.php deleted file mode 100644 index a55633a938..0000000000 --- a/web/modules/ds/src/Plugin/DsField/Node/NodeTitle.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField\Node; - -use Drupal\ds\Plugin\DsField\Title; - -/** - * Plugin that renders the title of a node. - * - * @DsField( - * id = "node_title", - * title = @Translation("Title"), - * entity_type = "node", - * provider = "node" - * ) - */ -class NodeTitle extends Title { - - /** - * Constructs a Display Suite field plugin. - */ - public function __construct($configuration, $plugin_id, $plugin_definition) { - // Set the title, used to construct the field label, based on the label - // of the node type's title field. - if (!empty($configuration['entity'])) { - /* @var \Drupal\Core\Field\FieldDefinitionInterface $field */ - $field = $configuration['entity']->getFieldDefinition('title'); - $title = $field->getLabel(); - $configuration['field']['title'] = $title; - $plugin_definition['title'] = $title; - } - - parent::__construct($configuration, $plugin_id, $plugin_definition); - } - -} diff --git a/web/modules/ds/src/Plugin/DsField/Taxonomy/TaxonomyTermLink.php b/web/modules/ds/src/Plugin/DsField/Taxonomy/TaxonomyTermLink.php deleted file mode 100644 index a28bf0c44a..0000000000 --- a/web/modules/ds/src/Plugin/DsField/Taxonomy/TaxonomyTermLink.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField\Taxonomy; - -use Drupal\ds\Plugin\DsField\Link; - -/** - * Plugin that renders the the read more link on taxonomy. - * - * @DsField( - * id = "taxonomy_term_link", - * title = @Translation("Read more"), - * entity_type = "taxonomy_term", - * provider = "taxonomy" - * ) - */ -class TaxonomyTermLink extends Link { - -} diff --git a/web/modules/ds/src/Plugin/DsField/Taxonomy/TaxonomyTermTitle.php b/web/modules/ds/src/Plugin/DsField/Taxonomy/TaxonomyTermTitle.php deleted file mode 100644 index 98cdbc2bd0..0000000000 --- a/web/modules/ds/src/Plugin/DsField/Taxonomy/TaxonomyTermTitle.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField\Taxonomy; - -use Drupal\ds\Plugin\DsField\Title; - -/** - * Plugin that renders the title of a term. - * - * @DsField( - * id = "taxonomy_term_title", - * title = @Translation("Name"), - * entity_type = "taxonomy_term", - * provider = "taxonomy" - * ) - */ -class TaxonomyTermTitle extends Title { - - /** - * {@inheritdoc} - */ - public function entityRenderKey() { - return 'name'; - } - -} diff --git a/web/modules/ds/src/Plugin/DsField/ThemePluginBase.php b/web/modules/ds/src/Plugin/DsField/ThemePluginBase.php deleted file mode 100644 index 47c75d638c..0000000000 --- a/web/modules/ds/src/Plugin/DsField/ThemePluginBase.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField; - -/** - * The base plugin to create DS theme fields. - */ -abstract class ThemePluginBase extends DsFieldBase { - - /** - * {@inheritdoc} - */ - public function build() { - $field = $this->getConfiguration(); - $format = $this->formatter(); - - return [ - '#markup' => _theme($format, $field), - ]; - } - - /** - * Returns the formatter for the theming function. - */ - protected function formatter() { - return ''; - } - -} diff --git a/web/modules/ds/src/Plugin/DsField/Title.php b/web/modules/ds/src/Plugin/DsField/Title.php deleted file mode 100644 index 797947f7cd..0000000000 --- a/web/modules/ds/src/Plugin/DsField/Title.php +++ /dev/null @@ -1,83 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField; - -use Drupal\Core\Form\FormStateInterface; - -/** - * Plugin that renders a title. - */ -abstract class Title extends Field { - - /** - * {@inheritdoc} - */ - public function settingsForm($form, FormStateInterface $form_state) { - $config = $this->getConfiguration(); - - $settings['link'] = [ - '#type' => 'checkbox', - '#title' => 'Link', - '#default_value' => $config['link'], - ]; - $settings['wrapper'] = [ - '#type' => 'textfield', - '#title' => 'Wrapper', - '#default_value' => $config['wrapper'], - '#description' => $this->t('Eg: h1, h2, p'), - ]; - $settings['class'] = [ - '#type' => 'textfield', - '#title' => 'Class', - '#default_value' => $config['class'], - '#description' => $this->t('Put a class on the wrapper. Eg: block-title'), - ]; - - return $settings; - } - - /** - * {@inheritdoc} - */ - public function settingsSummary($settings) { - $config = $this->getConfiguration(); - - $summary = []; - if (!empty($config['link'])) { - $summary[] = 'Link: yes'; - } - else { - $summary[] = 'Link: no'; - } - - $summary[] = 'Wrapper: ' . $config['wrapper']; - - if (!empty($config['class'])) { - $summary[] = 'Class: ' . $config['class']; - } - - return $summary; - } - - /** - * {@inheritdoc} - */ - public function defaultConfiguration() { - - $configuration = [ - 'link' => 0, - 'wrapper' => 'h2', - 'class' => '', - ]; - - return $configuration; - } - - /** - * {@inheritdoc} - */ - protected function entityRenderKey() { - return 'title'; - } - -} diff --git a/web/modules/ds/src/Plugin/DsField/TokenBase.php b/web/modules/ds/src/Plugin/DsField/TokenBase.php deleted file mode 100644 index 160c1b9b07..0000000000 --- a/web/modules/ds/src/Plugin/DsField/TokenBase.php +++ /dev/null @@ -1,73 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField; - -use Drupal\Core\Utility\Token; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * The base plugin to create DS code fields. - */ -abstract class TokenBase extends DsFieldBase { - - /** - * The Token service. - * - * @var \Drupal\Core\Utility\Token - */ - protected $token; - - /** - * Constructs a Display Suite field plugin. - */ - public function __construct($configuration, $plugin_id, $plugin_definition, Token $token_service) { - $this->token = $token_service; - - parent::__construct($configuration, $plugin_id, $plugin_definition); - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $container->get('token') - ); - } - - /** - * {@inheritdoc} - */ - public function build() { - $content = $this->content(); - $format = $this->format(); - $value = $this->token->replace($content, [$this->getEntityTypeId() => $this->entity()], ['clear' => TRUE]); - - return [ - '#type' => 'processed_text', - '#text' => $value, - '#format' => $format, - '#filter_types_to_skip' => [], - '#langcode' => '', - ]; - } - - /** - * Returns the format of the code field. - */ - protected function format() { - return 'plain_text'; - } - - /** - * Returns the value of the code field. - */ - protected function content() { - return ''; - } - -} diff --git a/web/modules/ds/src/Plugin/DsField/User/User.php b/web/modules/ds/src/Plugin/DsField/User/User.php deleted file mode 100644 index f3add7f003..0000000000 --- a/web/modules/ds/src/Plugin/DsField/User/User.php +++ /dev/null @@ -1,78 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField\User; - -use Drupal\Core\Entity\EntityDisplayRepositoryInterface; -use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\ds\Plugin\DsField\Entity; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Plugin that renders a view mode. - * - * @DsField( - * id = "user", - * title = @Translation("User"), - * entity_type = "node", - * provider = "user" - * ) - */ -class User extends Entity { - - /** - * The entity manager. - * - * @var \Drupal\Core\Entity\EntityTypeManagerInterface - */ - protected $entityTypeManager; - - /** - * {@inheritdoc} - */ - public function __construct($configuration, $plugin_id, $plugin_definition, EntityDisplayRepositoryInterface $entity_display_repository, EntityTypeManagerInterface $entity_type_manager) { - $this->entityTypeManager = $entity_type_manager; - - parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_display_repository); - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $container->get('entity_display.repository'), - $container->get('entity_type.manager') - ); - } - - /** - * {@inheritdoc} - */ - public function build() { - $view_mode = $this->getEntityViewMode(); - - /* @var $node \Drupal\node\NodeInterface */ - $node = $this->entity(); - $uid = $node->getOwnerId(); - - $user = $this->entityTypeManager - ->getStorage('user') - ->load($uid); - $build = $this->entityTypeManager - ->getViewBuilder('user') - ->view($user, $view_mode); - - return $build; - } - - /** - * {@inheritdoc} - */ - public function linkedEntity() { - return 'user'; - } - -} diff --git a/web/modules/ds/src/Plugin/DsField/User/UserSignature.php b/web/modules/ds/src/Plugin/DsField/User/UserSignature.php deleted file mode 100644 index cf272ee117..0000000000 --- a/web/modules/ds/src/Plugin/DsField/User/UserSignature.php +++ /dev/null @@ -1,50 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField\User; - -use Drupal\ds\Plugin\DsField\Markup; - -/** - * Plugin that renders the user signature. - * - * @DsField( - * id = "user_signature", - * title = @Translation("User signature"), - * entity_type = "user", - * provider = "user" - * ) - */ -class UserSignature extends Markup { - - /** - * {@inheritdoc} - */ - public function key() { - return 'signature'; - } - - /** - * {@inheritdoc} - */ - public function format() { - return 'signature_format'; - } - - /** - * {@inheritdoc} - */ - public function isAllowed() { - // Checks if user signatures are enabled. - $user_signatures = \Drupal::config('user.settings')->get('signatures'); - - // We use this function to decide if we should show this field. - // When user signatures are disabled we should ignore this. - if (!empty($user_signatures)) { - return TRUE; - } - else { - return FALSE; - } - } - -} diff --git a/web/modules/ds/src/Plugin/DsField/User/Username.php b/web/modules/ds/src/Plugin/DsField/User/Username.php deleted file mode 100644 index b3515daf7e..0000000000 --- a/web/modules/ds/src/Plugin/DsField/User/Username.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsField\User; - -use Drupal\ds\Plugin\DsField\Title; - -/** - * Plugin that renders the username. - * - * @DsField( - * id = "username", - * title = @Translation("Username"), - * entity_type = "user", - * provider = "user" - * ) - */ -class Username extends Title { - - /** - * {@inheritdoc} - */ - public function entityRenderKey() { - return 'name'; - } - -} diff --git a/web/modules/ds/src/Plugin/DsFieldTemplate/DefaultField.php b/web/modules/ds/src/Plugin/DsFieldTemplate/DefaultField.php deleted file mode 100644 index afca842af1..0000000000 --- a/web/modules/ds/src/Plugin/DsFieldTemplate/DefaultField.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsFieldTemplate; - -/** - * Plugin for the default field template. - * - * @DsFieldTemplate( - * id = "default", - * title = @Translation("Default"), - * theme = "field" - * ) - */ -class DefaultField extends DsFieldTemplateBase { - -} diff --git a/web/modules/ds/src/Plugin/DsFieldTemplate/DsFieldTemplateBase.php b/web/modules/ds/src/Plugin/DsFieldTemplate/DsFieldTemplateBase.php deleted file mode 100644 index 84e4c0a47c..0000000000 --- a/web/modules/ds/src/Plugin/DsFieldTemplate/DsFieldTemplateBase.php +++ /dev/null @@ -1,132 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsFieldTemplate; - -use Drupal\Core\Plugin\PluginBase; -use Drupal\Core\Entity\EntityInterface; -use Drupal\ds\Ds; - -/** - * Base class for all the ds plugins. - */ -abstract class DsFieldTemplateBase extends PluginBase implements DsFieldTemplateInterface { - - /** - * The entity used for token replacement. - * - * @var \Drupal\Core\Entity\EntityInterface - */ - protected $entity = NULL; - - /** - * Constructs a Display Suite field plugin. - */ - public function __construct($configuration, $plugin_id, $plugin_definition) { - parent::__construct($configuration, $plugin_id, $plugin_definition); - $this->configuration += $this->defaultConfiguration(); - } - - /** - * {@inheritdoc} - */ - public function getEntity() { - return $this->entity; - } - - /** - * {@inheritdoc} - */ - public function setEntity(EntityInterface $entity) { - $this->entity = $entity; - } - - /** - * {@inheritdoc} - */ - public function alterForm(&$form) { - $config = $this->getConfiguration(); - - $form['lb'] = [ - '#type' => 'textfield', - '#title' => $this->t('Label'), - '#size' => '10', - '#default_value' => $config['lb'], - ]; - $form['lb-col'] = [ - '#type' => 'checkbox', - '#title' => $this->t('Show label colon'), - '#default_value' => $config['lb-col'], - '#attributes' => [ - 'class' => ['colon-checkbox'], - ], - ]; - $field_classes = Ds::getClasses('field'); - - if (!empty($field_classes)) { - $form['classes'] = [ - '#type' => 'select', - '#multiple' => TRUE, - '#options' => $field_classes, - '#title' => $this->t('Choose additional CSS classes for the field'), - '#default_value' => $config['classes'], - '#prefix' => '<div class="field-classes">', - '#suffix' => '</div>', - ]; - } - else { - $form['classes'] = [ - '#type' => 'value', - '#value' => [], - ]; - } - } - - /** - * {@inheritdoc} - */ - public function massageRenderValues(&$field_settings, $values) { - if (!empty($values['lb'])) { - $field_settings['lb'] = $values['lb']; - } - if (!(empty($values['lb-col']))) { - $field_settings['lb-col'] = TRUE; - } - if (isset($values['classes'])) { - $field_settings['classes'] = $values['classes']; - } - } - - /** - * {@inheritdoc} - */ - public function getThemeFunction() { - return $this->pluginDefinition['theme']; - } - - /** - * {@inheritdoc} - */ - public function defaultConfiguration() { - $config = []; - $config['lb'] = ''; - $config['lb-col'] = \Drupal::config('ds.settings')->get('ft-show-colon'); - $config['classes'] = []; - - return $config; - } - - /** - * {@inheritdoc} - */ - public function getConfiguration() { - return $this->configuration; - } - - /** - * {@inheritdoc} - */ - public function setConfiguration(array $configuration) { - $this->configuration = $configuration + $this->configuration; - } - -} diff --git a/web/modules/ds/src/Plugin/DsFieldTemplate/DsFieldTemplateInterface.php b/web/modules/ds/src/Plugin/DsFieldTemplate/DsFieldTemplateInterface.php deleted file mode 100644 index 7adaf3e9d7..0000000000 --- a/web/modules/ds/src/Plugin/DsFieldTemplate/DsFieldTemplateInterface.php +++ /dev/null @@ -1,78 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsFieldTemplate; - -use Drupal\Core\Entity\EntityInterface; - -/** - * Defines a common interface for all ds field template plugins. - */ -interface DsFieldTemplateInterface { - - /** - * Lets you add you add additional form element for your layout. - * - * @param array $form - * Nested array of form elements that comprise the form. - */ - public function alterForm(&$form); - - /** - * Gets the entity this layout belongs too. - * - * @return \Drupal\Core\Entity\EntityInterface - * The entity. - */ - public function getEntity(); - - /** - * Sets the entity this layout belong too. - * - * @param \Drupal\Core\Entity\EntityInterface $entity - * The entity. - */ - public function setEntity(EntityInterface $entity); - - /** - * Massages the values before they get rendered. - * - * @param array $field_settings - * The ds field settings. - * @param array $values - * The values. - */ - public function massageRenderValues(&$field_settings, $values); - - /** - * Gets the chosen theme function. - * - * @return string - * The theme function. - */ - public function getThemeFunction(); - - /** - * Creates default configuration for the layout. - * - * @return array - * Keyed array of default settings. - */ - public function defaultConfiguration(); - - /** - * Get the selected configuration. - * - * @return array - * Keyed array of configuration values. - */ - public function getConfiguration(); - - /** - * Set the configuration for this layout. - * - * @param array $configuration - * Keyed array of new configuration values. - */ - public function setConfiguration(array $configuration); - -} diff --git a/web/modules/ds/src/Plugin/DsFieldTemplate/Expert.php b/web/modules/ds/src/Plugin/DsFieldTemplate/Expert.php deleted file mode 100644 index a1e594c4d4..0000000000 --- a/web/modules/ds/src/Plugin/DsFieldTemplate/Expert.php +++ /dev/null @@ -1,261 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsFieldTemplate; - -/** - * Plugin for the expert field template. - * - * @DsFieldTemplate( - * id = "expert", - * title = @Translation("Expert"), - * theme = "ds_field_expert", - * ) - */ -class Expert extends DsFieldTemplateBase { - - /** - * {@inheritdoc} - */ - public function alterForm(&$form) { - $config = $this->getConfiguration(); - - // Add label. - $form['lb'] = [ - '#type' => 'textfield', - '#title' => $this->t('Label'), - '#size' => '10', - '#default_value' => $config['lb'], - ]; - - // Add prefix. - $form['prefix'] = [ - '#type' => 'textfield', - '#title' => $this->t('Prefix'), - '#size' => '100', - '#description' => $this->t('You can enter any html in here.'), - '#default_value' => isset($config['prefix']) ? $config['prefix'] : '', - '#prefix' => '<div class="field-prefix">', - '#suffix' => '</div>', - ]; - - $wrappers = [ - 'lbw' => ['title' => $this->t('Label wrapper')], - 'ow' => ['title' => $this->t('Outer wrapper')], - 'fis' => ['title' => $this->t('Field items')], - 'fi' => ['title' => $this->t('Field item')], - ]; - - foreach ($wrappers as $wrapper_key => $value) { - $form[$wrapper_key] = [ - '#type' => 'checkbox', - '#title' => $value['title'], - '#prefix' => '<div class="ft-group ' . $wrapper_key . '">', - '#default_value' => $config[$wrapper_key], - ]; - $form[$wrapper_key . '-el'] = [ - '#type' => 'textfield', - '#title' => $this->t('Element'), - '#size' => '10', - '#description' => $this->t('E.g. div, span, h2 etc.'), - '#default_value' => $config[$wrapper_key . '-el'], - '#states' => [ - 'visible' => [ - ':input[name$="[' . $wrapper_key . ']"]' => ['checked' => TRUE], - ], - ], - ]; - $form[$wrapper_key . '-cl'] = [ - '#type' => 'textfield', - '#title' => $this->t('Classes'), - '#size' => '10', - '#default_value' => $config[$wrapper_key . '-cl'], - '#description' => $this->t('E.g. field-expert'), - '#states' => [ - 'visible' => [ - ':input[name$="[' . $wrapper_key . ']"]' => ['checked' => TRUE], - ], - ], - ]; - $form[$wrapper_key . '-at'] = [ - '#type' => 'textfield', - '#title' => $this->t('Attributes'), - '#size' => '20', - '#default_value' => $config[$wrapper_key . '-at'], - '#description' => $this->t('E.g. name="anchor"'), - '#states' => [ - 'visible' => [ - ':input[name$="[' . $wrapper_key . ']"]' => ['checked' => TRUE], - ], - ], - ]; - - // Hide colon. - if ($wrapper_key == 'lbw') { - $form['lb-col'] = [ - '#type' => 'checkbox', - '#title' => $this->t('Show label colon'), - '#default_value' => $config['lb-col'], - '#attributes' => [ - 'class' => ['colon-checkbox'], - ], - '#states' => [ - 'visible' => [ - ':input[name$="[' . $wrapper_key . ']"]' => ['checked' => TRUE], - ], - ], - ]; - } - if ($wrapper_key != 'lbw') { - $form[$wrapper_key . '-def-at'] = [ - '#type' => 'checkbox', - '#title' => $this->t('Add default attributes'), - '#default_value' => $config[$wrapper_key . '-def-at'], - '#suffix' => ($wrapper_key == 'ow') ? '' : '</div><div class="clearfix"></div>', - '#states' => [ - 'visible' => [ - ':input[name$="[' . $wrapper_key . ']"]' => ['checked' => TRUE], - ], - ], - ]; - } - else { - $form['ft'][$wrapper_key . '-def-at'] = [ - '#markup' => '</div><div class="clearfix"></div>', - ]; - } - - // Default classes for outer wrapper. - if ($wrapper_key == 'ow') { - $form[$wrapper_key . '-def-cl'] = [ - '#type' => 'checkbox', - '#title' => $this->t('Add default classes'), - '#default_value' => $config[$wrapper_key . '-def-cl'], - '#suffix' => '</div><div class="clearfix"></div>', - '#states' => [ - 'visible' => [ - ':input[name$="[' . $wrapper_key . ']"]' => ['checked' => TRUE], - ], - ], - ]; - } - } - // Add suffix. - $form['suffix'] = [ - '#type' => 'textfield', - '#title' => $this->t('Suffix'), - '#size' => '100', - '#description' => $this->t('You can enter any html in here.'), - '#default_value' => isset($config['suffix']) ? $config['suffix'] : '', - '#prefix' => '<div class="field-suffix">', - '#suffix' => '</div>', - ]; - - // Token support. - if (\Drupal::moduleHandler()->moduleExists('token')) { - $form['tokens'] = [ - '#title' => $this->t('Tokens'), - '#type' => 'container', - '#states' => [ - 'invisible' => [ - 'input[name="use_token"]' => ['checked' => FALSE], - ], - ], - ]; - $form['tokens']['help'] = [ - '#theme' => 'token_tree_link', - '#token_types' => 'all', - '#global_types' => FALSE, - '#dialog' => TRUE, - ]; - } - } - - /** - * {@inheritdoc} - */ - public function defaultConfiguration() { - $config = []; - $config['lb'] = ''; - $config['lb-col'] = \Drupal::config('ds.settings')->get('ft-show-colon'); - - $wrappers = [ - 'lb' => ['title' => $this->t('Label')], - 'lbw' => ['title' => $this->t('Label wrapper')], - 'ow' => ['title' => $this->t('Outer wrapper')], - 'fis' => ['title' => $this->t('Field items')], - 'fi' => ['title' => $this->t('Field item')], - ]; - foreach ($wrappers as $wrapper_key => $value) { - $config[$wrapper_key] = FALSE; - $config[$wrapper_key . '-el'] = ''; - $config[$wrapper_key . '-at'] = ''; - $config[$wrapper_key . '-cl'] = ''; - - $config[$wrapper_key . '-def-at'] = FALSE; - $config[$wrapper_key . '-def-cl'] = FALSE; - } - - return $config; - } - - /** - * {@inheritdoc} - */ - public function massageRenderValues(&$field_settings, $values) { - if (!empty($values['lb'])) { - $field_settings['lb'] = $values['lb']; - } - if (!(empty($values['lb-col']))) { - $field_settings['lb-col'] = TRUE; - } - - $wrappers = [ - 'lbw' => $this->t('Label wrapper'), - 'ow' => $this->t('Wrapper'), - 'fis' => $this->t('Field items'), - 'fi' => $this->t('Field item'), - ]; - - foreach ($wrappers as $wrapper_key => $title) { - if (!empty($values[$wrapper_key])) { - // Enable. - $field_settings[$wrapper_key] = TRUE; - // Element. - $field_settings[$wrapper_key . '-el'] = !(empty($values[$wrapper_key . '-el'])) ? $values[$wrapper_key . '-el'] : 'div'; - // Classes. - $field_settings[$wrapper_key . '-cl'] = !(empty($values[$wrapper_key . '-cl'])) ? $values[$wrapper_key . '-cl'] : ''; - // Default Classes. - if (in_array($wrapper_key, ['ow', 'lb'])) { - $field_settings[$wrapper_key . '-def-cl'] = !(empty($values[$wrapper_key . '-def-cl'])) ? TRUE : FALSE; - } - // Attributes. - $field_settings[$wrapper_key . '-at'] = !(empty($values[$wrapper_key . '-at'])) ? $values[$wrapper_key . '-at'] : ''; - // Default attributes. - $field_settings[$wrapper_key . '-def-at'] = !(empty($values[$wrapper_key . '-def-at'])) ? TRUE : FALSE; - // Token replacement. - /* @var \Drupal\Core\Entity\EntityInterface $entity */ - if ($entity = $this->getEntity()) { - // Tokens. - $apply_to = [ - 'prefix', - $wrapper_key . '-el', - $wrapper_key . '-cl', - $wrapper_key . '-at', - 'suffix', - ]; - - foreach ($apply_to as $identifier) { - if (!empty($field_settings[$identifier])) { - $field_settings[$identifier] = \Drupal::token()->replace( - $field_settings[$identifier], - [$entity->getEntityTypeId() => $entity], - ['clear' => TRUE] - ); - } - } - } - } - } - } - -} diff --git a/web/modules/ds/src/Plugin/DsFieldTemplate/Minimal.php b/web/modules/ds/src/Plugin/DsFieldTemplate/Minimal.php deleted file mode 100644 index 4b812f4b84..0000000000 --- a/web/modules/ds/src/Plugin/DsFieldTemplate/Minimal.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsFieldTemplate; - -/** - * Plugin for the minimal field template. - * - * @DsFieldTemplate( - * id = "minimal", - * title = @Translation("Minimal"), - * theme = "ds_field_minimal", - * ) - */ -class Minimal extends DsFieldTemplateBase { - -} diff --git a/web/modules/ds/src/Plugin/DsFieldTemplate/Reset.php b/web/modules/ds/src/Plugin/DsFieldTemplate/Reset.php deleted file mode 100644 index 7899ed4769..0000000000 --- a/web/modules/ds/src/Plugin/DsFieldTemplate/Reset.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\DsFieldTemplate; - -/** - * Plugin for the reset field template. - * - * @DsFieldTemplate( - * id = "reset", - * title = @Translation("Full reset"), - * theme = "ds_field_reset", - * ) - */ -class Reset extends DsFieldTemplateBase { - - /** - * {@inheritdoc} - */ - public function alterForm(&$form) { - $config = $this->getConfiguration(); - - $form['lb'] = [ - '#type' => 'textfield', - '#title' => $this->t('Label'), - '#size' => '10', - '#default_value' => $config['lb'], - ]; - } - - /** - * {@inheritdoc} - */ - public function defaultConfiguration() { - $config = []; - $config['lb'] = ''; - - return $config; - } - - /** - * {@inheritdoc} - */ - public function massageRenderValues(&$field_settings, $values) { - if (!empty($values['lb'])) { - $field_settings['lb'] = $values['lb']; - } - } - -} diff --git a/web/modules/ds/src/Plugin/DsFieldTemplatePluginManager.php b/web/modules/ds/src/Plugin/DsFieldTemplatePluginManager.php deleted file mode 100644 index afd6daeb7e..0000000000 --- a/web/modules/ds/src/Plugin/DsFieldTemplatePluginManager.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin; - -use Drupal\Core\Cache\CacheBackendInterface; -use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Plugin\DefaultPluginManager; - -/** - * Plugin type manager for all ds field layout plugins. - */ -class DsFieldTemplatePluginManager extends DefaultPluginManager { - - /** - * Constructs a new \Drupal\ds\Plugin\Type\DsPluginManager object. - * - * @param \Traversable $namespaces - * An object that implements \Traversable which contains the root paths - * keyed by the corresponding namespace to look for plugin implementations. - * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend - * Cache backend instance to use. - * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler - * The module handler to invoke the alter hook with. - */ - public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) { - parent::__construct('Plugin/DsFieldTemplate', $namespaces, $module_handler, 'Drupal\ds\Plugin\DsFieldTemplate\DsFieldTemplateInterface', 'Drupal\ds\Annotation\DsFieldTemplate'); - - $this->alterInfo('ds_field_templates_info'); - $this->setCacheBackend($cache_backend, 'ds_field_templates_info'); - } - -} diff --git a/web/modules/ds/src/Plugin/DsLayout.php b/web/modules/ds/src/Plugin/DsLayout.php deleted file mode 100644 index ef9da0fba9..0000000000 --- a/web/modules/ds/src/Plugin/DsLayout.php +++ /dev/null @@ -1,218 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin; - -use Drupal\Component\Utility\Xss; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Layout\LayoutDefault; -use Drupal\Core\Plugin\PluginFormInterface; -use Drupal\Core\Url; -use Drupal\ds\Ds; - -/** - * Layout class for all Display Suite layouts. - */ -class DsLayout extends LayoutDefault implements PluginFormInterface { - - /** - * {@inheritdoc} - */ - public function defaultConfiguration() { - return parent::defaultConfiguration() + [ - 'wrappers' => [], - 'outer_wrapper' => 'div', - 'attributes' => '', - 'link_attribute' => '', - 'link_custom' => '', - 'classes' => [ - 'layout_class' => [], - ], - ]; - } - - /** - * {@inheritdoc} - */ - public function buildConfigurationForm(array $form, FormStateInterface $form_state) { - $configuration = $this->getConfiguration(); - $regions = $this->getPluginDefinition()->getRegions(); - - // Add wrappers. - $wrapper_options = [ - 'div' => 'Div', - 'span' => 'Span', - 'section' => 'Section', - 'article' => 'Article', - 'header' => 'Header', - 'footer' => 'Footer', - 'aside' => 'Aside', - 'figure' => 'Figure', - ]; - $form['region_wrapper'] = [ - '#group' => 'additional_settings', - '#type' => 'details', - '#title' => $this->t('Custom wrappers'), - '#description' => $this->t('Choose a wrapper. All Display Suite layouts support this option.'), - '#tree' => TRUE, - ]; - - foreach ($regions as $region_name => $region_definition) { - $form['region_wrapper'][$region_name] = [ - '#type' => 'select', - '#options' => $wrapper_options, - '#title' => $this->t('Wrapper for @region', ['@region' => $region_definition['label']]), - '#default_value' => !empty($configuration['wrappers'][$region_name]) ? $configuration['wrappers'][$region_name] : 'div', - ]; - } - - $form['region_wrapper']['outer_wrapper'] = [ - '#type' => 'select', - '#options' => $wrapper_options, - '#title' => $this->t('Outer wrapper'), - '#default_value' => $configuration['outer_wrapper'], - '#weight' => 10, - ]; - - $form['region_wrapper']['attributes'] = [ - '#type' => 'textfield', - '#title' => $this->t('Layout attributes'), - '#description' => 'E.g. role|navigation,data-something|some value', - '#default_value' => $configuration['attributes'], - '#weight' => 11, - ]; - - $form['region_wrapper']['link_attribute'] = [ - '#type' => 'select', - '#options' => [ - '' => $this->t('No link'), - 'content' => $this->t('Link to content'), - 'custom' => $this->t('Custom'), - 'tokens' => $this->t('Tokens'), - ], - '#title' => $this->t('Add link'), - '#description' => $this->t('This will add an onclick attribute on the layout wrapper.'), - '#default_value' => $configuration['link_attribute'], - '#weight' => 12, - ]; - - $form['region_wrapper']['link_custom'] = [ - '#type' => 'textfield', - '#title' => $this->t('Custom link'), - '#description' => $this->t('You may use tokens for this link if you selected tokens.'), - '#default_value' => $configuration['link_custom'], - '#weight' => 13, - '#states' => [ - 'visible' => [ - [ - ':input[name="layout_configuration[region_wrapper][link_attribute]"]' => [["value" => "tokens"], ["value" => "custom"]], - ], - ], - ], - ]; - - if (\Drupal::moduleHandler()->moduleExists('token')) { - $form['region_wrapper']['tokens'] = [ - '#title' => $this->t('Tokens'), - '#type' => 'container', - '#weight' => 14, - '#states' => [ - 'visible' => [ - ':input[name="layout_configuration[region_wrapper][link_attribute]"]' => ["value" => "tokens"], - ], - ], - ]; - $form['region_wrapper']['tokens']['help'] = [ - '#theme' => 'token_tree_link', - '#token_types' => 'all', - '#global_types' => FALSE, - '#dialog' => TRUE, - ]; - } - - // Add extra classes for the regions to have more control while theming. - $form['ds_classes'] = [ - '#group' => 'additional_settings', - '#type' => 'details', - '#title' => $this->t('Custom classes'), - '#tree' => TRUE, - '#collapsible' => TRUE, - '#collapsed' => TRUE, - ]; - - $classes_access = (\Drupal::currentUser()->hasPermission('admin_classes')); - $classes = Ds::getClasses(); - if (!empty($classes)) { - - $form['ds_classes']['layout_class'] = [ - '#type' => 'select', - '#multiple' => TRUE, - '#options' => $classes, - '#title' => $this->t('Class for layout'), - '#default_value' => !empty($configuration['classes']['layout_class']) ? $configuration['classes']['layout_class'] : [], - ]; - - foreach ($regions as $region_name => $region_definition) { - $form['ds_classes'][$region_name] = [ - '#type' => 'select', - '#multiple' => TRUE, - '#options' => $classes, - '#title' => $this->t('Class for @region', ['@region' => $region_definition['label']]), - '#default_value' => isset($configuration['classes'][$region_name]) ? $configuration['classes'][$region_name] : [], - ]; - } - if ($classes_access) { - $url = Url::fromRoute('ds.classes'); - $destination = \Drupal::destination()->getAsArray(); - $url->setOption('query', $destination); - $form['ds_classes']['info'] = ['#markup' => \Drupal::l(t('Manage region and field CSS classes'), $url)]; - } - } - else { - if ($classes_access) { - $url = Url::fromRoute('ds.classes'); - $destination = \Drupal::destination()->getAsArray(); - $url->setOption('query', $destination); - $form['ds_classes']['info'] = ['#markup' => '<p>' . $this->t('You have not defined any CSS classes which can be used on regions.') . '</p><p>' . \Drupal::l(t('Manage region and field CSS classes'), $url) . '</p>']; - } - else { - $form['ds_classes']['#access'] = FALSE; - } - } - - return $form; - } - - /** - * {@inheritdoc} - */ - public function submitConfigurationForm(array &$form, FormStateInterface $form_state) { - $this->configuration['wrappers'] = $form_state->getValue('region_wrapper'); - foreach (['outer_wrapper', 'attributes', 'link_attribute', 'link_custom'] as $name) { - $this->configuration[$name] = $this->configuration['wrappers'][$name]; - unset($this->configuration['wrappers'][$name]); - } - - // Apply Xss::filter to attributes. - $this->configuration['attributes'] = Xss::filter($this->configuration['attributes']); - - // In case classes is missing entirely, use the defaults. - $defaults = $this->defaultConfiguration(); - $this->configuration['classes'] = $form_state->getValue('ds_classes', $defaults['classes']); - - // Do not save empty classes. - foreach ($this->configuration['classes'] as $region_name => &$classes) { - foreach ($classes as $class) { - if (empty($class)) { - unset($classes[$class]); - } - } - } - } - - /** - * {@inheritdoc} - */ - public function validateConfigurationForm(array &$form, FormStateInterface $form_state) { - } - -} diff --git a/web/modules/ds/src/Plugin/DsPluginManager.php b/web/modules/ds/src/Plugin/DsPluginManager.php deleted file mode 100644 index 3f27b02fb4..0000000000 --- a/web/modules/ds/src/Plugin/DsPluginManager.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin; - -use Drupal\Core\Cache\CacheBackendInterface; -use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Plugin\DefaultPluginManager; - -/** - * Plugin type manager for all ds plugins. - */ -class DsPluginManager extends DefaultPluginManager { - - /** - * Constructs a new \Drupal\ds\Plugin\Type\DsPluginManager object. - * - * @param \Traversable $namespaces - * An object that implements \Traversable which contains the root paths - * keyed by the corresponding namespace to look for plugin implementations. - * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend - * Cache backend instance to use. - * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler - * The module handler to invoke the alter hook with. - */ - public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) { - parent::__construct('Plugin/DsField', $namespaces, $module_handler, 'Drupal\ds\Plugin\DsField\DsFieldInterface', 'Drupal\ds\Annotation\DsField'); - - $this->alterInfo('ds_fields_info'); - $this->setCacheBackend($cache_backend, 'ds_fields_info'); - } - -} diff --git a/web/modules/ds/src/Plugin/views/Entity/Render/ConfigurableLanguageRenderer.php b/web/modules/ds/src/Plugin/views/Entity/Render/ConfigurableLanguageRenderer.php deleted file mode 100644 index 9ab85adfb5..0000000000 --- a/web/modules/ds/src/Plugin/views/Entity/Render/ConfigurableLanguageRenderer.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\views\Entity\Render; - -use Drupal\Core\Entity\EntityTypeInterface; -use Drupal\Core\Language\LanguageManagerInterface; -use Drupal\views\ResultRow; -use Drupal\views\ViewExecutable; - -/** - * Renders entities in a configured language. - */ -class ConfigurableLanguageRenderer extends RendererBase { - - /** - * A specific language code for rendering if available. - * - * @var string|null - */ - protected $langcode; - - /** - * Constructs a renderer object. - * - * @param \Drupal\views\ViewExecutable $view - * The entity row being rendered. - * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager - * The language manager. - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type. - * @param string|null $langcode - * A specific language code to set, if available. - */ - public function __construct(ViewExecutable $view, LanguageManagerInterface $language_manager, EntityTypeInterface $entity_type, $langcode) { - parent::__construct($view, $language_manager, $entity_type); - $this->langcode = $langcode; - } - - /** - * {@inheritdoc} - */ - public function getLangcode(ResultRow $row) { - return $this->langcode; - } - -} diff --git a/web/modules/ds/src/Plugin/views/Entity/Render/CurrentLanguageRenderer.php b/web/modules/ds/src/Plugin/views/Entity/Render/CurrentLanguageRenderer.php deleted file mode 100644 index 9f31c7163a..0000000000 --- a/web/modules/ds/src/Plugin/views/Entity/Render/CurrentLanguageRenderer.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\views\Entity\Render; - -use Drupal\views\ResultRow; - -/** - * Renders entities in the current language. - */ -class CurrentLanguageRenderer extends RendererBase { - - /** - * Returns NULL so that the current language is used. - * - * @param \Drupal\views\ResultRow $row - * The result row. - */ - public function getLangcode(ResultRow $row) { - } - -} diff --git a/web/modules/ds/src/Plugin/views/Entity/Render/DefaultLanguageRenderer.php b/web/modules/ds/src/Plugin/views/Entity/Render/DefaultLanguageRenderer.php deleted file mode 100644 index e2999f421a..0000000000 --- a/web/modules/ds/src/Plugin/views/Entity/Render/DefaultLanguageRenderer.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\views\Entity\Render; - -use Drupal\views\ResultRow; - -/** - * Renders entities in the current language. - */ -class DefaultLanguageRenderer extends RendererBase { - - /** - * Returns the language code associated to the given row. - * - * @param \Drupal\views\ResultRow $row - * The result row. - * @param $relationship - * The relationship. - * - * @return string - * A language code. - */ - public function getLangcode(ResultRow $row, $relationship = NULL) { - return $row->_entity->getUntranslated()->language()->getId(); - } - -} diff --git a/web/modules/ds/src/Plugin/views/Entity/Render/RendererBase.php b/web/modules/ds/src/Plugin/views/Entity/Render/RendererBase.php deleted file mode 100644 index 371d6a41f3..0000000000 --- a/web/modules/ds/src/Plugin/views/Entity/Render/RendererBase.php +++ /dev/null @@ -1,174 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\views\Entity\Render; - -use Drupal\Component\Utility\Unicode; -use Drupal\views\Entity\Render\EntityTranslationRendererBase; - -/** - * Renders entities in the current language. - */ -abstract class RendererBase extends EntityTranslationRendererBase { - - /** - * {@inheritdoc} - */ - public function preRender(array $result) { - parent::preRender($result); - $this->dsPreRender($result); - } - - /** - * Pre renders all the Display Suite rows. - */ - protected function dsPreRender(array $result, $translation = FALSE) { - if ($result) { - // Get all entities which will be used to render in rows. - $view_builder = $this->view->rowPlugin->entityManager->getViewBuilder($this->entityType->id()); - - $i = 0; - $grouping = []; - $rendered = FALSE; - - foreach ($result as $row) { - $group_value_content = ''; - $entity = $row->_entity; - $entity->view = $this->view; - /* @var $entity \Drupal\Core\Entity\EntityInterface */ - $entity_id = $entity->id(); - $langcode = $this->getLangcode($row); - - // Default view mode. - $view_mode = $this->view->rowPlugin->options['view_mode']; - - // Display settings view mode. - if ($this->view->rowPlugin->options['switch_fieldset']['switch']) { - $switch = $entity->get('ds_switch')->value; - if (!empty($switch)) { - $view_mode = $switch; - } - } - - // Change the view mode per row. - if ($this->view->rowPlugin->options['alternating_fieldset']['alternating']) { - // Check for paging to determine the view mode. - $page = \Drupal::request()->get('page'); - if (!empty($page) && isset($this->view->rowPlugin->options['alternating_fieldset']['allpages']) && !$this->view->rowPlugin->options['alternating_fieldset']['allpages']) { - $view_mode = $this->view->rowPlugin->options['view_mode']; - } - else { - $view_mode = isset($this->view->rowPlugin->options['alternating_fieldset']['item_' . $i]) ? $this->view->rowPlugin->options['alternating_fieldset']['item_' . $i] : $this->view->rowPlugin->options['view_mode']; - } - $i++; - } - - // The advanced selector invokes hook_ds_views_row_render_entity. - if ($this->view->rowPlugin->options['advanced_fieldset']['advanced']) { - $modules = \Drupal::moduleHandler()->getImplementations('ds_views_row_render_entity'); - foreach ($modules as $module) { - if ($content = \Drupal::moduleHandler()->invoke($module, 'ds_views_row_render_entity', [$entity, $view_mode])) { - if (!$translation) { - $this->build[$entity_id] = $content; - } - else { - $this->build[$entity_id][$langcode] = $content; - } - $rendered = TRUE; - } - } - } - - // Give modules a chance to alter the $view_mode. Use $view_mode by ref. - $view_name = $this->view->storage->id(); - $context = [ - 'entity' => $entity, - 'view_name' => $view_name, - 'display' => $this->view->getDisplay(), - ]; - \Drupal::moduleHandler()->alter('ds_views_view_mode', $view_mode, $context); - - if (!$rendered) { - if (!$translation) { - if (!empty($view_mode)) { - $this->build[$entity_id] = $view_builder->view($entity, $view_mode, $langcode); - } - else { - $this->build[$entity_id] = $view_builder->view($entity, 'full', $langcode); - } - } - else { - if (!empty($view_mode)) { - $this->build[$entity_id][$langcode] = $view_builder->view($entity, $view_mode, $langcode); - } - else { - $this->build[$entity_id][$langcode] = $view_builder->view($entity, 'full', $langcode); - } - } - } - - $context = [ - 'row' => $row, - 'view' => &$this->view, - 'view_mode' => $view_mode, - ]; - \Drupal::moduleHandler()->alter('ds_views_row_render_entity', $this->build[$entity_id], $context); - - // Keep a static grouping for this view. - if ($this->view->rowPlugin->options['grouping_fieldset']['group']) { - - $group_field = $this->view->rowPlugin->options['grouping_fieldset']['group_field']; - - // New way of creating the alias. - if (strpos($group_field, '|') !== FALSE) { - list(, $ffield) = explode('|', $group_field); - $group_field = $this->view->sort[$ffield]->tableAlias . '_' . $this->view->sort[$ffield]->realField; - } - - // Note, the keys in the $row object are cut of at 60 chars. - // see views_plugin_query_default.inc. - if (Unicode::strlen($group_field) > 60) { - $group_field = Unicode::substr($group_field, 0, 60); - } - - $raw_group_value = isset($row->{$group_field}) ? $row->{$group_field} : ''; - $group_value = $raw_group_value; - - // Special function to format the heading value. - if (!empty($this->view->rowPlugin->options['grouping_fieldset']['group_field_function'])) { - $function = $this->view->rowPlugin->options['grouping_fieldset']['group_field_function']; - if (function_exists($function)) { - $group_value = $function($raw_group_value, $row->_entity); - } - } - - if (!isset($grouping[$group_value])) { - $group_value_content = [ - '#markup' => '<h2 class="grouping-title">' . $group_value . '</h2>', - '#weight' => -5, - ]; - $grouping[$group_value] = $group_value; - } - } - - // Grouping. - if (!empty($grouping)) { - if (!empty($group_value_content)) { - if (!$translation) { - $this->build[$entity_id] = [ - 'title' => $group_value_content, - 'content' => $this->build[$entity_id], - ]; - } - else { - $this->build[$entity_id][$langcode] = [ - 'title' => $group_value_content, - 'content' => $this->build[$entity_id][$langcode], - ]; - } - } - } - } - } - } - -} diff --git a/web/modules/ds/src/Plugin/views/Entity/Render/TranslationLanguageRenderer.php b/web/modules/ds/src/Plugin/views/Entity/Render/TranslationLanguageRenderer.php deleted file mode 100644 index 759032f15e..0000000000 --- a/web/modules/ds/src/Plugin/views/Entity/Render/TranslationLanguageRenderer.php +++ /dev/null @@ -1,65 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\views\Entity\Render; - -use Drupal\views\Plugin\views\query\QueryPluginBase; -use Drupal\views\ResultRow; - -/** - * Renders entities in the current language. - */ -class TranslationLanguageRenderer extends DefaultLanguageRenderer { - - /** - * Stores the field alias of the langcode column. - * - * @var string - */ - protected $langcodeAlias; - - /** - * {@inheritdoc} - */ - public function query(QueryPluginBase $query, $relationship = NULL) { - // There is no point in getting the language, in case the site is not - // multilingual. - if (!$this->languageManager->isMultilingual()) { - return; - } - // If the data table is defined, we use the translation language as render - // language, otherwise we fall back to the default entity language, which is - // stored in the revision table for revisionable entity types. - $langcode_key = $this->entityType->getKey('langcode'); - foreach (['data_table', 'revision_table', 'base_table'] as $key) { - if ($table = $this->entityType->get($key)) { - $table_alias = $query->ensureTable($table); - $this->langcodeAlias = $query->addField($table_alias, $langcode_key); - break; - } - } - } - - /** - * {@inheritdoc} - */ - public function preRender(array $result) { - parent::dsPreRender($result, TRUE); - } - - /** - * {@inheritdoc} - */ - public function render(ResultRow $row) { - $entity_id = $row->_entity->id(); - $langcode = $this->getLangcode($row); - return $this->build[$entity_id][$langcode]; - } - - /** - * {@inheritdoc} - */ - public function getLangcode(ResultRow $row) { - return isset($row->{$this->langcodeAlias}) ? $row->{$this->langcodeAlias} : $this->languageManager->getDefaultLanguage()->getId(); - } - -} diff --git a/web/modules/ds/src/Plugin/views/row/EntityRow.php b/web/modules/ds/src/Plugin/views/row/EntityRow.php deleted file mode 100644 index a44e502788..0000000000 --- a/web/modules/ds/src/Plugin/views/row/EntityRow.php +++ /dev/null @@ -1,217 +0,0 @@ -<?php - -namespace Drupal\ds\Plugin\views\row; - -use Drupal\Component\Utility\Html; -use Drupal\Component\Utility\Unicode; -use Drupal\Core\Form\FormStateInterface; -use Drupal\views\Plugin\views\PluginBase; -use Drupal\views\Plugin\views\row\EntityRow as ViewsEntityRow; - -/** - * Generic entity row plugin to provide a common base for all entity types. - * - * @ViewsRow( - * id = "ds_entity", - * deriver = "Drupal\ds\Plugin\Derivative\DsEntityRow" - * ) - */ -class EntityRow extends ViewsEntityRow { - - /** - * Contains an array of render arrays, one for each rendered entity. - * - * @var array - */ - protected $build = []; - - /** - * {@inheritdoc} - */ - protected function defineOptions() { - $options = parent::defineOptions(); - - $options['alternating_fieldset'] = [ - 'contains' => [ - 'alternating' => ['default' => FALSE, 'bool' => TRUE], - 'allpages' => ['default' => FALSE, 'bool' => TRUE], - 'item' => [ - 'default' => [], - ], - ], - ]; - $options['grouping_fieldset'] = [ - 'contains' => [ - 'group' => ['default' => FALSE, 'bool' => TRUE], - 'group_field' => ['default' => ''], - 'group_field_function' => ['default' => ''], - ], - ]; - $options['advanced_fieldset'] = [ - 'contains' => [ - 'advanced' => ['default' => FALSE, 'bool' => TRUE], - ], - ]; - $options['switch_fieldset'] = [ - 'contains' => [ - 'switch' => ['default' => FALSE, 'bool' => TRUE], - ], - ]; - return $options; - } - - /** - * {@inheritdoc} - */ - public function buildOptionsForm(&$form, FormStateInterface $form_state) { - parent::buildOptionsForm($form, $form_state); - - // Use view mode of display settings. - if ($this->entityType == 'node' && \Drupal::moduleHandler()->moduleExists('ds_switch_view_mode')) { - $form['switch_fieldset'] = [ - '#type' => 'details', - '#title' => $this->t('Use view mode of display settings'), - '#open' => $this->options['switch_fieldset']['switch'], - ]; - $form['switch_fieldset']['switch'] = [ - '#type' => 'checkbox', - '#title' => $this->t('Use view mode of display settings'), - '#default_value' => $this->options['switch_fieldset']['switch'], - '#description' => $this->t('Use the alternative view mode selected in the display settings tab.'), - ]; - } - - // Alternating view modes. - $form['alternating_fieldset'] = [ - '#type' => 'details', - '#title' => $this->t('Alternating view mode'), - '#open' => $this->options['alternating_fieldset']['alternating'], - ]; - $form['alternating_fieldset']['alternating'] = [ - '#type' => 'checkbox', - '#title' => $this->t('Use the changing view mode selector'), - '#default_value' => $this->options['alternating_fieldset']['alternating'], - ]; - $form['alternating_fieldset']['allpages'] = [ - '#type' => 'checkbox', - '#title' => $this->t('Use this configuration on every page. Otherwhise the default view mode is used as soon you browse away from the first page of this view.'), - '#default_value' => (isset($this->options['alternating_fieldset']['allpages'])) ? $this->options['alternating_fieldset']['allpages'] : FALSE, - ]; - - $pager = $this->view->display_handler->getPlugin('pager'); - $limit = $pager->getItemsPerPage(); - if ($limit == 0 || $limit > 20) { - $form['alternating_fieldset']['disabled'] = [ - '#markup' => $this->t('This option is disabled because you have unlimited items or listing more than 20 items.'), - ]; - $form['alternating_fieldset']['alternating']['#disabled'] = TRUE; - $form['alternating_fieldset']['allpages']['#disabled'] = TRUE; - } - else { - $i = 1; - $a = 0; - while ($limit != 0) { - $form['alternating_fieldset']['item_' . $a] = [ - '#title' => $this->t('Item @nr', ['@nr' => $i]), - '#type' => 'select', - '#default_value' => (isset($this->options['alternating_fieldset']['item_' . $a])) ? $this->options['alternating_fieldset']['item_' . $a] : 'teaser', - '#options' => \Drupal::service('entity_display.repository')->getViewModeOptions($this->entityTypeId), - '#states' => [ - 'visible' => [ - ':input[name="row_options[alternating_fieldset][alternating]"]' => ['checked' => TRUE], - ], - ], - ]; - $limit--; - $a++; - $i++; - } - } - - // Grouping rows. - $sorts = $this->view->display_handler->getOption('sorts'); - $groupable = !empty($sorts) && $this->options['grouping_fieldset']['group']; - - $form['grouping_fieldset'] = [ - '#type' => 'details', - '#title' => $this->t('Group data'), - '#open' => $groupable, - ]; - $form['grouping_fieldset']['group'] = [ - '#type' => 'checkbox', - '#title' => $this->t('Group data on a field. The value of this field will be displayed too.'), - '#default_value' => $groupable, - ]; - - if (!empty($sorts)) { - $sort_options = []; - foreach ($sorts as $sort) { - $sort_name = Unicode::ucfirst($sort['field']); - $sort_options[$sort['table'] . '|' . $sort['field']] = $sort_name; - } - - $form['grouping_fieldset']['group_field'] = [ - '#type' => 'select', - '#options' => $sort_options, - '#default_value' => isset($this->options['grouping_fieldset']['group_field']) ? $this->options['grouping_fieldset']['group_field'] : '', - ]; - $form['grouping_fieldset']['group_field_function'] = [ - '#type' => 'textfield', - '#title' => 'Heading function', - '#description' => Html::escape(t('The value of the field can be in a very raw format (eg, date created). Enter a custom function which you can use to format that value. The value and the object will be passed into that function eg. custom_function($raw_value, $object);')), - '#default_value' => isset($this->options['grouping_fieldset']['group_field_function']) ? $this->options['grouping_fieldset']['group_field_function'] : '', - ]; - } - else { - $form['grouping_fieldset']['group']['#disabled'] = TRUE; - $form['grouping_fieldset']['group']['#description'] = $this->t('Grouping is disabled because you do not have any sort fields.'); - } - - // Advanced function. - $form['advanced_fieldset'] = [ - '#type' => 'details', - '#title' => $this->t('Advanced view mode'), - '#open' => $this->options['advanced_fieldset']['advanced'], - ]; - $form['advanced_fieldset']['advanced'] = [ - '#type' => 'checkbox', - '#title' => $this->t('Use the advanced view mode selector'), - '#description' => $this->t('This gives you the opportunity to have full control of a list for really advanced features.<br /> There is no UI for this, you need to create a hook named like this: hook_ds_views_row_render_entity($entity, $view_mode).', ['@VIEWSNAME' => $this->view->storage->id()]), - '#default_value' => $this->options['advanced_fieldset']['advanced'], - ]; - } - - /** - * {@inheritdoc} - */ - protected function getEntityTranslationRenderer() { - if (!isset($this->entityLanguageRenderer)) { - $view = $this->getView(); - $rendering_language = $view->display_handler->getOption('rendering_language'); - $langcode = NULL; - $dynamic_renderers = [ - '***LANGUAGE_entity_translation***' => 'TranslationLanguageRenderer', - '***LANGUAGE_entity_default***' => 'DefaultLanguageRenderer', - ]; - if (isset($dynamic_renderers[$rendering_language])) { - // Dynamic language set based on result rows or instance defaults. - $renderer = $dynamic_renderers[$rendering_language]; - } - else { - if (strpos($rendering_language, '***LANGUAGE_') !== FALSE) { - $langcode = PluginBase::queryLanguageSubstitutions()[$rendering_language]; - } - else { - // Specific langcode set. - $langcode = $rendering_language; - } - $renderer = 'ConfigurableLanguageRenderer'; - } - $class = '\Drupal\ds\Plugin\views\Entity\Render\\' . $renderer; - $entity_type = \Drupal::service('entity_type.manager')->getDefinition($this->getEntityTypeId()); - $this->entityLanguageRenderer = new $class($view, $this->getLanguageManager(), $entity_type, $langcode); - } - return $this->entityLanguageRenderer; - } - -} diff --git a/web/modules/ds/src/Routing/RouteSubscriber.php b/web/modules/ds/src/Routing/RouteSubscriber.php deleted file mode 100644 index 78b5d2a01c..0000000000 --- a/web/modules/ds/src/Routing/RouteSubscriber.php +++ /dev/null @@ -1,78 +0,0 @@ -<?php - -namespace Drupal\ds\Routing; - -use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\Routing\RouteSubscriberBase; -use Drupal\Core\Routing\RoutingEvents; -use Symfony\Component\Routing\Route; -use Symfony\Component\Routing\RouteCollection; - -/** - * Subscriber for Devel routes. - */ -class RouteSubscriber extends RouteSubscriberBase { - - /** - * The entity manager service. - * - * @var \Drupal\Core\Entity\EntityTypeManagerInterface - */ - protected $entityTypeManager; - - /** - * Constructs a new RouteSubscriber object. - * - * @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager - * The entity type manager. - */ - public function __construct(EntityTypeManagerInterface $entity_type_manager) { - $this->entityTypeManager = $entity_type_manager; - } - - /** - * {@inheritdoc} - */ - protected function alterRoutes(RouteCollection $collection) { - foreach ($this->entityTypeManager->getDefinitions() as $entity_type_id => $entity_type) { - $base_table = $entity_type->getBaseTable(); - if ($entity_type->get('field_ui_base_route') && !empty($base_table)) { - - if ($display = $entity_type->getLinkTemplate('display')) { - $route = new Route( - $display, - [ - '_controller' => '\Drupal\ds\Controller\DsController::contextualTab', - '_title' => 'Manage display', - 'entity_type_id' => $entity_type_id, - ], - [ - '_field_ui_view_mode_access' => 'administer ' . $entity_type_id . ' display', - ], - [ - '_admin_route' => TRUE, - '_ds_entity_type_id' => $entity_type_id, - 'parameters' => [ - $entity_type_id => [ - 'type' => 'entity:' . $entity_type_id, - ], - ], - ] - ); - - $collection->add("entity.$entity_type_id.display", $route); - } - } - } - } - - /** - * {@inheritdoc} - */ - public static function getSubscribedEvents() { - $events = parent::getSubscribedEvents(); - $events[RoutingEvents::ALTER] = ['onAlterRoutes', 100]; - return $events; - } - -} diff --git a/web/modules/ds/src/Tests/BlockFieldPluginTest.php b/web/modules/ds/src/Tests/BlockFieldPluginTest.php deleted file mode 100644 index 06a208fc43..0000000000 --- a/web/modules/ds/src/Tests/BlockFieldPluginTest.php +++ /dev/null @@ -1,169 +0,0 @@ -<?php - -namespace Drupal\ds\Tests; - -use Drupal\views\Tests\ViewTestData; -use Drupal\views\ViewExecutable; -use Drupal\Component\Utility\Unicode; -use Drupal\ds_test\Plugin\Block\DsTestBlock; - -/** - * Tests for managing custom code, and block fields. - * - * @group ds - */ -class BlockFieldPluginTest extends FastTestBase { - - /** - * Modules to install. - * - * @var array - */ - public static $modules = array( - 'node', - 'block', - 'ds', - 'ds_test', - 'layout_plugin', - 'views', - ); - - /** - * Views used by this test. - * - * @var array - * The list of views. - */ - public static $testViews = array('ds-testing'); - - /** - * {@inheritdoc} - */ - protected function setUp() { - parent::setUp(); - - // Ensure that the plugin definitions are cleared. - foreach (ViewExecutable::getPluginTypes() as $plugin_type) { - $this->container->get("plugin.manager.views.$plugin_type")->clearCachedDefinitions(); - } - - ViewTestData::createTestViews(get_class($this), array('ds_test')); - } - - /** - * Test block title override. - */ - public function testBlockFieldTitleOverride() { - // Block fields. - $edit = array( - 'name' => 'Test block title field', - 'id' => 'test_block_title_field', - 'entities[node]' => '1', - 'block' => 'views_block:ds_testing-block_1', - ); - - $this->dsCreateBlockField($edit); - - $this->dsSelectLayout(); - - // Assert it's found on the Field UI for article. - $this->drupalGet('admin/structure/types/manage/article/display'); - $this->assertRaw('fields[dynamic_block_field:node-test_block_title_field][weight]', t('Test block field found on node article.')); - - $fields = array( - 'fields[dynamic_block_field:node-test_block_title_field][region]' => 'left', - 'fields[dynamic_block_field:node-test_block_title_field][label]' => 'above', - 'fields[body][region]' => 'right', - ); - - $this->dsSelectLayout(); - $this->dsConfigureUi($fields); - - // Create a node. - $settings = array('type' => 'article', 'promote' => 1); - $node = $this->drupalCreateNode($settings); - - // Look at node and verify the block title is overridden. - $this->drupalGet('node/' . $node->id()); - $this->assertRaw('Test block title field', t('Default field label.')); - - // Update testing label. - $edit = array( - 'use_block_title' => '1', - ); - $this->drupalPostForm('admin/structure/ds/fields/manage_block/test_block_title_field', $edit, t('Save')); - $this->assertText(t('The field Test block title field has been saved'), t('Test field label override updated')); - - // Look at node and verify the block title is overridden. - $this->drupalGet('node/' . $node->id()); - $this->assertRaw('Block title from view', t('Field label from view block display.')); - } - - /** - * Ensure block is not rendered if block disallows access. - */ - public function testBlockAccess() { - $block_field_id = Unicode::strtolower($this->randomMachineName()); - $entity_type = 'node'; - - $edit = [ - 'name' => $this->randomString(), - 'id' => $block_field_id, - 'entities[' . $entity_type . ']' => TRUE, - 'block' => 'ds_test_block', - ]; - $this->dsCreateBlockField($edit); - - $fields['fields[dynamic_block_field:' . $entity_type . '-' . $block_field_id . '][region]'] = 'left'; - $this->dsSelectLayout(); - $this->dsConfigureUI($fields); - - $settings['type'] = 'article'; - $node = $this->drupalCreateNode($settings); - - // Check block is not visible. - \Drupal::state()->set('ds_test_block__access', FALSE); - $this->drupalGet($node->toUrl()); - $this->assertNoRaw(DsTestBlock::BODY_TEXT); - - // Reset page cache. - $this->resetAll(); - - // Check block is visible. - \Drupal::state()->set('ds_test_block__access', TRUE); - $this->drupalGet($node->toUrl()); - $this->assertRaw(DsTestBlock::BODY_TEXT); - } - - /** - * Cache contexts, tags and max-age on the block should get merged into the field build array - */ - public function testBlockCache() { - $block_field_id = Unicode::strtolower($this->randomMachineName()); - $entity_type = 'node'; - - $edit = [ - 'name' => $this->randomString(), - 'id' => $block_field_id, - 'entities[' . $entity_type . ']' => TRUE, - 'block' => 'ds_cache_test_block', - ]; - $this->dsCreateBlockField($edit); - - $fields['fields[dynamic_block_field:' . $entity_type . '-' . $block_field_id . '][region]'] = 'left'; - $this->dsSelectLayout(); - $this->dsConfigureUI($fields); - - $settings['type'] = 'article'; - $node = $this->drupalCreateNode($settings); - - // Check for query parameters - $this->drupalGet($node->toUrl(), ['query' => ['cached' => 1]]); - $this->assertRaw('cached=1'); - - // Check for query parameters - $this->drupalGet($node->toUrl(), ['query' => ['cached' => 2]]); - $this->assertRaw('cached=2'); - } - -} diff --git a/web/modules/ds/src/Tests/BlockTest.php b/web/modules/ds/src/Tests/BlockTest.php deleted file mode 100644 index cb62201963..0000000000 --- a/web/modules/ds/src/Tests/BlockTest.php +++ /dev/null @@ -1,106 +0,0 @@ -<?php - -namespace Drupal\ds\Tests; - -use Drupal\block_content\Entity\BlockContent; - -/** - * Tests for the manage display tab in Display Suite. - * - * @group ds - */ -class BlockTest extends FastTestBase { - - use DsTestTrait; - - /** - * Modules to install. - * - * @var array - */ - public static $modules = array( - 'node', - 'user', - 'comment', - 'field_ui', - 'block', - 'block_content', - 'ds', - 'layout_plugin', - ); - - /** - * The created user. - * - * @var User - */ - protected $adminUser; - - /** - * {@inheritdoc} - */ - protected function setUp() { - parent::setUp(); - - // Create a test user. - $this->adminUser = $this->drupalCreateUser(array( - 'access content', - 'admin display suite', - 'admin fields', - 'administer blocks', - 'administer block_content display', - )); - $this->drupalLogin($this->adminUser); - } - - /** - * Test adding a block, modifying output. - */ - public function testBlock() { - - // Create basic block type. - $edit = array( - 'label' => 'Basic Block', - 'id' => 'basic', - ); - $this->drupalPostForm('admin/structure/block/block-content/types/add', $edit, t('Save'), array()); - $this->assertText('Custom block type Basic Block has been added.', 'Basic block type added'); - - // Create a basic block. - $edit = array(); - $edit['info[0][value]'] = 'Test Block'; - $edit['body[0][value]'] = $this->randomMachineName(16); - $this->drupalPostForm('block/add/basic', $edit, t('Save'), array()); - $this->assertText('Basic Block Test Block has been created.', 'Basic Block Test Block created'); - - // Place the block. - $instance = array( - 'id' => 'testblock', - 'settings[label]' => $edit['info[0][value]'], - 'region' => 'sidebar_first', - ); - $block = BlockContent::load(1); - $url = 'admin/structure/block/add/block_content:' . $block->uuid() . '/' . $this->config('system.theme')->get('default'); - $this->drupalPostForm($url, $instance, t('Save block')); - - // Change to a DS layout. - $url = 'admin/structure/block/block-content/manage/basic/display'; - $edit = array('layout' => 'ds_2col'); - $this->drupalPostForm($url, $edit, t('Save'), array()); - - $fields = array( - 'fields[block_description][region]' => 'left', - 'fields[body][region]' => 'right', - ); - $this->dsConfigureUi($fields, 'admin/structure/block/block-content/manage/basic/display'); - - // View the block. - $this->drupalGet('<front>'); - $this->assertText('Test Block', 'Test block found'); - $xpath = $this->xpath('//div[@class="region region-sidebar-first"]/div/div[@class="block-content block-content--type-basic block-content--view-mode-full ds-2col clearfix"]/div[@class="group-left"]/div[@class="field field--name-block-description field--type-ds field--label-hidden field__item"]/h2'); - $this->assertEqual(count($xpath), 1, 'Description in group-left'); - $xpath = $this->xpath('//div[@class="region region-sidebar-first"]/div/div[@class="block-content block-content--type-basic block-content--view-mode-full ds-2col clearfix"]/div[@class="group-right"]/div[@class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"]/p'); - $this->assertEqual(count($xpath), 1, 'Body in group-right'); - } - -} diff --git a/web/modules/ds/src/Tests/CacheTagsTest.php b/web/modules/ds/src/Tests/CacheTagsTest.php deleted file mode 100644 index 955a8393ea..0000000000 --- a/web/modules/ds/src/Tests/CacheTagsTest.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php - -namespace Drupal\ds\Tests; - -/** - * Tests for cache tags associated with an entity. - * - * @group ds - */ -class CacheTagsTest extends FastTestBase { - - /** - * Tests setting the correct cache tags. - */ - public function testUserCacheTags() { - // Create a node. - $settings = array('type' => 'article', 'promote' => 1); - $node = $this->drupalCreateNode($settings); - - // Create field CSS classes. - $edit = array('fields' => "test_field_class\ntest_field_class_2|Field class 2"); - $this->drupalPostForm('admin/structure/ds/classes', $edit, t('Save configuration')); - - // Create a token field. - $token_field = array( - 'name' => 'Token field', - 'id' => 'token_field', - 'entities[node]' => '1', - 'content[value]' => '[node:title]', - ); - $this->dsCreateTokenField($token_field); - - // Select layout. - $this->dsSelectLayout(); - - // Configure fields. - $fields = array( - 'fields[dynamic_token_field:node-token_field][region]' => 'header', - 'fields[body][region]' => 'right', - 'fields[node_link][region]' => 'footer', - 'fields[body][label]' => 'above', - 'fields[node_submitted_by][region]' => 'header', - ); - $this->dsConfigureUi($fields); - - $this->drupalGet('node/' . $node->id()); - $headers = $this->drupalGetHeader('X-Drupal-Cache-Tags'); - $this->assertTrue( - strpos($headers, 'user:' . $node->getRevisionAuthor()->getOriginalId()), - 'User cache tag found' - ); - } - -} diff --git a/web/modules/ds/src/Tests/CommentTest.php b/web/modules/ds/src/Tests/CommentTest.php deleted file mode 100644 index 50569de01d..0000000000 --- a/web/modules/ds/src/Tests/CommentTest.php +++ /dev/null @@ -1,156 +0,0 @@ -<?php - -namespace Drupal\ds\Tests; - -use Drupal\comment\Tests\CommentTestBase; - -/** - * Tests for the manage display tab in Display Suite. - * - * @group ds - */ -class CommentTest extends CommentTestBase { - - use DsTestTrait; - - /** - * Modules to install. - * - * @var array - */ - public static $modules = [ - 'node', - 'user', - 'comment', - 'field_ui', - 'block', - 'ds', - ]; - - /** - * The created user. - * - * @var User - */ - protected $adminUser; - - /** - * {@inheritdoc} - */ - protected function setUp() { - parent::setUp(); - - // Create a test user. - $this->adminUser = $this->drupalCreateUser([ - 'access content', - 'admin classes', - 'admin display suite', - 'admin fields', - 'administer nodes', - 'view all revisions', - 'administer content types', - 'administer node fields', - 'administer node form display', - 'administer node display', - 'administer users', - 'administer permissions', - 'administer account settings', - 'administer user display', - 'administer software updates', - 'access site in maintenance mode', - 'administer site configuration', - 'bypass node access', - 'administer comments', - 'administer comment types', - 'administer comment fields', - 'administer comment display', - 'skip comment approval', - 'post comments', - 'access comments', - // Usernames aren't shown in comment edit form autocomplete unless this - // permission is granted. - 'access user profiles', - ]); - $this->drupalLogin($this->adminUser); - } - - /** - * Test adding comments to a node. - */ - public function testComments() { - // Create a node. - $settings = ['type' => 'article', 'promote' => 1]; - $node = $this->drupalCreateNode($settings); - - $this->dsSelectLayout([], [], 'admin/structure/comment/manage/comment/display'); - - $fields = [ - 'fields[comment_title][region]' => 'left', - 'fields[comment_body][region]' => 'left', - ]; - $this->dsConfigureUi($fields, 'admin/structure/comment/manage/comment/display'); - - // Post comment. - $comment1 = $this->postComment($node, $this->randomMachineName(), $this->randomMachineName()); - $this->assertRaw($comment1->comment_body->value, 'Comment1 found.'); - - // Post comment. - $comment2 = $this->postComment($node, $this->randomMachineName(), $this->randomMachineName()); - $this->assertRaw($comment2->comment_body->value, 'Comment2 found.'); - - // Verify there are no double ID's. - $xpath = $this->xpath('//a[@id="comment-1"]'); - $this->assertEqual(count($xpath), 1, '1 ID found named comment-1'); - - // Test that hidden fields aren't exposed in the config. - $this->dsSelectLayout(); - - $fields = [ - 'fields[comment][region]' => 'hidden', - ]; - $this->dsConfigureUi($fields); - - $display = entity_get_display('node', 'article', 'default'); - $content = $display->get('content'); - $hidden = $display->get('hidden'); - - $this->assertFalse(isset($content['comment']), 'Comment is not part of the content region'); - $this->assertTrue(isset($hidden['comment']), 'Comment is part of the hidden region'); - } - - /** - * Test User custom display on a comment on a node. - */ - public function testCommentUser() { - // Create a node. - $settings = ['type' => 'article', 'promote' => 1]; - $node = $this->drupalCreateNode($settings); - - // User compact display settings. - $this->dsSelectLayout([], [], 'admin/config/people/accounts/display'); - - $fields = [ - 'fields[username][region]' => 'left', - 'fields[member_for][region]' => 'left', - ]; - $this->dsConfigureUi($fields, 'admin/config/people/accounts/display'); - - // Comment display settings. - $this->dsSelectLayout([], [], 'admin/structure/comment/manage/comment/display'); - - $fields = [ - 'fields[comment_title][region]' => 'left', - 'fields[comment_user][region]' => 'left', - 'fields[comment_body][region]' => 'left', - ]; - $this->dsConfigureUi($fields, 'admin/structure/comment/manage/comment/display'); - - // Post comment. - $comment = $this->postComment($node, $this->randomMachineName(), $this->randomMachineName()); - $this->assertRaw($comment->comment_body->value, 'Comment found.'); - $this->assertRaw('Member for', 'Comment Member for found.'); - $xpath = $this->xpath('//div[@class="field field--name-comment-user field--type-ds field--label-hidden field__item"]/div/div/div[@class="field field--name-username field--type-ds field--label-hidden field__item"]'); - $this->assertEqual(count($xpath), 1, 'Username'); - } - -} diff --git a/web/modules/ds/src/Tests/DsTestTrait.php b/web/modules/ds/src/Tests/DsTestTrait.php deleted file mode 100644 index 8a988d75e5..0000000000 --- a/web/modules/ds/src/Tests/DsTestTrait.php +++ /dev/null @@ -1,227 +0,0 @@ -<?php - -namespace Drupal\ds\Tests; - -/** - * Provides common functionality for the Display Suite test classes. - */ -trait DsTestTrait { - - /** - * Select a layout. - */ - public function dsSelectLayout($edit = [], $assert = [], $url = 'admin/structure/types/manage/article/display', $options = []) { - $edit += [ - 'layout' => 'ds_2col_stacked', - ]; - - $this->drupalPostForm($url, $edit, t('Save'), $options); - - $assert += [ - 'regions' => [ - 'header' => '<td colspan="8">' . t('Header') . '</td>', - 'left' => '<td colspan="8">' . t('Left') . '</td>', - 'right' => '<td colspan="8">' . t('Right') . '</td>', - 'footer' => '<td colspan="8">' . t('Footer') . '</td>', - ], - ]; - - foreach ($assert['regions'] as $region => $raw) { - $this->assertRaw($region, t('Region @region found', ['@region' => $region])); - } - } - - /** - * Configure classes. - */ - public function dsConfigureClasses($edit = []) { - - $edit += [ - 'regions' => "class_name_1\nclass_name_2|Friendly name", - ]; - - $this->drupalPostForm('admin/structure/ds/classes', $edit, t('Save configuration')); - $this->assertText(t('The configuration options have been saved.'), t('CSS classes configuration saved')); - $this->assertRaw('class_name_1', 'Class name 1 found'); - $this->assertRaw('class_name_2', 'Class name 1 found'); - } - - /** - * Configure classes on a layout. - */ - public function dsSelectClasses($edit = [], $url = 'admin/structure/types/manage/article/display') { - - $edit += [ - "layout_configuration[ds_classes][header][]" => 'class_name_1', - "layout_configuration[ds_classes][footer][]" => 'class_name_2', - ]; - - $this->drupalPostForm($url, $edit, t('Save')); - } - - /** - * Configure Field UI. - */ - public function dsConfigureUi($edit, $url = 'admin/structure/types/manage/article/display') { - $this->drupalPostForm($url, $edit, t('Save')); - } - - /** - * Edit field formatter settings. - */ - public function dsEditFormatterSettings($edit, $field_name = 'body', $url = 'admin/structure/types/manage/article/display') { - $element_value = 'edit ' . $field_name; - $this->drupalPostForm($url, [], $element_value); - - if (isset($edit['fields[' . $field_name . '][settings_edit_form][third_party_settings][ds][ft][id]'])) { - $this->drupalPostForm(NULL, ['fields[' . $field_name . '][settings_edit_form][third_party_settings][ds][ft][id]' => $edit['fields[' . $field_name . '][settings_edit_form][third_party_settings][ds][ft][id]']], t('Update')); - $this->drupalPostForm(NULL, [], $element_value); - unset($edit['fields[' . $field_name . '][settings_edit_form][third_party_settings][ds][ft][id]']); - } - - $this->drupalPostForm(NULL, $edit, t('Update')); - $this->drupalPostForm(NULL, [], t('Save')); - } - - /** - * Edit limit. - */ - public function dsEditLimitSettings($edit, $field_name = 'body', $url = 'admin/structure/types/manage/article/display') { - $element_value = 'edit ' . $field_name; - $this->drupalPostForm($url, [], $element_value); - - if (isset($edit['fields[' . $field_name . '][settings_edit_form][third_party_settings][ds][ft][id]'])) { - $this->drupalPostForm(NULL, ['fields[' . $field_name . '][settings_edit_form][third_party_settings][ds][ds_limit]' => $edit['fields[' . $field_name . '][settings_edit_form][third_party_settings][ds][ds_limit]']], t('Update')); - $this->drupalPostForm(NULL, [], $element_value); - unset($edit['fields[' . $field_name . '][settings_edit_form][third_party_settings][ds][ds_limit]']); - } - - $this->drupalPostForm(NULL, $edit, t('Update')); - $this->drupalPostForm(NULL, [], t('Save')); - } - - /** - * Create a token field. - * - * @param array $edit - * An optional array of field properties. - * @param string $url - * The url to post to. - */ - public function dsCreateTokenField(array $edit = [], $url = 'admin/structure/ds/fields/manage_token') { - $edit += [ - 'name' => 'Test field', - 'id' => 'test_field', - 'entities[node]' => '1', - 'content[value]' => 'Test field', - ]; - - $this->drupalPostForm($url, $edit, t('Save')); - $this->assertText(t('The field @name has been saved', ['@name' => $edit['name']]), t('@name field has been saved', ['@name' => $edit['name']])); - } - - /** - * Create a block field. - * - * @param array $edit - * An optional array of field properties. - * @param string $url - * The URL of the manage block page. - */ - public function dsCreateBlockField(array $edit = [], $url = 'admin/structure/ds/fields/manage_block') { - $edit += [ - 'name' => 'Test block field', - 'id' => 'test_block_field', - 'entities[node]' => '1', - 'block' => 'system_powered_by_block', - ]; - - $this->drupalPostForm($url, $edit, t('Save')); - $this->assertText(t('The field @name has been saved', ['@name' => $edit['name']]), t('@name field has been saved', ['@name' => $edit['name']])); - } - - /** - * Utility function to setup for all kinds of tests. - * - * @param string $label - * How the body label must be set. - */ - public function entitiesTestSetup($label = 'above') { - - // Create a node. - $settings = ['type' => 'article', 'promote' => 1]; - $node = $this->drupalCreateNode($settings); - - // Create field CSS classes. - $edit = ['fields' => "test_field_class\ntest_field_class_2|Field class 2\n[node:nid]"]; - $this->drupalPostForm('admin/structure/ds/classes', $edit, t('Save configuration')); - - // Create a token field. - $token_field = [ - 'name' => 'Token field', - 'id' => 'token_field', - 'entities[node]' => '1', - 'content[value]' => '[node:title]', - ]; - $this->dsCreateTokenField($token_field); - - // Select layout. - $this->dsSelectLayout(); - - // Configure fields. - $fields = [ - 'fields[dynamic_token_field:node-token_field][region]' => 'header', - 'fields[body][region]' => 'right', - 'fields[node_link][region]' => 'footer', - 'fields[body][label]' => $label, - 'fields[node_submitted_by][region]' => 'header', - ]; - $this->dsConfigureUi($fields); - - return $node; - } - - /** - * Utility function to clear field settings. - */ - public function entitiesClearFieldSettings() { - $display = entity_get_display('node', 'article', 'default'); - - // Remove all third party settings from components. - foreach ($display->getComponents() as $key => $info) { - $info['third_party_settings'] = []; - $display->setComponent($key, $info); - } - - // Remove entity display third party settings. - $tps = $display->getThirdPartySettings('ds'); - if (!empty($tps)) { - foreach (array_keys($tps) as $key) { - $display->unsetThirdPartySetting('ds', $key); - } - } - - // Save. - $display->save(); - } - - /** - * Set the label. - */ - public function entitiesSetLabelClass($label, $field_name, $text = '', $class = '', $show_colon = FALSE) { - $edit = [ - 'fields[' . $field_name . '][label]' => $label, - ]; - if (!empty($text)) { - $edit['fields[' . $field_name . '][settings_edit_form][third_party_settings][ds][ft][settings][lb]'] = $text; - } - if (!empty($class)) { - $edit['fields[' . $field_name . '][settings_edit_form][third_party_settings][ds][ft][settings][classes][]'] = $class; - } - if ($show_colon) { - $edit['fields[' . $field_name . '][settings_edit_form][third_party_settings][ds][ft][settings][lb-col]'] = '1'; - } - $this->dsEditFormatterSettings($edit); - } - -} diff --git a/web/modules/ds/src/Tests/DynamicFieldPluginTest.php b/web/modules/ds/src/Tests/DynamicFieldPluginTest.php deleted file mode 100644 index 05617003de..0000000000 --- a/web/modules/ds/src/Tests/DynamicFieldPluginTest.php +++ /dev/null @@ -1,170 +0,0 @@ -<?php - -namespace Drupal\ds\Tests; - -/** - * Tests for managing custom code, and block fields. - * - * @group ds - */ -class DynamicFieldPluginTest extends FastTestBase { - - /** - * Test Display fields. - */ - public function testDsFields() { - - $edit = array( - 'name' => 'Test field', - 'id' => 'test_field', - 'entities[node]' => '1', - 'content[value]' => 'Test field', - ); - - $this->dsCreateTokenField($edit); - - // Create the same and assert it already exists. - $this->drupalPostForm('admin/structure/ds/fields/manage_token', $edit, t('Save')); - $this->assertText(t('The machine-readable name is already in use. It must be unique.'), t('Field testing already exists.')); - - $this->dsSelectLayout(); - - // Assert it's found on the Field UI for article. - $this->drupalGet('admin/structure/types/manage/article/display'); - $this->assertRaw('fields[dynamic_token_field:node-test_field][weight]', t('Test field found on node article.')); - - // Assert it's not found on the Field UI for users. - $this->drupalGet('admin/config/people/accounts/display'); - $this->assertNoRaw('fields[dynamic_token_field:node-test_field][weight]', t('Test field not found on user.')); - - // Update testing label. - $edit = array( - 'name' => 'Test field 2', - ); - $this->drupalPostForm('admin/structure/ds/fields/manage_token/test_field', $edit, t('Save')); - $this->assertText(t('The field Test field 2 has been saved'), t('Test field label updated')); - - // Use the Field UI limit option. - $this->dsSelectLayout(array(), array(), 'admin/structure/types/manage/page/display'); - $this->dsSelectLayout(array(), array(), 'admin/structure/types/manage/article/display/teaser'); - $edit = array( - 'ui_limit' => 'article|default', - ); - $this->drupalPostForm('admin/structure/ds/fields/manage_token/test_field', $edit, t('Save')); - - $this->drupalGet('admin/structure/types/manage/article/display'); - $this->assertRaw('fields[dynamic_token_field:node-test_field][weight]', t('Test field field found on node article, default.')); - - $this->drupalGet('admin/structure/types/manage/article/display/teaser'); - $this->assertNoRaw('fields[dynamic_token_field:node-test_field][weight]', t('Test field field not found on node article, teaser.')); - $this->drupalGet('admin/structure/types/manage/page/display'); - $this->assertNoRaw('fields[dynamic_token_field:node-test_field][weight]', t('Test field field not found on node page, default.')); - $edit = array( - 'ui_limit' => 'article|*', - ); - $this->drupalPostForm('admin/structure/ds/fields/manage_token/test_field', $edit, t('Save')); - $this->drupalGet('admin/structure/types/manage/article/display'); - $this->assertRaw('fields[dynamic_token_field:node-test_field][weight]', t('Test field field found on node article, default.')); - $this->drupalGet('admin/structure/types/manage/article/display/teaser'); - $this->assertRaw('fields[dynamic_token_field:node-test_field][weight]', t('Test field field found on node article, teaser.')); - - // Remove the field. - $this->drupalPostForm('admin/structure/ds/fields/delete/test_field', array(), t('Confirm')); - $this->assertText(t('The field Test field 2 has been deleted'), t('Test field removed')); - - // Assert the field is gone at the manage display screen. - $this->drupalGet('admin/structure/types/manage/article/display'); - $this->assertNoRaw('fields[dynamic_token_field:node-test_field][weight]', t('Test field field not found on node article.')); - - // Block fields. - $edit = array( - 'name' => 'Test block field', - 'id' => 'test_block_field', - 'entities[node]' => '1', - 'block' => 'system_powered_by_block', - ); - - $this->dsCreateBlockField($edit); - - // Create the same and assert it already exists. - $this->drupalPostForm('admin/structure/ds/fields/manage_block', $edit, t('Save')); - $this->assertText(t('The machine-readable name is already in use. It must be unique.'), t('Block test field already exists.')); - - $this->dsSelectLayout(); - - // Assert it's found on the Field UI for article. - $this->drupalGet('admin/structure/types/manage/article/display'); - $this->assertRaw('fields[dynamic_block_field:node-test_block_field][weight]', t('Test block field found on node article.')); - - // Assert it's not found on the Field UI for users. - $this->drupalGet('admin/config/people/accounts/display'); - $this->assertNoRaw('fields[dynamic_block_field:node-test_block_field][weight]', t('Test block field not found on user.')); - - // Update testing label. - $edit = array( - 'name' => 'Test block field 2', - ); - $this->drupalPostForm('admin/structure/ds/fields/manage_block/test_block_field', $edit, t('Save')); - $this->assertText(t('The field Test block field 2 has been saved'), t('Test field label updated')); - - // Remove the block field. - $this->drupalPostForm('admin/structure/ds/fields/delete/test_block_field', array(), t('Confirm')); - $this->assertText(t('The field Test block field 2 has been deleted'), t('Test field removed')); - - // Assert the block field is gone at the manage display screen. - $this->drupalGet('admin/structure/types/manage/article/display'); - $this->assertNoRaw('fields[dynamic_block_field:node-test_block_field][weight]', t('Test block field not found on node article.')); - - // Create a configurable block field. - $edit = array( - 'name' => 'Configurable block <script>alert("XSS")</script>', - 'id' => 'test_block_configurable', - 'entities[node]' => '1', - 'block' => 'system_menu_block:tools', - ); - - $this->dsCreateBlockField($edit); - - // Try to set the depth to 3, to ensure we can save the block. - $edit = array( - 'depth' => '3', - ); - $this->drupalPostForm('admin/structure/ds/fields/manage_block/test_block_configurable/block_config', $edit, t('Save')); - - // Assert it's found on the Field UI for article. - $this->drupalGet('admin/structure/types/manage/article/display'); - $this->assertRaw('fields[dynamic_block_field:node-test_block_configurable][weight]', t('Test configurable block field found on node article.')); - - // Assert it's not found on the Field UI for users. - $this->drupalGet('admin/config/people/accounts/display'); - $this->assertNoRaw('fields[dynamic_block_field:node-test_block_configurable][weight]', t('Test configurable block field not found on user.')); - - // Add block to display. - $fields = array( - 'fields[dynamic_block_field:node-test_block_configurable][region]' => 'left', - 'fields[dynamic_block_field:node-test_block_configurable][label]' => 'above', - ); - $this->dsConfigureUi($fields, 'admin/structure/types/manage/article/display'); - - /* @var \Drupal\node\NodeInterface $node */ - $node = $this->entitiesTestSetup(); - - // Look at node and verify the menu is visible. - $this->drupalGet('node/' . $node->id()); - $this->assertRaw('Add content', t('Tools menu found.')); - - // Ensure that there is no XSS attack possible - $this->assertNoRaw('<script>alert("XSS")</script>', 'Harmful tags are escaped when viewing a block field label.'); - - // Try to set the depth to 3, to ensure we can save the block. - $edit = array( - 'level' => '2', - ); - $this->drupalPostForm('admin/structure/ds/fields/manage_block/test_block_configurable/block_config', $edit, t('Save')); - - // Look at node and verify the menu is not visible. - $this->drupalGet('node/' . $node->id()); - $this->assertNoRaw('Add content', t('Tools menu not found.')); - } - -} diff --git a/web/modules/ds/src/Tests/EntitiesTest.php b/web/modules/ds/src/Tests/EntitiesTest.php deleted file mode 100644 index 61e7215314..0000000000 --- a/web/modules/ds/src/Tests/EntitiesTest.php +++ /dev/null @@ -1,210 +0,0 @@ -<?php - -namespace Drupal\ds\Tests; - -/** - * Tests for display of nodes and fields. - * - * @group ds - */ -class EntitiesTest extends FastTestBase { - - /** - * Modules to install. - * - * @var array - */ - public static $modules = array( - 'node', - 'field_ui', - 'taxonomy', - 'block', - 'ds', - 'ds_test', - 'layout_plugin', - 'ds_switch_view_mode', - ); - - /** - * {@inheritdoc} - */ - protected function setup() { - parent::setup(); - - // Enable field templates. - \Drupal::configFactory()->getEditable('ds.settings') - ->set('field_template', TRUE) - ->save(); - } - - /** - * Test basic node display fields. - */ - public function testDsNodeEntity() { - - /* @var \Drupal\node\NodeInterface $node */ - $node = $this->entitiesTestSetup(); - - // Test theme_hook_suggestions in ds_entity_variables(). - $this->drupalGet('node/' . $node->id(), array('query' => array('store_suggestions' => 1))); - $cache = $this->container->get('cache.default')->get('ds_test_suggestions'); - $hook_suggestions = $cache->data; - $expected_hook_suggestions = array( - 'ds_2col_stacked__node', - 'ds_2col_stacked__node_full', - 'ds_2col_stacked__node_article', - 'ds_2col_stacked__node_article_full', - 'ds_2col_stacked__node__1', - ); - $this->assertEqual($hook_suggestions, $expected_hook_suggestions); - - // Look at node and verify token and block field. - $this->drupalGet('node/' . $node->id()); - $this->assertRaw('node--view-mode-full', 'Template file found (in full view mode)'); - $this->assertRaw('<div class="field field--name-dynamic-token-fieldnode-token-field field--type-ds field--label-hidden field__item">', t('Token field found')); - $xpath = $this->xpath('//div[@class="field field--name-dynamic-token-fieldnode-token-field field--type-ds field--label-hidden field__item"]'); - $this->assertEqual((string) $xpath[0]->p, $node->getTitle(), 'Token field content found'); - $this->assertRaw('group-header', 'Template found (region header)'); - $this->assertRaw('group-footer', 'Template found (region footer)'); - $this->assertRaw('group-left', 'Template found (region left)'); - $this->assertRaw('group-right', 'Template found (region right)'); - $this->assertRaw('<div class="field field--name-node-submitted-by field--type-ds field--label-hidden field__item">', 'Submitted by line found'); - $xpath = $this->xpath('//div[@class="field field--name-node-submitted-by field--type-ds field--label-hidden field__item"]'); - $this->assertText('Submitted by ' . (string) $xpath[0]->a->span . ' on', 'Submitted by line found'); - - // Configure teaser layout. - $teaser = array( - 'layout' => 'ds_2col', - ); - $teaser_assert = array( - 'regions' => array( - 'left' => '<td colspan="8">' . t('Left') . '</td>', - 'right' => '<td colspan="8">' . t('Right') . '</td>', - ), - ); - $this->dsSelectLayout($teaser, $teaser_assert, 'admin/structure/types/manage/article/display/teaser'); - - $fields = array( - 'fields[dynamic_token_field:node-token_field][region]' => 'left', - 'fields[body][region]' => 'right', - 'fields[node_links][region]' => 'right', - ); - $this->dsConfigureUi($fields, 'admin/structure/types/manage/article/display/teaser'); - - // Switch view mode on full node page. - $edit = array('ds_switch' => 'teaser'); - $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save and keep published')); - $this->assertRaw('node--view-mode-teaser', 'Switched to teaser mode'); - $this->assertRaw('group-left', 'Template found (region left)'); - $this->assertRaw('group-right', 'Template found (region right)'); - $this->assertNoRaw('group-header', 'Template found (no region header)'); - $this->assertNoRaw('group-footer', 'Template found (no region footer)'); - - $edit = array('ds_switch' => ''); - $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save and keep published')); - $this->assertRaw('node--view-mode-full', 'Switched to full mode again'); - - // Test all options of a block field. - $block = array( - 'name' => 'Test block field', - ); - $this->dsCreateBlockField($block); - $fields = array( - 'fields[dynamic_block_field:node-test_block_field][region]' => 'left', - 'fields[dynamic_token_field:node-token_field][region]' => 'hidden', - 'fields[body][region]' => 'hidden', - 'fields[node_links][region]' => 'hidden', - ); - $this->dsConfigureUi($fields); - $this->drupalGet('node/' . $node->id()); - $this->assertRaw('field--name-dynamic-block-fieldnode-test-block-field'); - - // Test revisions. Enable the revision view mode. - $edit = array( - 'display_modes_custom[revision]' => '1', - ); - $this->drupalPostForm('admin/structure/types/manage/article/display', $edit, t('Save')); - - // Enable the override revision mode and configure it. - $edit = array( - 'fs3[override_node_revision]' => TRUE, - 'fs3[override_node_revision_view_mode]' => 'revision', - ); - $this->drupalPostForm('admin/structure/ds/settings', $edit, t('Save configuration')); - - // Select layout and configure fields. - $edit = array( - 'layout' => 'ds_2col', - ); - $assert = array( - 'regions' => array( - 'left' => '<td colspan="8">' . t('Left') . '</td>', - 'right' => '<td colspan="8">' . t('Right') . '</td>', - ), - ); - $this->dsSelectLayout($edit, $assert, 'admin/structure/types/manage/article/display/revision'); - $edit = array( - 'fields[body][region]' => 'left', - 'fields[node_link][region]' => 'right', - 'fields[node_author][region]' => 'right', - ); - $this->dsConfigureUi($edit, 'admin/structure/types/manage/article/display/revision'); - - // Create revision of the node. - $edit = array( - 'revision' => TRUE, - 'revision_log[0][value]' => 'Test revision', - ); - $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save and keep published')); - - // Verify the revision is created. - $this->drupalGet('node/' . $node->id() . '/revisions'); - $this->assertText('Test revision'); - - // Assert revision is using 2 col template. - $this->drupalGet('node/' . $node->id() . '/revisions/1/view'); - $this->assertText('Body', 'Body label'); - - // Assert full view is using stacked template. - $this->drupalGet('node/' . $node->id()); - $this->assertNoText('Body', 'No Body label'); - - // Test formatter limit on article with tags. - $edit = array( - 'ds_switch' => '', - 'field_tags[0][target_id]' => 'Tag 1', - 'field_tags[1][target_id]' => 'Tag 2', - ); - $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save and keep published')); - $edit = array( - 'fields[field_tags][region]' => 'right', - 'fields[field_tags][type]' => 'entity_reference_label', - ); - $this->dsConfigureUi($edit, 'admin/structure/types/manage/article/display'); - $this->drupalGet('node/' . $node->id()); - $this->assertText('Tag 1'); - $this->assertText('Tag 2'); - $edit = array( - 'fields[field_tags][settings_edit_form][third_party_settings][ds][ds_limit]' => '1', - ); - $this->dsEditLimitSettings($edit, 'field_tags'); - $this->drupalGet('node/' . $node->id()); - $this->assertText('Tag 1'); - $this->assertNoText('Tag 2'); - - // Test \Drupal\Component\Utility\Html::escape() on ds_render_field() with - // the title field. - $edit = array( - 'fields[node_title][region]' => 'right', - ); - $this->dsConfigureUi($edit, 'admin/structure/types/manage/article/display'); - $edit = array( - 'title[0][value]' => 'Hi, I am an article <script>alert(\'with a javascript tag in the title\');</script>', - ); - $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save and keep published')); - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="field field--name-node-title field--type-ds field--label-hidden field__item"]/h2'); - $this->assertTrimEqual($xpath[0], 'Hi, I am an article <script>alert(\'with a javascript tag in the title\');</script>'); - } - -} diff --git a/web/modules/ds/src/Tests/ExportablesTest.php b/web/modules/ds/src/Tests/ExportablesTest.php deleted file mode 100644 index a6125449c3..0000000000 --- a/web/modules/ds/src/Tests/ExportablesTest.php +++ /dev/null @@ -1,86 +0,0 @@ -<?php - -namespace Drupal\ds\Tests; - -use Drupal\Core\Entity\Entity\EntityViewDisplay; - -/** - * Tests for exportables in Display Suite. - * - * @group ds - */ -class ExportablesTest extends FastTestBase { - - /** - * Enables the exportables module. - */ - public function dsExportablesSetup() { - /* @var $display EntityViewDisplay */ - $display = EntityViewDisplay::load('node.article.default'); - $display->delete(); - \Drupal::service('module_installer')->install(array('ds_exportables_test')); - } - - /** - * Test layout and field settings configuration. - */ - public function testDsExportablesLayoutFieldsettings() { - $this->dsExportablesSetup(); - - // Look for default custom field. - $this->drupalGet('admin/structure/ds/fields'); - $this->assertText('Exportable field'); - $this->drupalGet('admin/structure/types/manage/article/display'); - $this->assertText('Exportable field'); - - $settings = array( - 'type' => 'article', - 'title' => 'Exportable', - ); - $node = $this->drupalCreateNode($settings); - $this->drupalGet('node/' . $node->id()); - $this->assertRaw('group-left', 'Left region found'); - $this->assertRaw('group-right', 'Right region found'); - $this->assertNoRaw('group-header', 'No header region found'); - $this->assertNoRaw('group-footer', 'No footer region found'); - $link = $this->xpath('//h3/a[text()=:text]', array( - ':text' => 'Exportable', - )); - $this->assertEqual(count($link), 1, 'Default title with h3 found'); - $link = $this->xpath('//a[text()=:text]', array( - ':text' => 'Read more', - )); - $this->assertEqual(count($link), 1, 'Default read more found'); - - // Override default layout. - $layout = array( - 'layout' => 'ds_2col_stacked', - ); - - $assert = array( - 'regions' => array( - 'header' => '<td colspan="8">' . t('Header') . '</td>', - 'left' => '<td colspan="8">' . t('Left') . '</td>', - 'right' => '<td colspan="8">' . t('Right') . '</td>', - 'footer' => '<td colspan="8">' . t('Footer') . '</td>', - ), - ); - - $fields = array( - 'fields[node_post_date][region]' => 'header', - 'fields[node_author][region]' => 'left', - 'fields[node_link][region]' => 'left', - 'fields[body][region]' => 'right', - ); - - $this->dsSelectLayout($layout, $assert); - $this->dsConfigureUi($fields); - - $this->drupalGet('node/' . $node->id()); - $this->assertRaw('group-left', 'Left region found'); - $this->assertRaw('group-right', 'Right region found'); - $this->assertRaw('group-header', 'Header region found'); - $this->assertRaw('group-footer', 'Footer region found'); - } - -} diff --git a/web/modules/ds/src/Tests/FastTestBase.php b/web/modules/ds/src/Tests/FastTestBase.php deleted file mode 100644 index 0d935f66b4..0000000000 --- a/web/modules/ds/src/Tests/FastTestBase.php +++ /dev/null @@ -1,180 +0,0 @@ -<?php - -namespace Drupal\ds\Tests; - -use Drupal\Core\Language\LanguageInterface; -use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait; -use Drupal\field_ui\Tests\FieldUiTestTrait; -use Drupal\simpletest\WebTestBase; -use Drupal\taxonomy\Entity\Term; -use Drupal\taxonomy\Entity\Vocabulary; -use Drupal\taxonomy\Tests\TaxonomyTestTrait; - -/** - * Base test for Display Suite. - * - * @group ds - */ -abstract class FastTestBase extends WebTestBase { - - use DsTestTrait; - use EntityReferenceTestTrait; - use FieldUiTestTrait; - use TaxonomyTestTrait; - - /** - * Modules to install. - * - * @var array - */ - public static $modules = [ - 'node', - 'user', - 'field_ui', - 'rdf', - 'quickedit', - 'taxonomy', - 'block', - 'ds', - 'ds_extras', - 'ds_test', - 'ds_switch_view_mode', - 'layout_discovery', - 'field_group', - ]; - - /** - * The label for a random field to be created for testing. - * - * @var string - */ - protected $fieldLabel; - - /** - * The input name of a random field to be created for testing. - * - * @var string - */ - protected $fieldNameInput; - - /** - * The name of a random field to be created for testing. - * - * @var string - */ - protected $fieldName; - - /** - * The created taxonomy vocabulary. - * - * @var \Drupal\taxonomy\Entity\Vocabulary - */ - protected $vocabulary; - - /** - * The created user. - * - * @var \Drupal\user\UserInterface - */ - protected $adminUser; - - /** - * {@inheritdoc} - */ - protected function setUp() { - parent::setUp(); - $this->drupalPlaceBlock('system_breadcrumb_block'); - $this->drupalPlaceBlock('local_tasks_block'); - - // Create a test user. - $this->adminUser = $this->drupalCreateUser([ - 'access content', - 'access in-place editing', - 'admin classes', - 'admin display suite', - 'admin fields', - 'administer nodes', - 'view all revisions', - 'administer content types', - 'administer node fields', - 'administer node form display', - 'administer node display', - 'administer taxonomy', - 'administer taxonomy_term fields', - 'administer taxonomy_term display', - 'administer users', - 'administer permissions', - 'administer account settings', - 'administer user display', - 'administer software updates', - 'access site in maintenance mode', - 'administer site configuration', - 'bypass node access', - 'ds switch view mode', - ]); - $this->drupalLogin($this->adminUser); - - // Create random field name. - $this->fieldLabel = $this->randomMachineName(8); - $this->fieldNameInput = strtolower($this->randomMachineName(8)); - $this->fieldName = 'field_' . $this->fieldNameInput; - - // Create Article node type. - $this->drupalCreateContentType([ - 'type' => 'article', - 'name' => 'Article', - 'revision' => TRUE, - ]); - $this->drupalCreateContentType([ - 'type' => 'page', - 'name' => 'Page', - 'revision' => TRUE, - ]); - - // Create a vocabulary named "Tags". - $this->vocabulary = Vocabulary::create([ - 'name' => 'Tags', - 'vid' => 'tags', - 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, - ]); - $this->vocabulary->save(); - - $term1 = Term::create([ - 'name' => 'Tag 1', - 'vid' => 'tags', - 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, - ]); - $term1->save(); - - $term2 = Term::create([ - 'name' => 'Tag 2', - 'vid' => 'tags', - 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, - ]); - $term2->save(); - - $handler_settings = [ - 'target_bundles' => [ - $this->vocabulary->id() => $this->vocabulary->id(), - ], - // Enable auto-create. - 'auto_create' => TRUE, - ]; - $this->createEntityReferenceField('node', 'article', 'field_' . $this->vocabulary->id(), 'Tags', 'taxonomy_term', 'default', $handler_settings, 10); - - entity_get_form_display('node', 'article', 'default') - ->setComponent('field_' . $this->vocabulary->id()) - ->save(); - } - - /** - * Check to see if two trimmed values are equal. - */ - protected function assertTrimEqual($first, $second, $message = '', $group = 'Other') { - $first = (string) $first; - $second = (string) $second; - - return $this->assertEqual(trim($first), trim($second), $message, $group); - } - -} diff --git a/web/modules/ds/src/Tests/FieldGroupTest.php b/web/modules/ds/src/Tests/FieldGroupTest.php deleted file mode 100644 index e871673325..0000000000 --- a/web/modules/ds/src/Tests/FieldGroupTest.php +++ /dev/null @@ -1,68 +0,0 @@ -<?php - -namespace Drupal\ds\Tests; - -use Drupal\field_group\Tests\FieldGroupTestTrait; - -/** - * Tests for field group integration with Display Suite. - * - * @group ds - */ -class FieldGroupTest extends FastTestBase { - - use FieldGroupTestTrait; - - /** - * Test tabs. - */ - public function testFieldPlugin() { - // Create a node. - $settings = array('type' => 'article', 'promote' => 1); - /* @var \Drupal\node\NodeInterface $node */ - $node = $this->drupalCreateNode($settings); - - // Configure layout. - $layout = array( - 'layout' => 'ds_2col', - ); - $layout_assert = array( - 'regions' => array( - 'left' => '<td colspan="8">' . t('Left') . '</td>', - 'right' => '<td colspan="8">' . t('Right') . '</td>', - ), - ); - $this->dsSelectLayout($layout, $layout_assert); - - $data = array( - 'weight' => '1', - 'label' => 'Link', - 'format_type' => 'html_element', - 'format_settings' => array( - 'label' => 'Link', - 'element' => 'div', - 'id' => 'wrapper-id', - 'classes' => 'test-class', - ), - ); - $group = $this->createGroup('node', 'article', 'view', 'default', $data); - - $fields = array( - 'fields[' . $group->group_name . '][region]' => 'right', - 'fields[body][region]' => 'right', - ); - $this->dsConfigureUi($fields); - - $fields = array( - 'fields[body][parent]' => $group->group_name, - ); - $this->dsConfigureUi($fields); - - $this->drupalGet('node/' . $node->id()); - - // Test group ids and classes. - $this->assertFieldByXPath("//div[contains(@class, 'group-right')]/div[contains(@id, 'wrapper-id')]", NULL, 'Wrapper id set on wrapper div'); - $this->assertFieldByXPath("//div[contains(@class, 'group-right')]/div[contains(@class, 'test-class')]", NULL, 'Test class set on wrapper div' . 'class="' . $group->group_name . ' test-class'); - } - -} diff --git a/web/modules/ds/src/Tests/FieldPermissionsTest.php b/web/modules/ds/src/Tests/FieldPermissionsTest.php deleted file mode 100644 index 16a1f49371..0000000000 --- a/web/modules/ds/src/Tests/FieldPermissionsTest.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php - -namespace Drupal\ds\Tests; - -/** - * Tests for testing field permissions. - * - * @group ds - */ -class FieldPermissionsTest extends FastTestBase { - - /** - * Modules to install. - * - * @var array - */ - public static $modules = array( - 'node', - 'field_ui', - 'taxonomy', - 'block', - 'ds', - 'ds_extras', - 'ds_test', - 'layout_plugin', - 'views', - 'views_ui', - ); - - /** - * Tests field permissions. - */ - public function testFieldPermissions() { - - $fields = array( - 'fields[body][region]' => 'right', - 'fields[test_field][region]' => 'left', - ); - - $this->config('ds_extras.settings')->set('field_permissions', TRUE)->save(); - \Drupal::moduleHandler()->resetImplementations(); - - $this->dsSelectLayout(); - $this->dsConfigureUi($fields); - - // Create a node. - $settings = array('type' => 'article'); - $node = $this->drupalCreateNode($settings); - $this->drupalGet('node/' . $node->id()); - $this->assertRaw('group-right', 'Template found (region right)'); - $this->assertNoText('Test field plugin on node ' . $node->id(), 'Test code field not found'); - - // Give permissions. - $edit = array( - 'authenticated[view node_author on node]' => 1, - 'authenticated[view test_field on node]' => 1, - ); - $this->drupalPostForm('admin/people/permissions', $edit, t('Save permissions')); - $this->drupalGet('node/' . $node->id()); - $this->assertRaw('group-left', 'Template found (region left)'); - $this->assertText('Test field plugin on node ' . $node->id(), 'Test field plugin found'); - } - -} diff --git a/web/modules/ds/src/Tests/FieldPluginTest.php b/web/modules/ds/src/Tests/FieldPluginTest.php deleted file mode 100644 index b310288b54..0000000000 --- a/web/modules/ds/src/Tests/FieldPluginTest.php +++ /dev/null @@ -1,90 +0,0 @@ -<?php - -namespace Drupal\ds\Tests; - -/** - * Tests DS field plugins. - * - * @group ds - */ -class FieldPluginTest extends FastTestBase { - - /** - * Test basic Display Suite fields plugins. - */ - public function testFieldPlugin() { - // Rename the title field. - $edit = array( - 'title_label' => 'alternative article title', - ); - $this->drupalPostForm('admin/structure/types/manage/article', $edit, t('Save content type')); - - $this->dsSelectLayout(); - - // Find the two field plugins from the test module on the node type. - $this->drupalGet('admin/structure/types/manage/article/display'); - $this->assertText('Test field plugin', 'Test field found on node.'); - // One is altered by hook_ds_fields_info_alter() - $this->assertText('Field altered', 'Test field altered found on node.'); - - $empty = array(); - $edit = array('layout' => 'ds_2col_stacked'); - $this->dsSelectLayout($edit, $empty, 'admin/config/people/accounts/display'); - - // Fields can not be found on user. - $this->drupalGet('admin/config/people/accounts/display'); - $this->assertNoText('Test code field from plugin', 'Test field not found on user.'); - $this->assertNoText('Field altered', 'Test field altered not found on user.'); - - // Select layout. - $this->dsSelectLayout(); - - $fields = array( - 'fields[node_title][region]' => 'right', - 'fields[node_title][label]' => 'inline', - 'fields[node_author][region]' => 'left', - 'fields[node_links][region]' => 'left', - 'fields[body][region]' => 'right', - 'fields[test_field][region]' => 'right', - 'fields[test_multiple_field][region]' => 'right', - 'fields[test_field_empty_string][region]' => 'right', - 'fields[test_field_empty_string][label]' => 'inline', - 'fields[test_field_false][region]' => 'right', - 'fields[test_field_false][label]' => 'inline', - 'fields[test_field_null][region]' => 'right', - 'fields[test_field_null][label]' => 'inline', - 'fields[test_field_nothing][region]' => 'right', - 'fields[test_field_nothing][label]' => 'inline', - 'fields[test_field_zero_int][region]' => 'right', - 'fields[test_field_zero_int][label]' => 'inline', - 'fields[test_field_zero_string][region]' => 'right', - 'fields[test_field_zero_string][label]' => 'inline', - 'fields[test_field_zero_float][region]' => 'right', - 'fields[test_field_zero_float][label]' => 'inline', - ); - - $this->dsSelectLayout(); - $this->dsConfigureUi($fields); - - // Create a node. - $settings = array('type' => 'article'); - $node = $this->drupalCreateNode($settings); - $this->drupalGet('node/' . $node->id()); - - $this->assertRaw('group-left', 'Template found (region left)'); - $this->assertRaw('group-right', 'Template found (region right)'); - $this->assertText('Test field plugin on node ' . $node->id(), 'Test field plugin found'); - $this->assertText('Test row one of multiple field plugin on node ' . $node->id(), 'First item of multiple field plugin found'); - $this->assertText('Test row two of multiple field plugin on node ' . $node->id(), 'Second item of multiple field plugin found'); - $this->assertText('Test field plugin that returns an empty string', 'Test field plugin that returns an empty string is visible.'); - $this->assertNoText('Test field plugin that returns FALSE', 'Test field plugin that returns FALSE is not visible.'); - $this->assertNoText('Test field plugin that returns NULL', 'Test field plugin that returns NULL is not visible.'); - $this->assertNoText('Test field plugin that returns nothing', 'Test field plugin that returns nothing is not visible.'); - $this->assertNoText('Test field plugin that returns an empty array', 'Test field plugin that returns an empty array is not visible.'); - $this->assertText('Test field plugin that returns zero as an integer', 'Test field plugin that returns zero as an integer is visible.'); - $this->assertText('Test field plugin that returns zero as a string', 'Test field plugin that returns zero as a string is visible.'); - $this->assertText('Test field plugin that returns zero as a floating point number', 'Test field plugin that returns zero as a floating point number is visible.'); - $this->assertText('alternative article title'); - } - -} diff --git a/web/modules/ds/src/Tests/FieldTemplateTest.php b/web/modules/ds/src/Tests/FieldTemplateTest.php deleted file mode 100644 index 9ddfaf41ee..0000000000 --- a/web/modules/ds/src/Tests/FieldTemplateTest.php +++ /dev/null @@ -1,582 +0,0 @@ -<?php - -namespace Drupal\ds\Tests; - -use Drupal\Core\Cache\Cache; - -/** - * Tests for display of nodes and fields. - * - * @group ds - */ -class FieldTemplateTest extends FastTestBase { - - /** - * {@inheritdoc} - */ - protected function setup() { - parent::setup(); - - // Enable field templates. - \Drupal::configFactory()->getEditable('ds.settings') - ->set('field_template', TRUE) - ->save(); - } - - /** - * Tests on field templates. - */ - public function testDsFieldTemplate() { - // Get a node. - $node = $this->entitiesTestSetup('hidden'); - $body_field = $node->body->value; - - // Default theming function. - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"]'); - $this->assertTrimEqual($xpath[0]->p, $body_field); - - $this->entitiesSetLabelClass('above', 'body'); - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-above"]/div[@class="field__label"]'); - $this->assertTrimEqual($xpath[0], 'Body'); - $xpath = $this->xpath('//div[@class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-above"]/div[@class="field__item"]'); - $this->assertTrimEqual($xpath[0]->p, $body_field); - - $this->entitiesSetLabelClass('above', 'body', 'My body'); - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-above"]/div[@class="field__label"]'); - $this->assertTrimEqual($xpath[0], 'My body'); - $xpath = $this->xpath('//div[@class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-above"]/div[@class="field__item"]'); - $this->assertTrimEqual($xpath[0]->p, $body_field); - - $this->entitiesSetLabelClass('hidden', 'body', '', 'test_field_class'); - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="test_field_class clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"]'); - $this->assertTrimEqual($xpath[0]->p, $body_field); - } - - /** - * Tests on field templates. - */ - public function testDsFieldTemplate2() { - // Get a node. - $node = $this->entitiesTestSetup('hidden'); - $body_field = $node->body->value; - - // Reset theming function. - $edit = array( - 'fs1[ft-default]' => 'reset', - ); - $this->drupalPostForm('admin/structure/ds/settings', $edit, t('Save configuration')); - - // As long as we don't change anything in the UI, the default template will - // be used. - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="group-right"]'); - $this->assertTrimEqual($xpath[0]->div->p, $body_field); - - $this->entitiesSetLabelClass('above', 'body'); - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="group-right"]'); - $this->assertTrimEqual($xpath[0]->p, $body_field); - $xpath = $this->xpath('//div[@class="group-right"]/div[@class="field-label-above"]'); - $this->assertTrimEqual($xpath[0], 'Body'); - - $this->entitiesSetLabelClass('inline', 'body'); - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="group-right"]'); - $this->assertTrimEqual($xpath[0]->p, $body_field); - $xpath = $this->xpath('//div[@class="group-right"]/div[@class="field-label-inline"]'); - $this->assertTrimEqual($xpath[0], 'Body'); - - $this->entitiesSetLabelClass('above', 'body', 'My body'); - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="group-right"]'); - $this->assertTrimEqual($xpath[0]->p, $body_field); - $xpath = $this->xpath('//div[@class="group-right"]/div[@class="field-label-above"]'); - $this->assertTrimEqual($xpath[0], 'My body'); - - $this->entitiesSetLabelClass('inline', 'body', 'My body'); - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="group-right"]'); - $this->assertTrimEqual($xpath[0]->p, $body_field); - $xpath = $this->xpath('//div[@class="group-right"]/div[@class="field-label-inline"]'); - $this->assertTrimEqual($xpath[0], 'My body'); - - $edit = array( - 'fs1[ft-show-colon]' => 'reset', - ); - $this->drupalPostForm('admin/structure/ds/settings', $edit, t('Save configuration')); - // Clear node cache to get the colon. - $tags = $node->getCacheTags(); - Cache::invalidateTags($tags); - - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="group-right"]'); - $this->assertTrimEqual($xpath[0]->p, $body_field); - $xpath = $this->xpath('//div[@class="group-right"]/div[@class="field-label-inline"]'); - $this->assertTrimEqual($xpath[0], 'My body:'); - - $this->entitiesSetLabelClass('hidden', 'body'); - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="group-right"]'); - $this->assertTrimEqual($xpath[0]->p, $body_field); - } - - /** - * Tests on field templates. - */ - public function testDsFieldTemplate3() { - // Get a node. - $node = $this->entitiesTestSetup('hidden'); - $body_field = $node->body->value; - - // Custom field function with outer wrapper. - $edit = array( - 'fields[body][settings_edit_form][third_party_settings][ds][ft][id]' => 'expert', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-el]' => 'div', - ); - $this->dsEditFormatterSettings($edit); - drupal_flush_all_caches(); - - // As long as we don't change anything in the UI, the default template will - // be used. - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="group-right"]'); - $this->assertTrimEqual($xpath[0]->div->p, $body_field); - - // With outer div wrapper and class. - $edit = array( - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-cl]' => 'ow-class', - ); - $this->dsEditFormatterSettings($edit); - drupal_flush_all_caches(); - - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="group-right"]/div[@class="ow-class"]'); - $this->assertTrimEqual($xpath[0]->p, $body_field); - - // With outer span wrapper and class. - $edit = array( - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-el]' => 'span', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-cl]' => 'ow-class-2', - ); - $this->dsEditFormatterSettings($edit); - drupal_flush_all_caches(); - - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="group-right"]/span[@class="ow-class-2"]'); - $this->assertTrimEqual($xpath[0]->p, $body_field); - } - - /** - * Tests on field templates. - */ - public function testDsFieldTemplate4() { - - // Get a node. - $node = $this->entitiesTestSetup('hidden'); - $body_field = $node->body->value; - - // With outer wrapper and field items wrapper. - $edit = array( - 'fields[body][settings_edit_form][third_party_settings][ds][ft][id]' => 'expert', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-el]' => 'div', - ); - $this->dsEditFormatterSettings($edit); - - drupal_flush_all_caches(); - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="group-right"]/div/div'); - $this->assertTrimEqual($xpath[0]->p, $body_field); - - // With outer wrapper and field items div wrapper with class. - $edit = array( - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-cl]' => 'fi-class', - ); - $this->dsEditFormatterSettings($edit); - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="group-right"]/div/div[@class="fi-class"]'); - $this->assertTrimEqual($xpath[0]->p, $body_field); - - // With outer wrapper and field items span wrapper and class. - $edit = array( - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-el]' => 'span', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-cl]' => 'fi-class', - ); - $this->dsEditFormatterSettings($edit); - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="group-right"]/div/span[@class="fi-class"]'); - $this->assertTrimEqual($xpath[0]->p, $body_field); - - // With outer wrapper class and field items span wrapper and class. - $edit = array( - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-cl]' => 'ow-class', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-el]' => 'span', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-cl]' => 'fi-class', - ); - $this->dsEditFormatterSettings($edit); - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="group-right"]/div[@class="ow-class"]/span[@class="fi-class"]'); - $this->assertTrimEqual($xpath[0]->p, $body_field); - - // With outer wrapper span class and field items span wrapper and class. - $edit = array( - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-el]' => 'span', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-cl]' => 'ow-class', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-el]' => 'span', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-cl]' => 'fi-class-2', - ); - $this->dsEditFormatterSettings($edit); - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="group-right"]/span[@class="ow-class"]/span[@class="fi-class-2"]'); - $this->assertTrimEqual($xpath[0]->p, $body_field); - } - - /** - * Tests on field templates. - */ - public function testDsFieldTemplate5() { - // Get a node. - $node = $this->entitiesTestSetup('hidden'); - $body_field = $node->body->value; - - // With field item div wrapper. - $edit = array( - 'fields[body][settings_edit_form][third_party_settings][ds][ft][id]' => 'expert', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi]' => '1', - ); - $this->dsEditFormatterSettings($edit); - drupal_flush_all_caches(); - - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="group-right"]'); - $this->assertTrimEqual($xpath[0]->div->p, $body_field); - - // With field item span wrapper. - $edit = array( - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-el]' => 'span', - ); - $this->dsEditFormatterSettings($edit); - drupal_flush_all_caches(); - - $this->drupalGet('node/' . $node->id()); - - $xpath = $this->xpath('//div[@class="group-right"]'); - $this->assertTrimEqual($xpath[0]->span->p, $body_field); - - // With field item span wrapper and class. - $edit = array( - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-el]' => 'span', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-cl]' => 'fi-class', - ); - $this->dsEditFormatterSettings($edit); - drupal_flush_all_caches(); - - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="group-right"]/span[@class="fi-class"]'); - $this->assertTrimEqual($xpath[0]->p, $body_field); - - // With fis and fi. - $edit = array( - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-cl]' => 'fi-class-2', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-cl]' => 'fi-class', - ); - $this->dsEditFormatterSettings($edit); - drupal_flush_all_caches(); - - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="group-right"]/div[@class="fi-class-2"]/div[@class="fi-class"]'); - $this->assertTrimEqual($xpath[0]->p, $body_field); - - // With all wrappers. - $edit = array( - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-cl]' => 'ow-class', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-cl]' => 'fi-class-2', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-el]' => 'span', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-cl]' => 'fi-class', - ); - $this->dsEditFormatterSettings($edit); - drupal_flush_all_caches(); - - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="group-right"]/div[@class="ow-class"]/div[@class="fi-class-2"]/span[@class="fi-class"]'); - $this->assertTrimEqual($xpath[0]->p, $body_field); - - // With all wrappers and attributes. - $edit = array( - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-cl]' => 'ow-class', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-at]' => 'name="ow-att"', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-cl]' => 'fi-class-2', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-at]' => 'name="fis-att"', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-el]' => 'span', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-cl]' => 'fi-class', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-at]' => 'name="fi-at"', - ); - $this->dsEditFormatterSettings($edit); - drupal_flush_all_caches(); - - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="group-right"]/div[@class="ow-class" and @name="ow-att"]/div[@class="fi-class-2" and @name="fis-att"]/span[@class="fi-class" and @name="fi-at"]'); - $this->assertTrimEqual($xpath[0]->p, $body_field); - - // Remove attributes. - $edit = array( - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-cl]' => 'ow-class', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-at]' => '', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-cl]' => 'fi-class-2', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-at]' => '', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-el]' => 'span', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-cl]' => 'fi-class', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-at]' => '', - ); - $this->dsEditFormatterSettings($edit); - - // Label tests with custom function. - $this->entitiesSetLabelClass('above', 'body'); - drupal_flush_all_caches(); - - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="group-right"]/div[@class="ow-class"]/div[@class="field-label-above"]'); - $this->assertTrimEqual($xpath[0], 'Body'); - $xpath = $this->xpath('//div[@class="group-right"]/div[@class="ow-class"]/div[@class="fi-class-2"]/span[@class="fi-class"]'); - $this->assertTrimEqual($xpath[0]->p, $body_field); - - $this->entitiesSetLabelClass('inline', 'body'); - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="group-right"]/div[@class="ow-class"]/div[@class="field-label-inline"]'); - $this->assertTrimEqual($xpath[0], 'Body'); - $xpath = $this->xpath('//div[@class="group-right"]/div[@class="ow-class"]/div[@class="fi-class-2"]/span[@class="fi-class"]'); - $this->assertTrimEqual($xpath[0]->p, $body_field); - - $this->entitiesSetLabelClass('above', 'body', 'My body'); - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="group-right"]/div[@class="ow-class"]/div[@class="field-label-above"]'); - $this->assertTrimEqual($xpath[0], 'My body'); - $xpath = $this->xpath('//div[@class="group-right"]/div[@class="ow-class"]/div[@class="fi-class-2"]/span[@class="fi-class"]'); - $this->assertTrimEqual($xpath[0]->p, $body_field); - - $this->entitiesSetLabelClass('inline', 'body', 'My body'); - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="group-right"]/div[@class="ow-class"]/div[@class="field-label-inline"]'); - $this->assertTrimEqual($xpath[0], 'My body'); - $xpath = $this->xpath('//div[@class="group-right"]/div[@class="ow-class"]/div[@class="fi-class-2"]/span[@class="fi-class"]'); - $this->assertTrimEqual($xpath[0]->p, $body_field); - - $this->entitiesSetLabelClass('inline', 'body', 'My body', '', TRUE); - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="group-right"]/div[@class="ow-class"]/div[@class="field-label-inline"]'); - $this->assertTrimEqual($xpath[0], 'My body:'); - $xpath = $this->xpath('//div[@class="group-right"]/div[@class="ow-class"]/div[@class="fi-class-2"]/span[@class="fi-class"]'); - $this->assertTrimEqual($xpath[0]->p, $body_field); - - $this->entitiesSetLabelClass('hidden', 'body'); - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="group-right"]/div[@class="ow-class"]/div[@class="fi-class-2"]/span[@class="fi-class"]'); - $this->assertTrimEqual($xpath[0]->p, $body_field); - - // Test default classes on outer wrapper. - // @todo figure out a way to actually test this as the default cases don't - // have classes anymore. - $edit = array( - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-cl]' => 'ow-class', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-def-cl]' => '1', - ); - $this->dsEditFormatterSettings($edit); - drupal_flush_all_caches(); - - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="group-right"]/div[@class="ow-class"]/div[@class="fi-class-2"]/span[@class="fi-class"]'); - $this->assertTrimEqual($xpath[0]->p, $body_field); - - // Test default attributes on field item. - $edit = array( - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-cl]' => 'ow-class', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-def-at]' => '1', - ); - $this->dsEditFormatterSettings($edit); - drupal_flush_all_caches(); - - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="group-right"]/div[@class="ow-class" and @data-quickedit-field-id="node/1/body/en/full"]/div[@class="fi-class-2"]/span[@class="fi-class"]'); - $this->assertTrimEqual($xpath[0]->p, $body_field); - - // Use the test field theming function to test that this function is - // registered in the theme registry through ds_extras_theme(). - $edit = array( - 'fields[body][settings_edit_form][third_party_settings][ds][ft][id]' => 'ds_test_template', - ); - - $this->dsEditFormatterSettings($edit); - drupal_flush_all_caches(); - - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="group-right"]'); - $this->assertTrimEqual($xpath[0], 'Testing field output through custom function'); - } - - /** - * Tests XSS on field templates. - */ - public function testDsFieldTemplateXss() { - // Get a node. - $node = $this->entitiesTestSetup('hidden'); - - $edit = array( - 'fields[body][settings_edit_form][third_party_settings][ds][ft][id]' => 'expert', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi]' => '1', - ); - $this->dsEditFormatterSettings($edit); - - // Inject XSS everywhere and see if it brakes. - $edit = array( - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][prefix]' => '<div class="not-stripped"><script>alert("XSS")</script>', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][suffix]' => '</div><script>alert("XSS")</script>', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-el]' => '<script>alert("XSS")</script>', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-cl]' => '<script>alert("XSS")</script>', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-at]' => "name=\"<script>alert('XSS')</script>\"", - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-el]' => '<script>alert("XSS")</script>', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-cl]' => '<script>alert("XSS")</script>', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-at]' => "name=\"<script>alert('XSS')</script>\"", - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-el]' => '<script>alert("XSS")</script>', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-cl]' => '<script>alert("XSS")</script>', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-at]' => "name=\"<script>alert('XSS')</script>\"", - ); - $this->dsEditFormatterSettings($edit); - drupal_flush_all_caches(); - - $this->drupalGet('node/' . $node->id()); - $this->assertNoRaw('<script>alert("XSS")</script>', 'Harmful tags are escaped when viewing a ds field template.'); - - // Verify the prefix/suffix is filtered but not escaped. - $xpath = $this->xpath('//div[@class="not-stripped"]'); - $this->assertEqual(count($xpath), 1, 'Stripped but not escaped'); - } - - /** - * Tests multiple field items. - */ - public function testDsMultipleFieldItems() { - // Get a node. - $node = $this->entitiesTestSetup('hidden'); - - $edit = array( - 'fields[field_tags][region]' => 'right', - 'fields[field_tags][type]' => 'entity_reference_label', - ); - $this->dsConfigureUi($edit, 'admin/structure/types/manage/article/display'); - - // Set expert field on. - $edit = array( - 'fields[field_tags][settings_edit_form][third_party_settings][ds][ft][id]' => 'expert', - 'fields[field_tags][settings_edit_form][third_party_settings][ds][ft][settings][fis]' => '1', - 'fields[field_tags][settings_edit_form][third_party_settings][ds][ft][settings][fis-cl]' => 'tags', - 'fields[field_tags][settings_edit_form][third_party_settings][ds][ft][settings][fi]' => '1', - 'fields[field_tags][settings_edit_form][third_party_settings][ds][ft][settings][fi-cl]' => 'tag', - ); - $this->dsEditFormatterSettings($edit, 'field_tags'); - drupal_flush_all_caches(); - - // Add multiple tags. - $edit = array( - 'field_tags[0][target_id]' => 'Tag 1', - 'field_tags[1][target_id]' => 'Tag 2', - ); - $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save and keep published')); - - // Count the found tags. - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="group-right"]/div[@class="tags"]/div[@class="tag"]'); - $this->assertEqual(count($xpath), 2, '2 tags found'); - } - - /** - * Tests minimal template functionality. - */ - public function testFieldTemplateMinimal() { - // Get a node. - $node = $this->entitiesTestSetup('hidden'); - $body_field = $node->body->value; - - $edit = array( - 'fields[body][region]' => 'right', - ); - $this->dsConfigureUi($edit, 'admin/structure/types/manage/article/display'); - - // Set minimal template on. - $edit = array( - 'fields[body][settings_edit_form][third_party_settings][ds][ft][id]' => 'minimal', - ); - $this->dsEditFormatterSettings($edit, 'body'); - drupal_flush_all_caches(); - - $this->drupalGet('node/' . $node->id()); - $xpath = $this->xpath('//div[@class="group-right"]/div[@class="field field-name-body"]'); - $this->assertTrimEqual($xpath[0]->p, $body_field); - - // Choose field classes. - $classes = array( - 'test_field_class', - '[node:nid]', - ); - $edit = array( - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][classes][]' => $classes, - ); - $this->dsEditFormatterSettings($edit, 'body'); - drupal_flush_all_caches(); - - $this->drupalGet('node/' . $node->id()); - $classes = 'test_field_class ' . $node->id() . ' field field-name-body'; - $xpath = $this->xpath('//div[@class="group-right"]/div[@class="' . $classes . '"]'); - $this->assertTrimEqual($xpath[0]->p, $body_field); - } - -} diff --git a/web/modules/ds/src/Tests/HiddenRegionTest.php b/web/modules/ds/src/Tests/HiddenRegionTest.php deleted file mode 100644 index 4ff1686675..0000000000 --- a/web/modules/ds/src/Tests/HiddenRegionTest.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php - -namespace Drupal\ds\Tests; - -/** - * Tests for testing the hidden region option. - * - * @group ds - */ -class HiddenRegionTest extends FastTestBase { - - /** - * Tests hidden region functionality. - */ - public function testHiddenRegion() { - // Enable the hidden region option. - $edit = array( - 'fs3[hidden_region]' => TRUE, - ); - $this->drupalPostForm('admin/structure/ds/settings', $edit, t('Save configuration')); - - $this->dsSelectLayout(); - - // Create a node. - $settings = array('type' => 'article'); - $node = $this->drupalCreateNode($settings); - - // Configure fields. - $fields = array( - 'fields[body][region]' => 'right', - 'fields[test_field][region]' => 'ds_hidden', - ); - $this->dsConfigureUi($fields); - - // Test field not printed. - $this->drupalGet('node/' . $node->id()); - $this->assertNoText('Test field plugin on node ' . $node->id(), 'Test code field not found'); - - // Configure fields. - $fields = array( - 'fields[body][region]' => 'right', - 'fields[test_field][region]' => 'right', - ); - $this->dsConfigureUi($fields); - - // Test field printed. - $this->drupalGet('node/' . $node->id()); - $this->assertText('Test field plugin on node ' . $node->id(), 'Test code field not found'); - } - -} diff --git a/web/modules/ds/src/Tests/LayoutClassesTest.php b/web/modules/ds/src/Tests/LayoutClassesTest.php deleted file mode 100644 index 00e9644c62..0000000000 --- a/web/modules/ds/src/Tests/LayoutClassesTest.php +++ /dev/null @@ -1,224 +0,0 @@ -<?php - -namespace Drupal\ds\Tests; - -use Drupal\Core\Entity\Entity\EntityViewDisplay; - -/** - * Tests for managing layouts and classes on Field UI screen. - * - * @group ds - */ -class LayoutClassesTest extends FastTestBase { - - /** - * {@inheritdoc} - */ - protected function setup() { - parent::setup(); - - // Set extra fields. - \Drupal::configFactory()->getEditable('ds_extras.settings') - ->set('region_to_block', TRUE) - ->set('fields_extra', TRUE) - ->set('fields_extra_list', array('node|article|ds_extras_extra_test_field', 'node|article|ds_extras_second_field')) - ->save(); - - \Drupal::service('entity_field.manager')->clearCachedFieldDefinitions(); - } - - /** - * Test selecting layouts, classes, region to block and fields. - */ - public function testDsTestLayouts() { - // Check that the ds_3col_equal_width layout is not available (through the - // alter). - $this->drupalGet('admin/structure/types/manage/article/display'); - $this->assertNoRaw('ds_3col_stacked_equal_width', 'ds_3col_stacked_equal_width not available'); - - // Create code and block field. - $this->dsCreateTokenField(); - $this->dsCreateBlockField(); - - $layout = array( - 'layout' => 'ds_2col_stacked', - ); - - $assert = array( - 'regions' => array( - 'header' => '<td colspan="8">' . t('Header') . '</td>', - 'left' => '<td colspan="8">' . t('Left') . '</td>', - 'right' => '<td colspan="8">' . t('Right') . '</td>', - 'footer' => '<td colspan="8">' . t('Footer') . '</td>', - ), - ); - - $fields = array( - 'fields[node_post_date][region]' => 'header', - 'fields[node_author][region]' => 'left', - 'fields[node_links][region]' => 'left', - 'fields[body][region]' => 'right', - 'fields[dynamic_token_field:node-test_field][region]' => 'left', - 'fields[dynamic_block_field:node-test_block_field][region]' => 'left', - 'fields[node_submitted_by][region]' => 'left', - 'fields[ds_extras_extra_test_field][region]' => 'header', - ); - - // Setup first layout. - $this->dsSelectLayout($layout, $assert); - $this->dsConfigureClasses(); - $this->dsSelectClasses(); - $this->dsConfigureUi($fields); - - // Assert the two extra fields are found. - $this->drupalGet('admin/structure/types/manage/article/display'); - $this->assertRaw('ds_extras_extra_test_field'); - $this->assertRaw('ds_extras_second_field'); - - // Assert we have configuration. - $entity_display = entity_load('entity_view_display', 'node.article.default'); - $data = $entity_display->getThirdPartySettings('ds'); - - $this->assertTrue(!empty($data), t('Configuration found for layout settings for node article')); - $this->assertTrue(in_array('ds_extras_extra_test_field', $data['regions']['header']), t('Extra field is in header')); - $this->assertTrue(in_array('node_post_date', $data['regions']['header']), t('Post date is in header')); - $this->assertTrue(in_array('dynamic_token_field:node-test_field', $data['regions']['left']), t('Test field is in left')); - $this->assertTrue(in_array('node_author', $data['regions']['left']), t('Author is in left')); - $this->assertTrue(in_array('node_links', $data['regions']['left']), t('Links is in left')); - $this->assertTrue(in_array('dynamic_block_field:node-test_block_field', $data['regions']['left']), t('Test block field is in left')); - $this->assertTrue(in_array('body', $data['regions']['right']), t('Body is in right')); - $this->assertTrue(in_array('class_name_1', $data['layout']['settings']['classes']['header']), t('Class name 1 is in header')); - $this->assertTrue(empty($data['layout']['settings']['classes']['left']), t('Left has no classes')); - $this->assertTrue(empty($data['layout']['settings']['classes']['right']), t('Right has classes')); - $this->assertTrue(in_array('class_name_2', $data['layout']['settings']['classes']['footer']), t('Class name 2 is in header')); - - // Create a article node and verify settings. - $settings = array( - 'type' => 'article', - ); - $node = $this->drupalCreateNode($settings); - $this->drupalGet('node/' . $node->id()); - - // Assert default classes. - $this->assertRaw('node node--type-article node--view-mode-full', 'Default node classes are added'); - - // Assert regions. - $this->assertRaw('group-header', 'Template found (region header)'); - $this->assertRaw('class_name_1 group-header', 'Class found (class_name_1)'); - $this->assertRaw('group-left', 'Template found (region left)'); - $this->assertRaw('group-right', 'Template found (region right)'); - $this->assertRaw('group-footer', 'Template found (region footer)'); - $this->assertRaw('class_name_2 group-footer', 'Class found (class_name_2)'); - - // Assert custom fields. - $this->assertRaw('field--name-dynamic-token-fieldnode-test-field', t('Custom field found')); - $this->assertRaw('field--name-dynamic-block-fieldnode-test-block-field', t('Custom block field found')); - - $this->assertRaw('Submitted by', t('Submitted field found')); - $this->assertText('This is an extra field made available through "Extra fields" functionality.'); - - // Test HTML5 wrappers. - $this->assertNoRaw('<header class="class_name_1 group-header', 'Header not found.'); - $this->assertNoRaw('<footer class="group-right', 'Footer not found.'); - $this->assertNoRaw('<article', 'Article not found.'); - $wrappers = array( - 'layout_configuration[region_wrapper][header]' => 'header', - 'layout_configuration[region_wrapper][right]' => 'footer', - 'layout_configuration[region_wrapper][outer_wrapper]' => 'article', - ); - $this->dsConfigureUi($wrappers); - $this->drupalGet('node/' . $node->id()); - $this->assertRaw('<header class="class_name_1 group-header', 'Header found.'); - $this->assertRaw('<footer class="group-right', 'Footer found.'); - $this->assertRaw('<article', 'Article found.'); - - // Remove all the node classes. - $edit = array('entity_classes' => 'no_classes'); - $this->drupalPostForm('admin/structure/types/manage/article/display', $edit, t('Save')); - $this->drupalGet('node/' . $node->id()); - - // Assert that there are no entity classes. - $this->assertNoRaw('node node--type-article node--view-mode-full', 'Default node classes are not added'); - - // Only show view mode (deprecated). - $edit = array('entity_classes' => 'old_view_mode'); - $this->drupalPostForm('admin/structure/types/manage/article/display', $edit, t('Save')); - $this->drupalGet('node/' . $node->id()); - - // Assert that the old view mode class name is added (deprecated). - $this->assertRaw('view-mode-full', 'Only view mode is printed'); - - // Let's create a block field, enable the full mode first. - $edit = array('display_modes_custom[full]' => '1'); - $this->drupalPostForm('admin/structure/types/manage/article/display', $edit, t('Save')); - - // Select layout. - $layout = array( - 'layout' => 'ds_2col', - ); - - $assert = array( - 'regions' => array( - 'left' => '<td colspan="8">' . t('Left') . '</td>', - 'right' => '<td colspan="8">' . t('Right') . '</td>', - ), - ); - $this->dsSelectLayout($layout, $assert, 'admin/structure/types/manage/article/display/full'); - - // Create new block field. - $edit = array( - 'new_block_region' => 'Block region', - 'new_block_region_key' => 'block_region', - ); - $this->drupalPostForm('admin/structure/types/manage/article/display/full', $edit, t('Save')); - $this->assertRaw('<td colspan="9">' . t('Block region') . '</td>', 'Block region found'); - - // Configure fields. - $fields = array( - 'fields[node_author][region]' => 'left', - 'fields[node_links][region]' => 'left', - 'fields[body][region]' => 'right', - 'fields[dynamic_token_field:node-test_field][region]' => 'block_region', - ); - $this->dsConfigureUi($fields, 'admin/structure/types/manage/article/display/full'); - - // Change layout via admin/structure/ds/layout-change. - // First verify that header and footer are not here. - $this->drupalGet('admin/structure/types/manage/article/display/full'); - $this->assertNoRaw('<td colspan="8">' . t('Header') . '</td>', 'Header region not found'); - $this->assertNoRaw('<td colspan="8">' . t('Footer') . '</td>', 'Footer region not found'); - - // Remap the regions. - $edit = array( - 'ds_left' => 'header', - 'ds_right' => 'footer', - 'ds_block_region' => 'footer', - ); - $this->drupalPostForm('admin/structure/ds/change-layout/node/article/full/ds_2col_stacked', $edit, t('Save')); - $this->drupalGet('admin/structure/types/manage/article/display/full'); - - // Verify new regions. - $this->assertRaw('<td colspan="9">' . t('Header') . '</td>', 'Header region found'); - $this->assertRaw('<td colspan="9">' . t('Footer') . '</td>', 'Footer region found'); - $this->assertRaw('<td colspan="9">' . t('Block region') . '</td>', 'Block region found'); - - // Verify settings. - $entity_display = EntityViewDisplay::load('node.article.full', TRUE); - $data = $entity_display->getThirdPartySettings('ds'); - $this->assertTrue(in_array('node_author', $data['regions']['header']), t('Author is in header')); - $this->assertTrue(in_array('node_links', $data['regions']['header']), t('Links field is in header')); - $this->assertTrue(in_array('body', $data['regions']['footer']), t('Body field is in footer')); - $this->assertTrue(in_array('dynamic_token_field:node-test_field', $data['regions']['footer']), t('Test field is in footer')); - - // Test that a default view mode with no layout is not affected by a - // disabled view mode. - $edit = array( - 'layout' => '', - 'display_modes_custom[full]' => FALSE, - ); - $this->drupalPostForm('admin/structure/types/manage/article/display', $edit, t('Save')); - $this->drupalGet('node/' . $node->id()); - $this->assertNoText('Test code field on node 1', 'No ds field from full view mode layout'); - } - -} diff --git a/web/modules/ds/src/Tests/LayoutFluidTest.php b/web/modules/ds/src/Tests/LayoutFluidTest.php deleted file mode 100644 index bf2cf14020..0000000000 --- a/web/modules/ds/src/Tests/LayoutFluidTest.php +++ /dev/null @@ -1,83 +0,0 @@ -<?php - -namespace Drupal\ds\Tests; - -/** - * Tests DS layout plugins. - * - * @group ds - */ -class LayoutFluidTest extends FastTestBase { - - /** - * Test fluid Display Suite layouts. - */ - public function testFluidLayout() { - // Assert our 2 tests layouts are found. - $this->drupalGet('admin/structure/types/manage/article/display'); - $this->assertRaw('Test Fluid two column', 'Test Fluid two column layout found'); - - $layout = array( - 'layout' => 'dstest_2col_fluid', - ); - - $assert = array( - 'regions' => array( - 'left' => '<td colspan="8">' . t('Left') . '</td>', - 'right' => '<td colspan="8">' . t('Right') . '</td>', - ), - ); - - $fields = array( - 'fields[node_author][region]' => 'left', - 'fields[node_links][region]' => 'left', - 'fields[body][region]' => 'left', - ); - - $this->dsSelectLayout($layout, $assert); - $this->dsConfigureUi($fields); - - // Create a node. - $settings = array('type' => 'article'); - $node = $this->drupalCreateNode($settings); - - $this->drupalGet('node/' . $node->id()); - $this->assertRaw('group-left', 'Template found (region left)'); - $this->assertNoRaw('group-right', 'Empty region right hidden'); - $this->assertRaw('group-one-column', 'Group one column class set'); - $this->assertRaw('dstest-2col-fluid.css', 'Css file included'); - - // Add fields to the right column. - $fields = array( - 'fields[node_author][region]' => 'left', - 'fields[node_links][region]' => 'left', - 'fields[body][region]' => 'right', - ); - - $this->dsSelectLayout($layout, $assert); - $this->dsConfigureUi($fields); - - $this->drupalGet('node/' . $node->id()); - $this->assertRaw('group-left', 'Template found (region left)'); - $this->assertRaw('group-right', 'Template found (region right)'); - $this->assertNoRaw('group-one-column', 'Group one column class not set'); - - // Move all fields to the right column. - $fields = array( - 'fields[node_author][region]' => 'right', - 'fields[node_links][region]' => 'right', - 'fields[heavy_field][region]' => 'right', - 'fields[body][region]' => 'right', - ); - - $this->dsSelectLayout($layout, $assert); - $this->dsConfigureUi($fields); - - $this->drupalGet('node/' . $node->id()); - $this->assertNoRaw('group-left', 'Empty region left hidden'); - $this->assertRaw('group-right', 'Template found (region right)'); - $this->assertRaw('group-one-column', 'Group one column class set'); - - } - -} diff --git a/web/modules/ds/src/Tests/LayoutPluginTest.php b/web/modules/ds/src/Tests/LayoutPluginTest.php deleted file mode 100644 index fdde4b4d78..0000000000 --- a/web/modules/ds/src/Tests/LayoutPluginTest.php +++ /dev/null @@ -1,106 +0,0 @@ -<?php - -namespace Drupal\ds\Tests; - -/** - * Tests DS layout plugins. - * - * @group ds - */ -class LayoutPluginTest extends FastTestBase { - - /** - * Test basic Display Suite layout plugins. - */ - public function testFieldPlugin() { - // Assert our 2 tests layouts are found. - $this->drupalGet('admin/structure/types/manage/article/display'); - $this->assertRaw('Test One column', 'Test One column layout found'); - $this->assertRaw('Test Two column', 'Test Two column layout found'); - - $layout = array( - 'layout' => 'dstest_2col', - ); - - $assert = array( - 'regions' => array( - 'left' => '<td colspan="8">' . t('Left') . '</td>', - 'right' => '<td colspan="8">' . t('Right') . '</td>', - ), - ); - - $fields = array( - 'fields[node_author][region]' => 'left', - 'fields[node_links][region]' => 'left', - 'fields[body][region]' => 'right', - ); - - $this->dsSelectLayout($layout, $assert); - $this->dsConfigureUi($fields); - - // Create a node. - $settings = array('type' => 'article'); - $node = $this->drupalCreateNode($settings); - - $this->drupalGet('node/' . $node->id()); - $this->assertRaw('group-left', 'Template found (region left)'); - $this->assertRaw('group-right', 'Template found (region right)'); - $this->assertRaw('dstest-2col.css', 'Css file included'); - - // Alter a region. - $settings = array( - 'type' => 'article', - 'title' => 'Alter me!', - ); - $node = $this->drupalCreateNode($settings); - $this->drupalGet('node/' . $node->id()); - $this->assertRaw('cool!', 'Region altered'); - } - - /** - * Test reset layout. - */ - public function testResetLayout() { - $layout = array( - 'layout' => 'ds_reset', - ); - - $assert = array( - 'regions' => array( - 'ds_content' => '<td colspan="8">' . t('Content') . '</td>', - ), - ); - - $fields = array( - 'fields[node_author][region]' => 'ds_content', - ); - - $this->dsSelectLayout($layout, $assert); - $this->dsConfigureUi($fields); - - // Create a node. - $settings = array('type' => 'article'); - $node = $this->drupalCreateNode($settings); - - $this->drupalGet('node/' . $node->id()); - } - - /** - * Tests settings default wrappers. - */ - public function testDefaultWrappers() { - // Create a node. - $settings = array('type' => 'article'); - $node = $this->drupalCreateNode($settings); - - // Select a layout. - $this->dsSelectLayout(); - - // Go to the node. - $this->drupalGet('node/' . $node->id()); - - // Check we don't have empty wrappers. - $this->assertNoRaw('<>', 'No empty wrappers found'); - } - -} diff --git a/web/modules/ds/src/Tests/ManageDisplayTabTest.php b/web/modules/ds/src/Tests/ManageDisplayTabTest.php deleted file mode 100644 index caa11063e1..0000000000 --- a/web/modules/ds/src/Tests/ManageDisplayTabTest.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php - -namespace Drupal\ds\Tests; - -/** - * Tests for the manage display tab in Display Suite. - * - * @group ds - */ -class ManageDisplayTabTest extends FastTestBase { - - /** - * Test tabs. - */ - public function testFieldPlugin() { - /* @var \Drupal\node\NodeInterface $node */ - $node = $this->entitiesTestSetup(); - - // Verify we can see the manage display tab on a node and can click on it. - $this->drupalGet('node/' . $node->id()); - $this->assertRaw('Manage display', 'Manage display tab title found on node'); - $this->assertRaw('node/' . $node->id() . '/manage_display', 'Manage display tab link found on node'); - $this->drupalGet('node/' . $node->id() . '/manage_display'); - - // Verify we can see the manage display tab on a user and can click on it. - $this->drupalGet('user/' . $this->adminUser->id()); - $this->assertRaw('Manage display', 'Manage display tab title found on user'); - $this->assertRaw('user/' . $this->adminUser->id() . '/manage_display', 'Manage display tab link found on user'); - $this->drupalGet('user/' . $this->adminUser->id() . '/manage_display'); - - // Verify we can see the manage display tab on a taxonomy term and can click - // on it. - $this->drupalGet('taxonomy/term/1'); - $this->assertRaw('Manage display', 'Manage display,title tab found on term'); - $this->assertRaw('taxonomy/term/1/manage_display', 'Manage display tab link found on term'); - $this->drupalGet('taxonomy/term/1/manage_display'); - } - -} diff --git a/web/modules/ds/src/Tests/RdfTest.php b/web/modules/ds/src/Tests/RdfTest.php deleted file mode 100644 index 013c2cdc3c..0000000000 --- a/web/modules/ds/src/Tests/RdfTest.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php - -namespace Drupal\ds\Tests; - -/** - * Tests for Rdf integration. - * - * @group ds - */ -class RdfTest extends FastTestBase { - - /** - * Modules to install. - * - * @var array - */ - public static $modules = array( - 'node', - 'field_ui', - 'ds', - 'rdf' - ); - - /** - * Test rdf integration. - */ - public function testRdf() { - \Drupal::service('module_installer')->install(array('ds_test_rdf')); - - /* @var \Drupal\node\NodeInterface $node */ - $node = $this->entitiesTestSetup(); - - // Look at node and verify the rdf tags are available - $this->drupalGet('node/' . $node->id()); - $this->assertRaw('typeof="schema:Article', 'RDF tag found on the node wrapper'); - } - -} diff --git a/web/modules/ds/src/Tests/TwigRenderTest.php b/web/modules/ds/src/Tests/TwigRenderTest.php deleted file mode 100644 index 8ac245d5d8..0000000000 --- a/web/modules/ds/src/Tests/TwigRenderTest.php +++ /dev/null @@ -1,53 +0,0 @@ -<?php - -namespace Drupal\ds\Tests; - -/** - * Tests for twig specific functionality. - * - * @group ds - */ -class TwigRenderTest extends FastTestBase { - - /** - * Tests targeting the field in a twig template. - */ - public function testFieldNameTargeting() { - // Create a node. - $settings = array('type' => 'article', 'promote' => 1); - /* @var \Drupal\node\NodeInterface $node */ - $node = $this->drupalCreateNode($settings); - - // Configure layout. - $layout = array( - 'layout' => 'dstest_1col_title', - ); - $layout_assert = array( - 'regions' => array( - 'ds_content' => '<td colspan="8">' . t('Content') . '</td>', - ), - ); - $this->dsSelectLayout($layout, $layout_assert); - - $fields = array( - 'fields[node_title][region]' => 'ds_content', - ); - $this->dsConfigureUi($fields); - - $this->drupalGet('node/' . $node->id()); - - // Assert that the title is visible. - $this->assertText($node->getTitle()); - - $edit = array( - 'fs3[use_field_names]' => FALSE, - ); - $this->drupalPostForm('admin/structure/ds/settings', $edit, t('Save configuration')); - - $this->drupalGet('node/' . $node->id()); - - // Assert that the title is not visible anymore. - $this->assertNoText($node->getTitle()); - } - -} diff --git a/web/modules/ds/src/Tests/ViewsTest.php b/web/modules/ds/src/Tests/ViewsTest.php deleted file mode 100644 index ae377bd761..0000000000 --- a/web/modules/ds/src/Tests/ViewsTest.php +++ /dev/null @@ -1,181 +0,0 @@ -<?php - -namespace Drupal\ds\Tests; - -use Drupal\views\Tests\ViewTestData; -use Drupal\views\ViewExecutable; - -/** - * Tests for Display Suite Views integration. - * - * @group ds - */ -class ViewsTest extends FastTestBase { - - /** - * Modules to install. - * - * @var array - */ - public static $modules = array( - 'node', - 'field_ui', - 'taxonomy', - 'block', - 'ds', - 'ds_test', - 'layout_plugin', - 'views', - 'views_ui', - ); - - /** - * Views used by this test. - * - * @var array - */ - public static $testViews = array('ds-testing'); - - /** - * {@inheritdoc} - */ - protected function setUp() { - parent::setUp(); - - // Ensure that the plugin definitions are cleared. - foreach (ViewExecutable::getPluginTypes() as $plugin_type) { - $this->container->get("plugin.manager.views.$plugin_type")->clearCachedDefinitions(); - } - - ViewTestData::createTestViews(get_class($this), array('ds_test')); - } - - /** - * Test views integration. - */ - public function testDsViews() { - $tag1 = $this->createTerm($this->vocabulary); - $tag2 = $this->createTerm($this->vocabulary); - - $edit_tag_1 = array( - 'field_tags[0][target_id]' => $tag1->getName(), - ); - $edit_tag_2 = array( - 'field_tags[0][target_id]' => $tag2->getName(), - ); - - // Create 3 nodes. - $settings_1 = array( - 'type' => 'article', - 'title' => 'Article 1', - 'created' => REQUEST_TIME, - ); - $node_1 = $this->drupalCreateNode($settings_1); - $this->drupalPostForm('node/' . $node_1->id() . '/edit', $edit_tag_1, t('Save and keep published')); - $settings_2 = array( - 'type' => 'article', - 'title' => 'Article 2', - 'created' => REQUEST_TIME + 3600, - ); - $node_2 = $this->drupalCreateNode($settings_2); - $this->drupalPostForm('node/' . $node_2->id() . '/edit', $edit_tag_1, t('Save and keep published')); - $settings_3 = array( - 'type' => 'article', - 'title' => 'Article 3', - 'created' => REQUEST_TIME + 7200, - ); - $node_3 = $this->drupalCreateNode($settings_3); - $this->drupalPostForm('node/' . $node_3->id() . '/edit', $edit_tag_2, t('Save and keep published')); - - // Configure teaser and full layout. - $layout = array( - 'layout' => 'ds_2col', - ); - $fields = array( - 'fields[node_title][region]' => 'left', - 'fields[body][region]' => 'right', - ); - $assert = array( - 'regions' => array( - 'left' => '<td colspan="8">' . t('Left') . '</td>', - 'right' => '<td colspan="8">' . t('Right') . '</td>', - ), - ); - $this->dsSelectLayout($layout, $assert, 'admin/structure/types/manage/article/display/teaser'); - $this->dsConfigureUi($fields, 'admin/structure/types/manage/article/display/teaser'); - $layout = array( - 'layout' => 'ds_4col', - ); - $fields = array( - 'fields[node_post_date][region]' => 'first', - 'fields[body][region]' => 'second', - 'fields[node_author][region]' => 'third', - 'fields[node_links][region]' => 'fourth', - ); - $assert = array( - 'regions' => array( - 'first' => '<td colspan="8">' . t('First') . '</td>', - 'second' => '<td colspan="8">' . t('Second') . '</td>', - 'third' => '<td colspan="8">' . t('Third') . '</td>', - 'fourth' => '<td colspan="8">' . t('Fourth') . '</td>', - ), - ); - $this->dsSelectLayout($layout, $assert); - $this->dsConfigureUi($fields); - - // Get default teaser view. - $this->drupalGet('ds-testing'); - foreach (array('group-left', 'group-right') as $region) { - $this->assertRaw($region, t('Region @region found', array('@region' => $region))); - } - $this->assertRaw('Article 1'); - $this->assertRaw('Article 2'); - $this->assertRaw('Article 3'); - - // Get alternating view. - $this->drupalGet('ds-testing-2'); - $regions = array( - 'group-left', - 'group-right', - 'first', - 'second', - 'third', - 'fourth', - ); - foreach ($regions as $region) { - $this->assertRaw($region, t('Region @region found', array('@region' => $region))); - } - $this->assertNoRaw('Article 1'); - $this->assertRaw('Article 2'); - $this->assertRaw('Article 3'); - - // Get grouping view (without changing header function). - $this->drupalGet('ds-testing-3'); - foreach (array('group-left', 'group-right') as $region) { - $this->assertRaw($region, t('Region @region found', array('@region' => $region))); - } - $this->assertRaw('Article 1'); - $this->assertRaw('Article 2'); - $this->assertRaw('Article 3'); - $this->assertRaw('<h2 class="grouping-title">' . $tag1->id() . '</h2>'); - $this->assertRaw('<h2 class="grouping-title">' . $tag2->id() . '</h2>'); - - // Get grouping view (with changing header function). - $this->drupalGet('ds-testing-4'); - foreach (array('group-left', 'group-right') as $region) { - $this->assertRaw($region, t('Region @region found', array('@region' => $region))); - } - $this->assertRaw('Article 1'); - $this->assertRaw('Article 2'); - $this->assertRaw('Article 3'); - $this->assertRaw('<h2 class="grouping-title">' . $tag1->getName() . '</h2>'); - $this->assertRaw('<h2 class="grouping-title">' . $tag2->getName() . '</h2>'); - - // Get advanced function view. - $this->drupalGet('ds-testing-5'); - $this->assertRaw('Advanced display for id 1'); - $this->assertRaw('Advanced display for id 2'); - $this->assertRaw('Advanced display for id 3'); - } - -} diff --git a/web/modules/ds/templates/ds-1col-wrapper.html.twig b/web/modules/ds/templates/ds-1col-wrapper.html.twig deleted file mode 100644 index 9396964d11..0000000000 --- a/web/modules/ds/templates/ds-1col-wrapper.html.twig +++ /dev/null @@ -1,22 +0,0 @@ -{# -/** - * @file - * Display Suite 1 column wrapper template. - * - * Available variables: - * - outer_wrapper: outer wrapper element - * - ds_content_wrapper: wrapper around content - * - attributes: outer wrapper attributes - * - ds_content_attributes: attributes for ds_content region - * - ds_content: content of ds_content region - */ -#} -<{{ outer_wrapper }}{{ attributes.addClass('ds-1col', 'clearfix') }}> - - {{ title_suffix.contextual_links }} - - <{{ ds_content_wrapper }}{{ ds_content_attributes }}> - {{ ds_content }} - </{{ ds_content_wrapper }}> - -</{{ outer_wrapper }}> diff --git a/web/modules/ds/templates/ds-1col.html.twig b/web/modules/ds/templates/ds-1col.html.twig deleted file mode 100644 index 5dcdfb4f70..0000000000 --- a/web/modules/ds/templates/ds-1col.html.twig +++ /dev/null @@ -1,18 +0,0 @@ -{# -/** - * @file - * Display Suite 1 column template. - * - * Available variables: - * - ds_content_wrapper: wrapper around content - * - attributes: content region attributes - * - ds_content: content region - */ -#} -<{{ ds_content_wrapper }}{{ attributes.addClass('ds-1col', 'clearfix') }}> - - {{ title_suffix.contextual_links }} - - {{ ds_content }} - -</{{ ds_content_wrapper }}> diff --git a/web/modules/ds/templates/ds-2col-fluid.html.twig b/web/modules/ds/templates/ds-2col-fluid.html.twig deleted file mode 100644 index 4b6491059b..0000000000 --- a/web/modules/ds/templates/ds-2col-fluid.html.twig +++ /dev/null @@ -1,41 +0,0 @@ -{# -/** - * @file - * Display Suite fluid 2 column template. - * - * Available variables: - * - outer_wrapper: outer wrapper element - * - left_wrapper: wrapper element around left region - * - right_wrapper: wrapper element around right region - * - attributes: layout attributes - * - left_attributes: attributes for left region - * - right_attributes: attributes for right region - * - left: content of left region - * - right: content of right region - */ -#} - -{% set left = left|render %} -{% set right = right|render %} - -{% if (left and not right) or (right and not left) %} - {% set layout_class = 'group-one-column' %} -{% endif %} - -<{{ outer_wrapper }}{{ attributes.addClass(layout_class, 'ds-2col-fluid', 'clearfix') }}> - - {{ title_suffix.contextual_links }} - - {% if left %} - <{{ left_wrapper }}{{ left_attributes.addClass('group-left') }}> - {{ left }} - </{{ left_wrapper }}> - {% endif %} - - {% if right %} - <{{ right_wrapper }}{{ right_attributes.addClass('group-right') }}> - {{ right }} - </{{ right_wrapper }}> - {% endif %} - -</{{ outer_wrapper }}> diff --git a/web/modules/ds/templates/ds-2col-stacked-fluid.html.twig b/web/modules/ds/templates/ds-2col-stacked-fluid.html.twig deleted file mode 100644 index 645f3cfd34..0000000000 --- a/web/modules/ds/templates/ds-2col-stacked-fluid.html.twig +++ /dev/null @@ -1,55 +0,0 @@ -{# -/** - * @file - * Display Suite fluid 2 column stacked template. - * - * Available variables: - * - outer_wrapper: outer wrapper element - * - header_wrapper: wrapper element around header region - * - left_wrapper: wrapper element around left region - * - right_wrapper: wrapper element around right region - * - footer_wrapper: wrapper element around footer region - * - attributes: layout attributes - * - header_attributes: attributes for header region - * - left_attributes: attributes for left region - * - right_attributes: attributes for right region - * - footer_attributes: attributes for footer region - * - header: content of header region - * - left: content of left region - * - right: content of right region - * - footer: content of footer region - */ -#} - -{% set left = left|render %} -{% set right = right|render %} - -{% if (left and not right) or (right and not left) %} - {% set layout_class = 'group-one-column' %} -{% endif %} - -<{{ outer_wrapper }}{{ attributes.addClass(layout_class, 'ds-2col-stacked-fluid', 'clearfix') }}> - - {{ title_suffix.contextual_links }} - - <{{ header_wrapper }}{{ header_attributes.addClass('group-header') }}> - {{ header }} - </{{ header_wrapper }}> - - {% if left %} - <{{ left_wrapper }}{{ left_attributes.addClass('group-left') }}> - {{ left }} - </{{ left_wrapper }}> - {% endif %} - - {% if right %} - <{{ right_wrapper }}{{ right_attributes.addClass('group-right') }}> - {{ right }} - </{{ right_wrapper }}> - {% endif %} - - <{{ footer_wrapper }}{{ footer_attributes.addClass('group-footer') }}> - {{ footer }} - </{{ footer_wrapper }}> - -</{{ outer_wrapper }}> diff --git a/web/modules/ds/templates/ds-2col-stacked.html.twig b/web/modules/ds/templates/ds-2col-stacked.html.twig deleted file mode 100644 index 6c1fc8976b..0000000000 --- a/web/modules/ds/templates/ds-2col-stacked.html.twig +++ /dev/null @@ -1,43 +0,0 @@ -{# -/** - * @file - * Display Suite 2 column stacked template. - * - * Available variables: - * - outer_wrapper: outer wrapper element - * - header_wrapper: wrapper element around header region - * - left_wrapper: wrapper element around left region - * - right_wrapper: wrapper element around right region - * - footer_wrapper: wrapper element around footer region - * - attributes: layout attributes - * - header_attributes: attributes for header region - * - left_attributes: attributes for left region - * - right_attributes: attributes for right region - * - footer_attributes: attributes for footer region - * - header: content of header region - * - left: content of left region - * - right: content of right region - * - footer: content of footer region - */ -#} -<{{ outer_wrapper }}{{ attributes.addClass('ds-2col-stacked', 'clearfix') }}> - - {{ title_suffix.contextual_links }} - - <{{ header_wrapper }}{{ header_attributes.addClass('group-header') }}> - {{ header }} - </{{ header_wrapper }}> - - <{{ left_wrapper }}{{ left_attributes.addClass('group-left') }}> - {{ left }} - </{{ left_wrapper }}> - - <{{ right_wrapper }}{{ right_attributes.addClass('group-right') }}> - {{ right }} - </{{ right_wrapper }}> - - <{{ footer_wrapper }}{{ footer_attributes.addClass('group-footer') }}> - {{ footer }} - </{{ footer_wrapper }}> - -</{{ outer_wrapper }}> diff --git a/web/modules/ds/templates/ds-2col.html.twig b/web/modules/ds/templates/ds-2col.html.twig deleted file mode 100644 index 103e3b172b..0000000000 --- a/web/modules/ds/templates/ds-2col.html.twig +++ /dev/null @@ -1,29 +0,0 @@ -{# -/** - * @file - * Display Suite 2 column template. - * - * Available variables: - * - outer_wrapper: outer wrapper element - * - left_wrapper: wrapper element around left region - * - right_wrapper: wrapper element around right region - * - attributes: layout attributes - * - left_attributes: attributes for left region - * - right_attributes: attributes for right region - * - left: content of left region - * - right: content of right region - */ -#} -<{{ outer_wrapper }}{{ attributes.addClass('ds-2col', 'clearfix') }}> - - {{ title_suffix.contextual_links }} - - <{{ left_wrapper }}{{ left_attributes.addClass('group-left') }}> - {{ left }} - </{{ left_wrapper }}> - - <{{ right_wrapper }}{{ right_attributes.addClass('group-right') }}> - {{ right }} - </{{ right_wrapper }}> - -</{{ outer_wrapper }}> diff --git a/web/modules/ds/templates/ds-3col-equal-width.html.twig b/web/modules/ds/templates/ds-3col-equal-width.html.twig deleted file mode 100644 index 5543ba55d7..0000000000 --- a/web/modules/ds/templates/ds-3col-equal-width.html.twig +++ /dev/null @@ -1,36 +0,0 @@ -{# -/** - * @file - * Display Suite 3 column template. - * - * Available variables: - * - outer_wrapper: outer wrapper element - * - left_wrapper: wrapper element around left region - * - middle_wrapper: wrapper element around middle region - * - right_wrapper: wrapper element around right region - * - attributes: layout attributes - * - left_attributes: attributes for left region - * - middle_attributes: attributes for middle region - * - right_attributes: attributes for right region - * - left: content of left region - * - middle: content of middle region - * - right: content of right region - */ -#} -<{{ outer_wrapper }}{{ attributes.addClass('ds-3col-equal', 'clearfix') }}> - - {{ title_suffix.contextual_links }} - - <{{ left_wrapper }}{{ left_attributes.addClass('group-left') }}> - {{ left }} - </{{ left_wrapper }}> - - <{{ middle_wrapper }}{{ middle_attributes.addClass('group-middle') }}> - {{ middle }} - </{{ middle_wrapper }}> - - <{{ right_wrapper }}{{ right_attributes.addClass('group-right') }}> - {{ right }} - </{{ right_wrapper }}> - -</{{ outer_wrapper }}> diff --git a/web/modules/ds/templates/ds-3col-stacked-equal-width.html.twig b/web/modules/ds/templates/ds-3col-stacked-equal-width.html.twig deleted file mode 100644 index 0b6960ebe7..0000000000 --- a/web/modules/ds/templates/ds-3col-stacked-equal-width.html.twig +++ /dev/null @@ -1,50 +0,0 @@ -{# -/** - * @file - * Display Suite 3 column stacked template. - * - * Available variables: - * - outer_wrapper: outer wrapper element - * - header_wrapper: wrapper element around header region - * - left_wrapper: wrapper element around left region - * - middle_wrapper: wrapper element around middle region - * - right_wrapper: wrapper element around right region - * - footer_wrapper: wrapper element around footer region - * - attributes: layout attributes - * - header_attributes: attributes for header region - * - left_attributes: attributes for left region - * - middle_attributes: attributes for middle region - * - right_attributes: attributes for right region - * - footer_attributes: attributes for footer region - * - header: content of header region - * - left: content of left region - * - middle: content of middle region - * - right: content of right region - * - footer: content of footer region - */ -#} -<{{ outer_wrapper }}{{ attributes.addClass('ds-3col-stacked-equal', 'clearfix') }}> - - {{ title_suffix.contextual_links }} - - <{{ header_wrapper }}{{ header_attributes.addClass('group-header') }}> - {{ header }} - </{{ header_wrapper }}> - - <{{ left_wrapper }}{{ left_attributes.addClass('group-left') }}> - {{ left }} - </{{ left_wrapper }}> - - <{{ middle_wrapper }}{{ middle_attributes.addClass('group-middle') }}> - {{ middle }} - </{{ middle_wrapper }}> - - <{{ right_wrapper }}{{ right_attributes.addClass('group-right') }}> - {{ right }} - </{{ right_wrapper }}> - - <{{ footer_wrapper }}{{ footer_attributes.addClass('group-footer') }}> - {{ footer }} - </{{ footer_wrapper }}> - -</{{ outer_wrapper }}> diff --git a/web/modules/ds/templates/ds-3col-stacked-fluid.html.twig b/web/modules/ds/templates/ds-3col-stacked-fluid.html.twig deleted file mode 100644 index 2baa5e7865..0000000000 --- a/web/modules/ds/templates/ds-3col-stacked-fluid.html.twig +++ /dev/null @@ -1,71 +0,0 @@ -{# -/** - * @file - * Display Suite 3 column stacked template. - * - * Available variables: - * - outer_wrapper: outer wrapper element - * - header_wrapper: wrapper element around header region - * - left_wrapper: wrapper element around left region - * - middle_wrapper: wrapper element around middle region - * - right_wrapper: wrapper element around right region - * - footer_wrapper: wrapper element around footer region - * - attributes: layout attributes - * - header_attributes: attributes for header region - * - left_attributes: attributes for left region - * - middle_attributes: attributes for middle region - * - right_attributes: attributes for right region - * - footer_attributes: attributes for footer region - * - header: content of header region - * - left: content of left region - * - middle: content of middle region - * - right: content of right region - * - footer: content of footer region - */ -#} - -{% set left = left|render %} -{% set middle = middle|render %} -{% set right = right|render %} - -{% if (left and not right) or (right and not left) %} - {% set layout_class = 'group-one-sidebar' %} -{% elseif (left and right) %} - {% set layout_class = 'group-two-sidebars' %} -{% elseif (left) %} - {% set layout_class = 'group-sidebar-left' %} -{% elseif (right) %} - {% set layout_class = 'group-sidebar-right' %} -{% endif %} - -<{{ outer_wrapper }}{{ attributes.addClass(layout_class, 'ds-3col-stacked-fluid', 'clearfix') }}> - - {{ title_suffix.contextual_links }} - - <{{ header_wrapper }}{{ header_attributes.addClass('group-header') }}> - {{ header }} - </{{ header_wrapper }}> - - {% if left %} - <{{ left_wrapper }}{{ left_attributes.addClass('group-left') }}> - {{ left }} - </{{ left_wrapper }}> - {% endif %} - - {% if middle %} - <{{ middle_wrapper }}{{ middle_attributes.addClass('group-middle') }}> - {{ middle }} - </{{ middle_wrapper }}> - {% endif %} - - {% if right %} - <{{ right_wrapper }}{{ right_attributes.addClass('group-right') }}> - {{ right }} - </{{ right_wrapper }}> - {% endif %} - - <{{ footer_wrapper }}{{ footer_attributes.addClass('group-footer') }}> - {{ footer }} - </{{ footer_wrapper }}> - -</{{ outer_wrapper }}> diff --git a/web/modules/ds/templates/ds-3col-stacked.html.twig b/web/modules/ds/templates/ds-3col-stacked.html.twig deleted file mode 100644 index 396f9bd504..0000000000 --- a/web/modules/ds/templates/ds-3col-stacked.html.twig +++ /dev/null @@ -1,50 +0,0 @@ -{# -/** - * @file - * Display Suite 3 column stacked template. - * - * Available variables: - * - outer_wrapper: outer wrapper element - * - header_wrapper: wrapper element around header region - * - left_wrapper: wrapper element around left region - * - middle_wrapper: wrapper element around middle region - * - right_wrapper: wrapper element around right region - * - footer_wrapper: wrapper element around footer region - * - attributes: layout attributes - * - header_attributes: attributes for header region - * - left_attributes: attributes for left region - * - middle_attributes: attributes for middle region - * - right_attributes: attributes for right region - * - footer_attributes: attributes for footer region - * - header: content of header region - * - left: content of left region - * - middle: content of middle region - * - right: content of right region - * - footer: content of footer region - */ -#} -<{{ outer_wrapper }}{{ attributes.addClass('ds-3col-stacked', 'clearfix') }}> - - {{ title_suffix.contextual_links }} - - <{{ header_wrapper }}{{ header_attributes.addClass('group-header') }}> - {{ header }} - </{{ header_wrapper }}> - - <{{ left_wrapper }}{{ left_attributes.addClass('group-left') }}> - {{ left }} - </{{ left_wrapper }}> - - <{{ middle_wrapper }}{{ middle_attributes.addClass('group-middle') }}> - {{ middle }} - </{{ middle_wrapper }}> - - <{{ right_wrapper }}{{ right_attributes.addClass('group-right') }}> - {{ right }} - </{{ right_wrapper }}> - - <{{ footer_wrapper }}{{ footer_attributes.addClass('group-footer') }}> - {{ footer }} - </{{ footer_wrapper }}> - -</{{ outer_wrapper }}> diff --git a/web/modules/ds/templates/ds-3col.html.twig b/web/modules/ds/templates/ds-3col.html.twig deleted file mode 100644 index 5c81770511..0000000000 --- a/web/modules/ds/templates/ds-3col.html.twig +++ /dev/null @@ -1,36 +0,0 @@ -{# -/** - * @file - * Display Suite 3 column template. - * - * Available variables: - * - outer_wrapper: outer wrapper element - * - left_wrapper: wrapper element around left region - * - middle_wrapper: wrapper element around middle region - * - right_wrapper: wrapper element around right region - * - attributes: layout attributes - * - left_attributes: attributes for left region - * - middle_attributes: attributes for middle region - * - right_attributes: attributes for right region - * - left: content of left region - * - middle: content of middle region - * - right: content of right region - */ -#} -<{{ outer_wrapper }}{{ attributes.addClass('ds-3col', 'clearfix') }}> - - {{ title_suffix.contextual_links }} - - <{{ left_wrapper }}{{ left_attributes.addClass('group-left') }}> - {{ left }} - </{{ left_wrapper }}> - - <{{ middle_wrapper }}{{ middle_attributes.addClass('group-middle') }}> - {{ middle }} - </{{ middle_wrapper }}> - - <{{ right_wrapper }}{{ right_attributes.addClass('group-right') }}> - {{ right }} - </{{ right_wrapper }}> - -</{{ outer_wrapper }}> diff --git a/web/modules/ds/templates/ds-4col.html.twig b/web/modules/ds/templates/ds-4col.html.twig deleted file mode 100644 index d22bda2b14..0000000000 --- a/web/modules/ds/templates/ds-4col.html.twig +++ /dev/null @@ -1,43 +0,0 @@ -{# -/** - * @file - * Display Suite 4 column template. - * - * Available variables: - * - outer_wrapper: outer wrapper element - * - first_wrapper: wrapper element around first region - * - second_wrapper: wrapper element around second region - * - third_wrapper: wrapper element around third region - * - fourth_wrapper: wrapper element around fourth region - * - attributes: layout attributes - * - first_attributes: attributes for first region - * - second_attributes: attributes for second region - * - third_attributes: attributes for third region - * - fourth_attributes: attributes for fourth region - * - first: content of first region - * - second: content of second region - * - third: content of third region - * - fourth: content of fourth region - */ -#} -<{{ outer_wrapper }}{{ attributes.addClass('ds-4col', 'clearfix') }}> - - {{ title_suffix.contextual_links }} - - <{{ first_wrapper }}{{ first_attributes.addClass('group-first') }}> - {{ first }} - </{{ first_wrapper }}> - - <{{ second_wrapper }}{{ second_attributes.addClass('group-second') }}> - {{ second }} - </{{ second_wrapper }}> - - <{{ third_wrapper }}{{ third_attributes.addClass('group-third') }}> - {{ third }} - </{{ third_wrapper }}> - - <{{ fourth_wrapper }}{{ fourth_attributes.addClass('group-fourth') }}> - {{ fourth }} - </{{ fourth_wrapper }}> - -</{{ outer_wrapper }}> diff --git a/web/modules/ds/templates/ds-entity-view.html.twig b/web/modules/ds/templates/ds-entity-view.html.twig deleted file mode 100644 index e4947a7a0e..0000000000 --- a/web/modules/ds/templates/ds-entity-view.html.twig +++ /dev/null @@ -1,10 +0,0 @@ -{# -/** - * @file - * Display Entity View - * - * Available variables: - * - content: The render array which contains the layout - */ -#} -{{ content }} diff --git a/web/modules/ds/templates/ds-field-expert.html.twig b/web/modules/ds/templates/ds-field-expert.html.twig deleted file mode 100644 index b2561df173..0000000000 --- a/web/modules/ds/templates/ds-field-expert.html.twig +++ /dev/null @@ -1,75 +0,0 @@ -{# -/** - * @file - * Template to provide expert HTML for the field. - * - * Available variables: - * - element: The field element. - * - label: The label of the field. - * - settings: The settings for the field. - * - items: List of all the field items. Each item contains: - * - attributes: List of HTML attributes for each item. - * - content: The field item's content. - */ -#} - -{{- settings['prefix']|raw -}} -{% if settings.ow %} - {% if settings['ow-def-at'] %} - <{{ settings['ow-el'] }} {{ wrapper_attributes.mergeAttributes(attributes) }}> - {% elseif settings['ow-def-cl'] %} - <{{ settings['ow-el'] }} {{ wrapper_attributes.mergeAttributes(attribute_classes.offsetGet('class')) }}> - {% else %} - <{{ settings['ow-el'] }} {{ wrapper_attributes }}> - {% endif %} - {{ _self.field(items, settings, label, content_attributes, field_item_wrapper_attributes, field_wrapper_attributes, label_attributes, label_hidden, element) }} - </{{ settings['ow-el'] }}> -{% else %} - {{ _self.field(items, settings, label, content_attributes, field_item_wrapper_attributes, field_wrapper_attributes, label_attributes, label_hidden, element) }} -{% endif %} -{{- settings['suffix']|raw -}} - -{% macro field(items, settings, label, content_attributes, field_item_wrapper_attributes, field_wrapper_attributes, label_attributes, label_hidden, element) %} - {% if not label_hidden %} - {% - set title_classes = [ - 'field-label-' ~ element['#label_display']|clean_class, - ] - %} - {%- if settings['lbw-def-at'] -%} - <{{ settings['lbw-el']|default('div') }} {{ label_attributes.addClass(title_classes).mergeAttributes(title_attributes) }}> - {%- else -%} - <{{ settings['lbw-el']|default('div') }} {{ label_attributes.addClass(title_classes) }}> - {%- endif -%} - {{- label -}}{%- if settings['lb-col'] -%}:{%- endif -%} - </{{ settings['lbw-el']|default('div') }}> - {% endif %} - - {% if settings.fis %} - {% if settings['fis-def-at'] %} - <{{ settings['fis-el'] }} {{ field_wrapper_attributes.mergeAttributes(content_attributes) }}> - {% else %} - <{{ settings['fis-el'] }} {{ field_wrapper_attributes }}> - {% endif %} - {{ _self.content(items, settings, field_item_wrapper_attributes, content_attributes) }} - </{{ settings['fis-el'] }}> - {% else %} - {{ _self.content(items, settings, field_item_wrapper_attributes) }} - {% endif %} -{% endmacro %} - -{% macro content(items, settings, field_item_wrapper_attributes, content_attributes) %} - {% for item in items %} - {% if settings.fi %} - {% if settings['fi-def-at'] %} - <{{ settings['fi-el'] }} {{ field_item_wrapper_attributes.mergeAttributes(item.attributes) }} > - {% else %} - <{{ settings['fi-el'] }} {{ field_item_wrapper_attributes }} > - {% endif %} - {{- item.content -}} - </{{ settings['fi-el'] }}> - {% else %} - {{ item.content }} - {% endif %} - {% endfor %} -{% endmacro %} diff --git a/web/modules/ds/templates/ds-field-minimal.html.twig b/web/modules/ds/templates/ds-field-minimal.html.twig deleted file mode 100644 index edaac4e797..0000000000 --- a/web/modules/ds/templates/ds-field-minimal.html.twig +++ /dev/null @@ -1,31 +0,0 @@ -{# -/** - * @file - * Template to provide minimal HTML for the field. - * - * Available variables: - * - element: The field element. - * - label: The label of the field. - * - settings: The settings for the field. - * - items: List of all the field items. Each item contains: - * - attributes: List of HTML attributes for each item. - * - content: The field item's content. - */ -#} -{% - set classes = [ - 'field', - 'field-name-' ~ element['#field_name']|clean_class, - ] -%} -<div{{ attributes.addClass(classes) }}> - {% if not label_hidden %} - <div class="field-label-{{ element['#label_display']|clean_class }}"> - {{- label }}{% if settings['lb-col'] %}:{% endif -%} - </div> - {% endif %} - - {% for item in items %} - {{ item.content }} - {% endfor %} -</div> diff --git a/web/modules/ds/templates/ds-field-reset.html.twig b/web/modules/ds/templates/ds-field-reset.html.twig deleted file mode 100644 index 131187ebe2..0000000000 --- a/web/modules/ds/templates/ds-field-reset.html.twig +++ /dev/null @@ -1,23 +0,0 @@ -{# -/** - * @file - * Template to reset all HTML for the field. - * - * Available variables: - * - element: The field element. - * - label: The label of the field. - * - show_colon: TRUE if colon should be displayed after label. - * - items: List of all the field items. Each item contains: - * - attributes: List of HTML attributes for each item. - * - content: The field item's content. - */ -#} -{% if not label_hidden %} - <div class="field-label-{{ element['#label_display']|clean_class }}"> - {{- label }}{% if show_colon %}:{% endif -%} - </div> -{% endif %} - -{% for item in items %} - {{ item.content }} -{% endfor %} diff --git a/web/modules/ds/templates/ds-reset.html.twig b/web/modules/ds/templates/ds-reset.html.twig deleted file mode 100644 index 20fadbec66..0000000000 --- a/web/modules/ds/templates/ds-reset.html.twig +++ /dev/null @@ -1,10 +0,0 @@ -{# -/** - * @file - * Display Suite reset template. - * - * Available variables: - * - ds_content: content of the ds_content region - */ -#} -{{ ds_content }} diff --git a/web/modules/ds/tests/modules/ds_exportables_test/config/install/core.entity_view_display.node.article.default.yml b/web/modules/ds/tests/modules/ds_exportables_test/config/install/core.entity_view_display.node.article.default.yml deleted file mode 100644 index 6b1649c72c..0000000000 --- a/web/modules/ds/tests/modules/ds_exportables_test/config/install/core.entity_view_display.node.article.default.yml +++ /dev/null @@ -1,77 +0,0 @@ -uuid: 0cebf2c5-3006-4201-9209-9d36f0b2a6c1 -langcode: en -status: true -dependencies: - config: - - field.field.node.article.body - - field.field.node.article.field_tags - - node.type.article - module: - - ds - - text - - user -third_party_settings: - ds: - layout: - id: ds_2col - library: ds/layout.2col - disable_css: FALSE - entity_classes: all_classes - settings: - classes: { } - wrappers: - left: div - right: div - outer_wrapper: div - attributes: '' - link_attribute: '' - link_custom: '' - regions: - left: - - node_title - - body - - node_link - fields: - node_link: - plugin_id: node_link - weight: 2 - label: hidden - formatter: default - node_title: - plugin_id: node_title - weight: 0 - label: hidden - formatter: default - settings: - link: true - wrapper: h3 - class: '' - ft: - id: default - settings: - lb: '' - lb-col: false - classes: - - '' -id: node.article.default -targetEntityType: node -bundle: article -mode: default -content: - body: - type: text_default - weight: 1 - settings: { } - third_party_settings: - ds: - ft: - id: default - settings: - lb: '' - lb-col: false - classes: - - '' - label: hidden -hidden: - field_tags: true - links: true diff --git a/web/modules/ds/tests/modules/ds_exportables_test/config/install/ds.field.exportable_field.yml b/web/modules/ds/tests/modules/ds_exportables_test/config/install/ds.field.exportable_field.yml deleted file mode 100644 index bed29421a7..0000000000 --- a/web/modules/ds/tests/modules/ds_exportables_test/config/install/ds.field.exportable_field.yml +++ /dev/null @@ -1,11 +0,0 @@ -id: exportable_field -label: 'Exportable field' -ui_limit: '' -properties: - content: - value: 'This is an exportable field' - format: plain_text -type: token -type_label: 'Token field' -entities: - node: node diff --git a/web/modules/ds/tests/modules/ds_exportables_test/ds_exportables_test.info.yml b/web/modules/ds/tests/modules/ds_exportables_test/ds_exportables_test.info.yml deleted file mode 100644 index 5e86e61609..0000000000 --- a/web/modules/ds/tests/modules/ds_exportables_test/ds_exportables_test.info.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: 'Display Suite exportables test' -description: 'Tests for exportables with Display Suite.' -type: module -package: 'Display Suite' -# core: 8.x -hidden: TRUE - -# Information added by Drupal.org packaging script on 2017-05-24 -version: '8.x-3.1' -core: '8.x' -project: 'ds' -datestamp: 1495660091 diff --git a/web/modules/ds/tests/modules/ds_test/config/schema/ds_test.schema.yml b/web/modules/ds/tests/modules/ds_test/config/schema/ds_test.schema.yml deleted file mode 100644 index 48d7966eaf..0000000000 --- a/web/modules/ds/tests/modules/ds_test/config/schema/ds_test.schema.yml +++ /dev/null @@ -1,16 +0,0 @@ -ds.field_template.ds_test_template: - type: config_object - label: 'The settings of the ds_test_theming_function field template' - mapping: - lb: - type: string - label: 'The label of the field' - lb-col: - type: boolean - label: 'Enable the label colon' - classes: - type: sequence - label: 'Classes for the template' - sequence: - - type: string - label: 'Class name' diff --git a/web/modules/ds/tests/modules/ds_test/css/dstest-2col-fluid.css b/web/modules/ds/tests/modules/ds_test/css/dstest-2col-fluid.css deleted file mode 100644 index daba4a68e2..0000000000 --- a/web/modules/ds/tests/modules/ds_test/css/dstest-2col-fluid.css +++ /dev/null @@ -1,9 +0,0 @@ -.group-left { - float: left; - width: 50%; -} - -.group-right { - float: left; - width: 50%; -} diff --git a/web/modules/ds/tests/modules/ds_test/css/dstest-2col.css b/web/modules/ds/tests/modules/ds_test/css/dstest-2col.css deleted file mode 100644 index daba4a68e2..0000000000 --- a/web/modules/ds/tests/modules/ds_test/css/dstest-2col.css +++ /dev/null @@ -1,9 +0,0 @@ -.group-left { - float: left; - width: 50%; -} - -.group-right { - float: left; - width: 50%; -} diff --git a/web/modules/ds/tests/modules/ds_test/ds_test.info.yml b/web/modules/ds/tests/modules/ds_test/ds_test.info.yml deleted file mode 100644 index 6b24e16946..0000000000 --- a/web/modules/ds/tests/modules/ds_test/ds_test.info.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: 'Display Suite Test' -description: 'Test module for Display Suite' -# core: 8.x -package: 'Display Suite' -type: module -dependencies: - - ds_extras - -# Information added by Drupal.org packaging script on 2017-05-24 -version: '8.x-3.1' -core: '8.x' -project: 'ds' -datestamp: 1495660091 diff --git a/web/modules/ds/tests/modules/ds_test/ds_test.layouts.yml b/web/modules/ds/tests/modules/ds_test/ds_test.layouts.yml deleted file mode 100644 index 9e3133d3c1..0000000000 --- a/web/modules/ds/tests/modules/ds_test/ds_test.layouts.yml +++ /dev/null @@ -1,42 +0,0 @@ -dstest_1col: - label: Test One column - category: Display Suite - class: '\Drupal\ds\Plugin\DsLayout' - type: partial - template: templates/dstest-1col - regions: - ds_content: - label: Content -dstest_1col_title: - label: Test one column only title - category: Display Suite - class: '\Drupal\ds\Plugin\DsLayout' - type: partial - template: templates/dstest-1col-title - regions: - ds_content: - label: Content -dstest_2col: - label: Test Two column - category: Display Suite - class: '\Drupal\ds\Plugin\DsLayout' - type: partial - template: templates/dstest-2col - library: ds_test/dstest_2col - regions: - left: - label: Left - right: - label: Right -dstest_2col_fluid: - label: Test Fluid two column - category: Display Suite - class: '\Drupal\ds\Plugin\DsLayout' - type: partial - template: templates/dstest-2col-fluid - library: ds_test/dstest_2col_fluid - regions: - left: - label: Left - right: - label: Right diff --git a/web/modules/ds/tests/modules/ds_test/ds_test.libraries.yml b/web/modules/ds/tests/modules/ds_test/ds_test.libraries.yml deleted file mode 100644 index 8f79e53e4d..0000000000 --- a/web/modules/ds/tests/modules/ds_test/ds_test.libraries.yml +++ /dev/null @@ -1,11 +0,0 @@ -dstest_2col: - version: VERSION - css: - theme: - css/dstest-2col.css: {} - -dstest_2col_fluid: - version: VERSION - css: - theme: - css/dstest-2col-fluid.css: {} diff --git a/web/modules/ds/tests/modules/ds_test/ds_test.module b/web/modules/ds/tests/modules/ds_test/ds_test.module deleted file mode 100644 index ea567ae18e..0000000000 --- a/web/modules/ds/tests/modules/ds_test/ds_test.module +++ /dev/null @@ -1,121 +0,0 @@ -<?php - -/** - * @file - * Display Suite test module. - */ - -use Drupal\Core\Entity\Display\EntityViewDisplayInterface; -use Drupal\Core\Entity\EntityInterface; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Render\Element; - -/** - * Implements hook_theme_suggestions_alter(). - */ -function ds_test_theme_suggestions_alter(&$suggestions, $variables, $base_theme_hook) { - if (isset($variables['content']) && is_array($variables['content']) && isset($variables['content']['#ds_configuration']) && $base_theme_hook != 'ds_entity_view') { - if (isset($_GET['store_suggestions'])) { - \Drupal::cache()->set('ds_test_suggestions', $suggestions); - } - } -} - -/** - * Helper function to return the tag name basid on tid. - */ -function ds_test_get_tag_name($raw_value, $object) { - $entity_manager = \Drupal::entityTypeManager(); - $term = $entity_manager->getStorage('taxonomy_term')->load($raw_value); - return $term->name->value; -} - -/** - * Helper function to return advanced view mode. - */ -function ds_test_ds_views_row_render_entity($entity, $view_mode) { - return 'Advanced display for id ' . $entity->id(); -} - -/** - * Implements hook_entity_extra_field_info(). - */ -function ds_test_entity_extra_field_info() { - $extra = []; - - // Register a single field to test that - // extra fields in the hidden region are really hidden. - $extra['node']['article']['display']['heavy_field'] = [ - 'label' => t('Heavy extra test field'), - 'weight' => 10, - ]; - - return $extra; -} - -/** - * Implements hook_entity_view(). - */ -function ds_test_entity_view(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display, $view_mode) { - $build['ds_extras_extra_test_field'] = [ - '#markup' => 'This is an extra field made available through "Extra fields" functionality.', - '#weight' => 10, - ]; - - // Check whether the heavy extra field is rendered or not. - if ($entity->getEntityTypeId() == 'node' && $entity->bundle() == 'article') { - $heavy_field = $display->getComponent('heavy_field'); - if ($heavy_field) { - $build['heavy_field'] = [ - '#markup' => 'Heavy field', - '#weight' => $heavy_field['weight'], - ]; - } - } -} - -/** - * Implements hook_layout_alter(). - */ -function ds_test_layout_alter(&$layouts) { - unset($layouts['ds_3col_stacked_equal_width']); -} - -/** - * Implements hook_ds_fields_info_alter(). - */ -function ds_test_ds_fields_info_alter(&$definitions) { - if (isset($definitions['test_field_2'])) { - $definitions['test_field_2']['title'] = 'Field altered'; - } -} - -/** - * Implements hook_form_FORM_ID_alter(). - */ -function ds_test_form_entity_view_display_edit_form_alter(&$form, FormStateInterface $form_state) { - foreach (Element::children($form['fields']) as $key) { - if (isset($form['fields'][$key]['settings_edit'])) { - $settings = $form['fields'][$key]['settings_edit']; - if (!empty($settings)) { - $form['fields'][$key]['settings_edit']['#type'] = 'submit'; - $form['fields'][$key]['settings_edit']['#value'] = 'edit ' . $key; - } - } - } -} - -/** - * Implements hook_ds_pre_render_alter(). - */ -function ds_test_ds_pre_render_alter(&$layout_render_array, array $context, array &$vars) { - /** @var EntityInterface $entity */ - $entity = $context['entity']; - if (isset($entity->title->value) && $entity->title->value === 'Alter me!') { - $layout_render_array['left'][] = ['#markup' => 'cool!', '#weight' => 20]; - } - - if ($entity->getEntityTypeId() == 'user') { - $vars['attributes']['class'][] = 'entity-label-class-' . $entity->label(); - } -} diff --git a/web/modules/ds/tests/modules/ds_test/src/Plugin/Block/DsCacheTestBlock.php b/web/modules/ds/tests/modules/ds_test/src/Plugin/Block/DsCacheTestBlock.php deleted file mode 100644 index 915e7a20eb..0000000000 --- a/web/modules/ds/tests/modules/ds_test/src/Plugin/Block/DsCacheTestBlock.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php - -namespace Drupal\ds_test\Plugin\Block; - -use Drupal\Core\Block\BlockBase; - -/** - * Defines a Display suite cache test block. - * - * @Block( - * id = "ds_cache_test_block", - * admin_label = @Translation("Display Suite Cache Test Block"), - * category = @Translation("ds") - * ) - */ -class DsCacheTestBlock extends BlockBase { - - /** - * {@inheritdoc} - */ - public function build() { - /** @var \Symfony\Component\HttpFoundation\Request $request */ - $request = \Drupal::service('request_stack')->getCurrentRequest(); - - return [ - // Print the entire query string. - '#markup' => $request->getQueryString(), - '#cache' => [ - 'contexts' => ['timezone', 'user'], - 'max-age' => 20, - ], - ]; - } - - /** - * {@inheritdoc} - */ - public function getCacheContexts() { - return ['url.path', 'url.query_args']; - } - - /** - * {@inheritdoc} - */ - public function getCacheTags() { - } - - /** - * {@inheritdoc} - */ - public function getCacheMaxAge() { - return 30; - } - -} diff --git a/web/modules/ds/tests/modules/ds_test/src/Plugin/Block/DsTestBlock.php b/web/modules/ds/tests/modules/ds_test/src/Plugin/Block/DsTestBlock.php deleted file mode 100644 index 121f865bff..0000000000 --- a/web/modules/ds/tests/modules/ds_test/src/Plugin/Block/DsTestBlock.php +++ /dev/null @@ -1,45 +0,0 @@ -<?php - -namespace Drupal\ds_test\Plugin\Block; - -use Drupal\Core\Access\AccessResult; -use Drupal\Core\Session\AccountInterface; -use Drupal\Core\Block\BlockBase; - -/** - * Defines a Display suite test block. - * - * @Block( - * id = "ds_test_block", - * admin_label = @Translation("Display Suite Test Block"), - * category = @Translation("ds") - * ) - */ -class DsTestBlock extends BlockBase { - - const BODY_TEXT = 'Display suite test block.'; - - /** - * {@inheritdoc} - */ - protected function blockAccess(AccountInterface $account) { - return AccessResult::allowedIf(\Drupal::state()->get('ds_test_block__access', FALSE)); - } - - /** - * {@inheritdoc} - */ - public function build() { - $build = []; - $build[]['#markup'] = $this::BODY_TEXT; - return $build; - } - - /** - * Ensure that this object is not cached. - */ - public function getCacheMaxAge() { - return 0; - } - -} diff --git a/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestCachingField.php b/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestCachingField.php deleted file mode 100644 index b56d5a3e41..0000000000 --- a/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestCachingField.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php - -namespace Drupal\ds_test\Plugin\DsField; - -use Drupal\Core\Cache\CacheableMetadata; -use Drupal\ds\Plugin\DsField\DsFieldBase; - -/** - * Test caching field plugin. - * - * @DsField( - * id = "test_caching_field", - * title = @Translation("Test Caching field"), - * entity_type = "node" - * ) - */ -class TestCachingField extends DsFieldBase { - - /** - * {@inheritdoc} - */ - public function build() { - $build = []; - $cache = CacheableMetadata::createFromRenderArray($build); - $cache - ->addCacheTags(['ds_my_custom_tags']) - ->applyTo($build); - - if (\Drupal::state()->get('ds_test_show_field', FALSE)) { - $build['#markup'] = 'DsField Shown'; - return $build; - } - - // Returning the cache object when we only have cache data allows our field - // to appear when the node changes status. - return $cache; - } - -} diff --git a/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestField.php b/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestField.php deleted file mode 100644 index ab02a13b50..0000000000 --- a/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestField.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php - -namespace Drupal\ds_test\Plugin\DsField; - -use Drupal\ds\Plugin\DsField\DsFieldBase; - -/** - * Test field plugin. - * - * @DsField( - * id = "test_field", - * title = @Translation("Test field plugin"), - * entity_type = "node" - * ) - */ -class TestField extends DsFieldBase { - - /** - * {@inheritdoc} - */ - public function build() { - return ['#markup' => 'Test field plugin on node ' . $this->entity()->id()]; - } - -} diff --git a/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestField2.php b/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestField2.php deleted file mode 100644 index f1179477d2..0000000000 --- a/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestField2.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php - -namespace Drupal\ds_test\Plugin\DsField; - -use Drupal\ds\Plugin\DsField\DsFieldBase; - -/** - * Test second field plugin. - * - * @DsField( - * id = "test_field_2", - * title = @Translation("Test field plugin 2"), - * entity_type = "node" - * ) - */ -class TestField2 extends DsFieldBase { - - /** - * {@inheritdoc} - */ - public function build() { - return ['#markup' => 'Test field plugin on node ' . $this->entity()->id()]; - } - -} diff --git a/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestFieldEmptyString.php b/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestFieldEmptyString.php deleted file mode 100644 index c4b524731f..0000000000 --- a/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestFieldEmptyString.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php - -namespace Drupal\ds_test\Plugin\DsField; - -use Drupal\ds\Plugin\DsField\DsFieldBase; - -/** - * Test field plugin that returns an empty string. - * - * @DsField( - * id = "test_field_empty_string", - * title = @Translation("Test field plugin that returns an empty string"), - * entity_type = "node" - * ) - */ -class TestFieldEmptyString extends DsFieldBase { - - /** - * {@inheritdoc} - */ - public function build() { - return ['#markup' => '']; - } - -} diff --git a/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestFieldFalse.php b/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestFieldFalse.php deleted file mode 100644 index b30b4e2925..0000000000 --- a/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestFieldFalse.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php - -namespace Drupal\ds_test\Plugin\DsField; - -use Drupal\ds\Plugin\DsField\DsFieldBase; - -/** - * Test field plugin that returns FALSE. - * - * @DsField( - * id = "test_field_false", - * title = @Translation("Test field plugin that returns FALSE"), - * entity_type = "node" - * ) - */ -class TestFieldFalse extends DsFieldBase { - - /** - * {@inheritdoc} - */ - public function build() { - return FALSE; - } - -} diff --git a/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestFieldNothing.php b/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestFieldNothing.php deleted file mode 100644 index fd30e6cc3c..0000000000 --- a/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestFieldNothing.php +++ /dev/null @@ -1,24 +0,0 @@ -<?php - -namespace Drupal\ds_test\Plugin\DsField; - -use Drupal\ds\Plugin\DsField\DsFieldBase; - -/** - * Test field plugin that returns nothing. - * - * @DsField( - * id = "test_field_nothing", - * title = @Translation("Test field plugin that returns nothing"), - * entity_type = "node" - * ) - */ -class TestFieldNothing extends DsFieldBase { - - /** - * {@inheritdoc} - */ - public function build() { - } - -} diff --git a/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestFieldNull.php b/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestFieldNull.php deleted file mode 100644 index b22701d088..0000000000 --- a/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestFieldNull.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php - -namespace Drupal\ds_test\Plugin\DsField; - -use Drupal\ds\Plugin\DsField\DsFieldBase; - -/** - * Test field plugin that returns NULL. - * - * @DsField( - * id = "test_field_null", - * title = @Translation("Test field plugin that returns NULL"), - * entity_type = "node" - * ) - */ -class TestFieldNull extends DsFieldBase { - - /** - * {@inheritdoc} - */ - public function build() { - return NULL; - } - -} diff --git a/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestFieldZeroFloat.php b/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestFieldZeroFloat.php deleted file mode 100644 index 8d17ae70f4..0000000000 --- a/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestFieldZeroFloat.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php - -namespace Drupal\ds_test\Plugin\DsField; - -use Drupal\ds\Plugin\DsField\DsFieldBase; - -/** - * Test field plugin that returns zero as a floating point number. - * - * @DsField( - * id = "test_field_zero_float", - * title = @Translation("Test field plugin that returns zero as a floating point number"), - * entity_type = "node" - * ) - */ -class TestFieldZeroFloat extends DsFieldBase { - - /** - * {@inheritdoc} - */ - public function build() { - return ['#markup' => 0.0]; - } - -} diff --git a/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestFieldZeroInt.php b/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestFieldZeroInt.php deleted file mode 100644 index ef9d694c52..0000000000 --- a/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestFieldZeroInt.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php - -namespace Drupal\ds_test\Plugin\DsField; - -use Drupal\ds\Plugin\DsField\DsFieldBase; - -/** - * Test field plugin that returns zero as an integer. - * - * @DsField( - * id = "test_field_zero_int", - * title = @Translation("Test field plugin that returns zero as an integer"), - * entity_type = "node" - * ) - */ -class TestFieldZeroInt extends DsFieldBase { - - /** - * {@inheritdoc} - */ - public function build() { - return ['#markup' => 0]; - } - -} diff --git a/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestFieldZeroString.php b/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestFieldZeroString.php deleted file mode 100644 index d8772b93e2..0000000000 --- a/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestFieldZeroString.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php - -namespace Drupal\ds_test\Plugin\DsField; - -use Drupal\ds\Plugin\DsField\DsFieldBase; - -/** - * Test field plugin that returns zero as a string. - * - * @DsField( - * id = "test_field_zero_string", - * title = @Translation("Test field plugin that returns zero as a string"), - * entity_type = "node" - * ) - */ -class TestFieldZeroString extends DsFieldBase { - - /** - * {@inheritdoc} - */ - public function build() { - return ['#markup' => '0']; - } - -} diff --git a/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestMultipleEntityTypeField.php b/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestMultipleEntityTypeField.php deleted file mode 100644 index a058f00eeb..0000000000 --- a/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestMultipleEntityTypeField.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php - -namespace Drupal\ds_test\Plugin\DsField; - -use Drupal\ds\Plugin\DsField\DsFieldBase; - -/** - * Multiple entity type field plugin. - * - * @DsField( - * id = "test_multiple_entity_test_field", - * title = @Translation("Multiple entity test field plugin"), - * entity_type = {"node", "user"} - * ) - */ -class TestMultipleEntityTypeField extends DsFieldBase { - - /** - * {@inheritdoc} - */ - public function build() { - return ['#markup' => 'Multiple entity test field plugin']; - } - -} diff --git a/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestMultipleField.php b/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestMultipleField.php deleted file mode 100644 index 86d4a0850b..0000000000 --- a/web/modules/ds/tests/modules/ds_test/src/Plugin/DsField/TestMultipleField.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php - -namespace Drupal\ds_test\Plugin\DsField; - -use Drupal\ds\Plugin\DsField\DsFieldBase; - -/** - * Test field plugin. - * - * @DsField( - * id = "test_multiple_field", - * title = @Translation("Test multiple field plugin"), - * entity_type = "node" - * ) - */ -class TestMultipleField extends DsFieldBase { - - /** - * {@inheritdoc} - */ - public function build() { - return [ - 0 => [ - '#markup' => 'Test row one of multiple field plugin on node ' . $this->entity()->id(), - ], - 1 => [ - '#markup' => 'Test row two of multiple field plugin on node ' . $this->entity()->id(), - ], - ]; - } - - /** - * {@inheritdoc} - */ - public function isMultiple() { - return TRUE; - } - -} diff --git a/web/modules/ds/tests/modules/ds_test/src/Plugin/DsFieldTemplate/TestLayout.php b/web/modules/ds/tests/modules/ds_test/src/Plugin/DsFieldTemplate/TestLayout.php deleted file mode 100644 index 9e277b9658..0000000000 --- a/web/modules/ds/tests/modules/ds_test/src/Plugin/DsFieldTemplate/TestLayout.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -namespace Drupal\ds_test\Plugin\DsFieldTemplate; - -use Drupal\ds\Plugin\DsFieldTemplate\DsFieldTemplateBase; - -/** - * Plugin for the expert field template. - * - * @DsFieldTemplate( - * id = "ds_test_template", - * title = @Translation("Field test function"), - * theme = "ds_test_template", - * ) - */ -class TestLayout extends DsFieldTemplateBase { - -} diff --git a/web/modules/ds/tests/modules/ds_test/templates/ds-test-template.html.twig b/web/modules/ds/tests/modules/ds_test/templates/ds-test-template.html.twig deleted file mode 100644 index e7a08ed9ca..0000000000 --- a/web/modules/ds/tests/modules/ds_test/templates/ds-test-template.html.twig +++ /dev/null @@ -1 +0,0 @@ -Testing field output through custom function diff --git a/web/modules/ds/tests/modules/ds_test/templates/dstest-1col-title.html.twig b/web/modules/ds/tests/modules/ds_test/templates/dstest-1col-title.html.twig deleted file mode 100644 index 47eb7942ab..0000000000 --- a/web/modules/ds/tests/modules/ds_test/templates/dstest-1col-title.html.twig +++ /dev/null @@ -1,18 +0,0 @@ -{# -/** - * @file - * Display Suite 1 column template. - * - * Available variables: - * - ds_content_wrapper: wrapper around content - * - attributes: content region attributes - * - ds_content: content region - */ -#} -<{{ ds_content_wrapper }}{{ attributes.addClass('ds-1col', 'clearfix') }}> - -{{ title_suffix.contextual_links }} - - {{ ds_content.node_title }} - -</{{ ds_content_wrapper }}> diff --git a/web/modules/ds/tests/modules/ds_test/templates/dstest-1col.html.twig b/web/modules/ds/tests/modules/ds_test/templates/dstest-1col.html.twig deleted file mode 100644 index 5dcdfb4f70..0000000000 --- a/web/modules/ds/tests/modules/ds_test/templates/dstest-1col.html.twig +++ /dev/null @@ -1,18 +0,0 @@ -{# -/** - * @file - * Display Suite 1 column template. - * - * Available variables: - * - ds_content_wrapper: wrapper around content - * - attributes: content region attributes - * - ds_content: content region - */ -#} -<{{ ds_content_wrapper }}{{ attributes.addClass('ds-1col', 'clearfix') }}> - - {{ title_suffix.contextual_links }} - - {{ ds_content }} - -</{{ ds_content_wrapper }}> diff --git a/web/modules/ds/tests/modules/ds_test/templates/dstest-2col-fluid.html.twig b/web/modules/ds/tests/modules/ds_test/templates/dstest-2col-fluid.html.twig deleted file mode 100644 index 4b6491059b..0000000000 --- a/web/modules/ds/tests/modules/ds_test/templates/dstest-2col-fluid.html.twig +++ /dev/null @@ -1,41 +0,0 @@ -{# -/** - * @file - * Display Suite fluid 2 column template. - * - * Available variables: - * - outer_wrapper: outer wrapper element - * - left_wrapper: wrapper element around left region - * - right_wrapper: wrapper element around right region - * - attributes: layout attributes - * - left_attributes: attributes for left region - * - right_attributes: attributes for right region - * - left: content of left region - * - right: content of right region - */ -#} - -{% set left = left|render %} -{% set right = right|render %} - -{% if (left and not right) or (right and not left) %} - {% set layout_class = 'group-one-column' %} -{% endif %} - -<{{ outer_wrapper }}{{ attributes.addClass(layout_class, 'ds-2col-fluid', 'clearfix') }}> - - {{ title_suffix.contextual_links }} - - {% if left %} - <{{ left_wrapper }}{{ left_attributes.addClass('group-left') }}> - {{ left }} - </{{ left_wrapper }}> - {% endif %} - - {% if right %} - <{{ right_wrapper }}{{ right_attributes.addClass('group-right') }}> - {{ right }} - </{{ right_wrapper }}> - {% endif %} - -</{{ outer_wrapper }}> diff --git a/web/modules/ds/tests/modules/ds_test/templates/dstest-2col.html.twig b/web/modules/ds/tests/modules/ds_test/templates/dstest-2col.html.twig deleted file mode 100644 index 103e3b172b..0000000000 --- a/web/modules/ds/tests/modules/ds_test/templates/dstest-2col.html.twig +++ /dev/null @@ -1,29 +0,0 @@ -{# -/** - * @file - * Display Suite 2 column template. - * - * Available variables: - * - outer_wrapper: outer wrapper element - * - left_wrapper: wrapper element around left region - * - right_wrapper: wrapper element around right region - * - attributes: layout attributes - * - left_attributes: attributes for left region - * - right_attributes: attributes for right region - * - left: content of left region - * - right: content of right region - */ -#} -<{{ outer_wrapper }}{{ attributes.addClass('ds-2col', 'clearfix') }}> - - {{ title_suffix.contextual_links }} - - <{{ left_wrapper }}{{ left_attributes.addClass('group-left') }}> - {{ left }} - </{{ left_wrapper }}> - - <{{ right_wrapper }}{{ right_attributes.addClass('group-right') }}> - {{ right }} - </{{ right_wrapper }}> - -</{{ outer_wrapper }}> diff --git a/web/modules/ds/tests/modules/ds_test/test_views/views.view.ds-testing.yml b/web/modules/ds/tests/modules/ds_test/test_views/views.view.ds-testing.yml deleted file mode 100644 index 387379c39f..0000000000 --- a/web/modules/ds/tests/modules/ds_test/test_views/views.view.ds-testing.yml +++ /dev/null @@ -1,572 +0,0 @@ -uuid: 71dcf218-c962-408f-9902-02b72dce2b1f -langcode: en -status: true -dependencies: - config: - - core.entity_view_mode.node.teaser - - node.type.article - module: - - ds - - node - - user -id: ds_testing -label: ds-testing -module: views -description: '' -tag: '' -base_table: node_field_data -base_field: nid -core: 8.x -display: - default: - display_plugin: default - id: default - display_title: Master - position: 0 - display_options: - access: - type: perm - options: - perm: 'access content' - cache: - type: none - options: { } - query: - type: views_query - options: - disable_sql_rewrite: false - distinct: false - replica: false - query_comment: '' - query_tags: { } - exposed_form: - type: basic - options: - submit_button: Apply - reset_button: false - reset_button_label: Reset - exposed_sorts_label: 'Sort by' - expose_sort_order: true - sort_asc_label: Asc - sort_desc_label: Desc - pager: - type: full - options: - items_per_page: 10 - offset: 0 - id: 0 - total_pages: null - expose: - items_per_page: false - items_per_page_label: 'Items per page' - items_per_page_options: '5, 10, 25, 50' - items_per_page_options_all: false - items_per_page_options_all_label: '- All -' - offset: false - offset_label: Offset - tags: - previous: '‹ previous' - next: 'next ›' - first: '« first' - last: 'last »' - quantity: 9 - style: - type: default - options: - grouping: { } - row_class: '' - default_row_class: true - uses_fields: false - row: - type: 'ds_entity:node' - options: - relationship: none - view_mode: teaser - alternating_fieldset: - alternating: false - allpages: false - item_0: default - item_1: teaser - item_2: teaser - item_3: teaser - item_4: teaser - item_5: teaser - item_6: teaser - item_7: teaser - item_8: teaser - item_9: teaser - grouping_fieldset: - group: true - group_field: node__field_tags|field_tags_target_id - group_field_function: '' - advanced_fieldset: - advanced: false - fields: - title: - id: title - table: node_field_data - field: title - entity_type: node - entity_field: title - label: '' - alter: - alter_text: false - make_link: false - absolute: false - trim: false - word_boundary: false - ellipsis: false - strip_tags: false - html: false - hide_empty: false - empty_zero: false - settings: - link_to_entity: true - plugin_id: field - relationship: none - group_type: group - admin_label: '' - exclude: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: true - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_alter_empty: true - click_sort_column: value - type: string - group_column: value - group_columns: { } - group_rows: true - delta_limit: 0 - delta_offset: 0 - delta_reversed: false - delta_first_last: false - multi_type: separator - separator: ', ' - field_api_classes: false - filters: - status: - value: true - table: node_field_data - field: status - plugin_id: boolean - entity_type: node - entity_field: status - id: status - expose: - operator: '' - group: 1 - type: - id: type - table: node_field_data - field: type - value: - article: article - entity_type: node - entity_field: type - plugin_id: bundle - sorts: - created: - id: created - table: node_field_data - field: created - order: ASC - entity_type: node - entity_field: created - plugin_id: date - relationship: none - group_type: group - admin_label: '' - exposed: false - expose: - label: '' - granularity: second - field_tags_target_id: - id: field_tags_target_id - table: node__field_tags - field: field_tags_target_id - relationship: none - group_type: group - admin_label: '' - order: ASC - exposed: false - expose: - label: '' - plugin_id: standard - header: { } - footer: { } - empty: { } - relationships: { } - arguments: { } - display_extenders: { } - cache_metadata: - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url.query_args - - 'user.node_grants:view' - - user.permissions - max-age: -1 - tags: { } - block_1: - display_plugin: block - id: block_1 - display_title: Block - position: 7 - display_options: - display_extenders: { } - block_description: 'Administrative block name' - title: 'Block title from view' - defaults: - title: false - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url.query_args - - 'user.node_grants:view' - - user.permissions - tags: { } - page_1: - display_plugin: page - id: page_1 - display_title: Page - position: 1 - display_options: - display_extenders: { } - path: ds-testing - style: - type: default - options: - grouping: { } - row_class: '' - default_row_class: true - uses_fields: false - defaults: - style: false - row: false - row: - type: 'ds_entity:node' - options: - relationship: none - view_mode: teaser - alternating_fieldset: - alternating: false - allpages: false - item_0: teaser - item_1: teaser - item_2: teaser - item_3: teaser - item_4: teaser - item_5: teaser - item_6: teaser - item_7: teaser - item_8: teaser - item_9: teaser - grouping_fieldset: - group: false - group_field: node_field_data|created - group_field_function: '' - advanced_fieldset: - advanced: false - cache_metadata: - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url.query_args - - 'user.node_grants:view' - - user.permissions - max-age: -1 - tags: { } - page_2: - display_plugin: page - id: page_2 - display_title: 'Page 1' - position: 2 - display_options: - display_extenders: { } - path: ds-testing-2 - display_description: '' - style: - type: default - options: - grouping: { } - row_class: '' - default_row_class: true - uses_fields: false - defaults: - style: false - row: false - row: - type: 'ds_entity:node' - options: - relationship: none - view_mode: teaser - alternating_fieldset: - alternating: true - allpages: false - item_0: default - item_1: teaser - item_2: teaser - item_3: teaser - item_4: teaser - item_5: teaser - item_6: teaser - item_7: teaser - item_8: teaser - item_9: teaser - grouping_fieldset: - group: false - group_field: node_field_data|created - group_field_function: '' - advanced_fieldset: - advanced: false - cache_metadata: - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url.query_args - - 'user.node_grants:view' - - user.permissions - max-age: -1 - tags: { } - page_3: - display_plugin: page - id: page_3 - display_title: 'Page 2' - position: 3 - display_options: - display_extenders: { } - display_description: '' - path: ds-testing-3 - style: - type: default - options: - grouping: { } - row_class: '' - default_row_class: true - uses_fields: false - defaults: - style: false - row: false - row: - type: 'ds_entity:node' - options: - relationship: none - view_mode: teaser - alternating_fieldset: - alternating: false - allpages: false - item_0: teaser - item_1: teaser - item_2: teaser - item_3: teaser - item_4: teaser - item_5: teaser - item_6: teaser - item_7: teaser - item_8: teaser - item_9: teaser - grouping_fieldset: - group: true - group_field: node__field_tags|field_tags_target_id - group_field_function: '' - advanced_fieldset: - advanced: false - cache_metadata: - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url.query_args - - 'user.node_grants:view' - - user.permissions - max-age: -1 - tags: { } - page_4: - display_plugin: page - id: page_4 - display_title: 'Page 3' - position: 4 - display_options: - display_extenders: { } - path: ds-testing-4 - style: - type: default - options: - grouping: { } - row_class: '' - default_row_class: true - uses_fields: false - defaults: - style: false - row: false - row: - type: 'ds_entity:node' - options: - relationship: none - view_mode: teaser - alternating_fieldset: - alternating: false - allpages: false - item_0: default - item_1: teaser - item_2: teaser - item_3: teaser - item_4: teaser - item_5: teaser - item_6: teaser - item_7: teaser - item_8: teaser - item_9: teaser - grouping_fieldset: - group: true - group_field: node__field_tags|field_tags_target_id - group_field_function: ds_test_get_tag_name - advanced_fieldset: - advanced: false - display_description: '' - cache_metadata: - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url.query_args - - 'user.node_grants:view' - - user.permissions - max-age: -1 - tags: { } - page_5: - display_plugin: page - id: page_5 - display_title: 'Page 4' - position: 5 - display_options: - display_extenders: { } - style: - type: default - options: - grouping: { } - row_class: '' - default_row_class: true - uses_fields: false - defaults: - style: false - row: false - row: - type: 'ds_entity:node' - options: - relationship: none - view_mode: teaser - alternating_fieldset: - alternating: false - allpages: false - item_0: default - item_1: teaser - item_2: teaser - item_3: teaser - item_4: teaser - item_5: teaser - item_6: teaser - item_7: teaser - item_8: teaser - item_9: teaser - grouping_fieldset: - group: false - group_field: node_field_data|created - group_field_function: '' - advanced_fieldset: - advanced: true - path: ds-testing-5 - display_description: '' - cache_metadata: - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url.query_args - - 'user.node_grants:view' - - user.permissions - max-age: -1 - tags: { } - page_6: - display_plugin: page - id: page_6 - display_title: 'Page 5' - position: 6 - display_options: - display_extenders: { } - style: - type: default - options: - grouping: { } - row_class: '' - default_row_class: true - uses_fields: false - defaults: - style: false - row: false - header: false - footer: false - row: - type: 'ds_entity:node' - options: - relationship: none - view_mode: teaser - alternating_fieldset: - alternating: false - allpages: false - item_0: default - item_1: teaser - item_2: teaser - item_3: teaser - item_4: teaser - item_5: teaser - item_6: teaser - item_7: teaser - item_8: teaser - item_9: teaser - grouping_fieldset: - group: false - group_field: node_field_data|created - group_field_function: '' - advanced_fieldset: - advanced: false - path: ds-testing-6 - display_description: '' - header: - area_text_custom: - id: area_text_custom - table: views - field: area_text_custom - relationship: none - group_type: group - admin_label: '' - empty: false - tokenize: false - content: 'Header text' - plugin_id: text_custom - footer: - area_text_custom: - id: area_text_custom - table: views - field: area_text_custom - relationship: none - group_type: group - admin_label: '' - empty: false - tokenize: false - content: 'Footer text' - plugin_id: text_custom - cache_metadata: - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url.query_args - - 'user.node_grants:view' - - user.permissions - max-age: -1 - tags: { } diff --git a/web/modules/ds/tests/modules/ds_test_rdf/config/install/rdf.mapping.node.article.yml b/web/modules/ds/tests/modules/ds_test_rdf/config/install/rdf.mapping.node.article.yml deleted file mode 100644 index 157e4e4c59..0000000000 --- a/web/modules/ds/tests/modules/ds_test_rdf/config/install/rdf.mapping.node.article.yml +++ /dev/null @@ -1,26 +0,0 @@ -langcode: en -status: true -dependencies: - config: - - node.type.article - module: - - node -id: node.article -targetEntityType: node -bundle: article -types: - - 'schema:Article' -fieldMappings: - title: - properties: - - 'schema:name' - created: - properties: - - 'schema:dateCreated' - datatype_callback: - callable: 'Drupal\rdf\CommonDataConverter::dateIso8601Value' - changed: - properties: - - 'schema:dateModified' - datatype_callback: - callable: 'Drupal\rdf\CommonDataConverter::dateIso8601Value' diff --git a/web/modules/ds/tests/modules/ds_test_rdf/ds_test_rdf.info.yml b/web/modules/ds/tests/modules/ds_test_rdf/ds_test_rdf.info.yml deleted file mode 100644 index f8b8bfba5f..0000000000 --- a/web/modules/ds/tests/modules/ds_test_rdf/ds_test_rdf.info.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: 'Display Suite Test RDF' -description: 'Test module for Display Suite RDF integratin' -# core: 8.x -package: 'Display Suite' -type: module - -# Information added by Drupal.org packaging script on 2017-05-24 -version: '8.x-3.1' -core: '8.x' -project: 'ds' -datestamp: 1495660091 diff --git a/web/modules/ds/tests/src/Functional/BlockFieldPluginTest.php b/web/modules/ds/tests/src/Functional/BlockFieldPluginTest.php deleted file mode 100644 index 26118f459e..0000000000 --- a/web/modules/ds/tests/src/Functional/BlockFieldPluginTest.php +++ /dev/null @@ -1,171 +0,0 @@ -<?php - -namespace Drupal\Tests\ds\Functional; - -use Drupal\views\Tests\ViewTestData; -use Drupal\views\ViewExecutable; -use Drupal\Component\Utility\Unicode; -use Drupal\ds_test\Plugin\Block\DsTestBlock; - -/** - * Tests for managing custom code, and block fields. - * - * @group ds - */ -class BlockFieldPluginTest extends FastTestBase { - - /** - * Modules to install. - * - * @var array - */ - public static $modules = [ - 'node', - 'block', - 'ds', - 'ds_test', - 'views', - ]; - - /** - * Views used by this test. - * - * @var array - * The list of views. - */ - public static $testViews = ['ds-testing']; - - /** - * {@inheritdoc} - */ - protected function setUp() { - parent::setUp(); - - // Ensure that the plugin definitions are cleared. - foreach (ViewExecutable::getPluginTypes() as $plugin_type) { - $this->container->get("plugin.manager.views.$plugin_type")->clearCachedDefinitions(); - } - - ViewTestData::createTestViews(get_class($this), ['ds_test']); - } - - /** - * Test block title override. - */ - public function testBlockFieldTitleOverride() { - // Block fields. - $edit = [ - 'name' => 'Test block title field', - 'id' => 'test_block_title_field', - 'entities[node]' => '1', - 'block' => 'views_block:ds_testing-block_1', - ]; - - $this->dsCreateBlockField($edit); - - $this->dsSelectLayout(); - - // Assert it's found on the Field UI for article. - $this->drupalGet('admin/structure/types/manage/article/display'); - $this->assertSession()->responseContains('fields[dynamic_block_field:node-test_block_title_field][weight]'); - - $fields = [ - 'fields[dynamic_block_field:node-test_block_title_field][region]' => 'left', - 'fields[dynamic_block_field:node-test_block_title_field][label]' => 'above', - 'fields[body][region]' => 'right', - ]; - - $this->dsSelectLayout(); - $this->dsConfigureUi($fields); - - // Create a node. - $settings = ['type' => 'article', 'promote' => 1]; - $node = $this->drupalCreateNode($settings); - - // Look at node and verify the block title is overridden. - $this->drupalGet('node/' . $node->id()); - $this->assertSession()->responseContains('Test block title field'); - - // Update testing label. - $edit = [ - 'use_block_title' => '1', - ]; - $this->drupalPostForm('admin/structure/ds/fields/manage_block/test_block_title_field', $edit, t('Save')); - $this->assertSession()->responseContains(t('The field %name has been saved', ['%name' => 'Test block title field'])); - - // Look at node and verify the block title is overridden. - $this->drupalGet('node/' . $node->id()); - $this->assertSession()->responseContains('Block title from view'); - } - - /** - * Ensure block is not rendered if block disallows access. - */ - public function testBlockAccess() { - $block_field_id = Unicode::strtolower($this->randomMachineName()); - $entity_type = 'node'; - - $edit = [ - 'name' => $this->randomString(), - 'id' => $block_field_id, - 'entities[' . $entity_type . ']' => TRUE, - 'block' => 'ds_test_block', - ]; - $this->dsCreateBlockField($edit); - - $fields['fields[dynamic_block_field:' . $entity_type . '-' . $block_field_id . '][region]'] = 'left'; - $this->dsSelectLayout(); - $this->dsConfigureUI($fields); - - $settings['type'] = 'article'; - $node = $this->drupalCreateNode($settings); - - // Check block is not visible. - \Drupal::state()->set('ds_test_block__access', FALSE); - $this->drupalGet($node->toUrl()); - $this->assertSession()->responseNotContains(DsTestBlock::BODY_TEXT); - - // Reset page cache. - $this->resetAll(); - - // Check block is visible. - \Drupal::state()->set('ds_test_block__access', TRUE); - $this->drupalGet($node->toUrl()); - $this->assertSession()->responseContains(DsTestBlock::BODY_TEXT); - } - - /** - * Tests cache properties on blocks. - * - * Cache contexts, tags and max-age on the block should get merged into the - * field build array. - */ - public function testBlockCache() { - $block_field_id = Unicode::strtolower($this->randomMachineName()); - $entity_type = 'node'; - - $edit = [ - 'name' => $this->randomString(), - 'id' => $block_field_id, - 'entities[' . $entity_type . ']' => TRUE, - 'block' => 'ds_cache_test_block', - ]; - $this->dsCreateBlockField($edit); - - $fields['fields[dynamic_block_field:' . $entity_type . '-' . $block_field_id . '][region]'] = 'left'; - $this->dsSelectLayout(); - $this->dsConfigureUI($fields); - - $settings['type'] = 'article'; - $node = $this->drupalCreateNode($settings); - - // Check for query parameters. - $this->drupalGet($node->toUrl(), ['query' => ['cached' => 1]]); - $this->assertSession()->responseContains('cached=1'); - - // Check for query parameters. - $this->drupalGet($node->toUrl(), ['query' => ['cached' => 2]]); - $this->assertSession()->responseContains('cached=2'); - } - -} diff --git a/web/modules/ds/tests/src/Functional/BlockTest.php b/web/modules/ds/tests/src/Functional/BlockTest.php deleted file mode 100644 index 42eca983ea..0000000000 --- a/web/modules/ds/tests/src/Functional/BlockTest.php +++ /dev/null @@ -1,106 +0,0 @@ -<?php - -namespace Drupal\Tests\ds\Functional; - -use Drupal\block_content\Entity\BlockContent; -use Drupal\user\Entity\User; - -/** - * Tests for the manage display tab in Display Suite. - * - * @group ds - */ -class BlockTest extends FastTestBase { - - use DsTestTrait; - - /** - * Modules to install. - * - * @var array - */ - public static $modules = [ - 'node', - 'user', - 'comment', - 'field_ui', - 'block', - 'block_content', - 'ds', - ]; - - /** - * The created user. - * - * @var User - */ - protected $adminUser; - - /** - * {@inheritdoc} - */ - protected function setUp() { - parent::setUp(); - - // Create a test user. - $this->adminUser = $this->drupalCreateUser([ - 'access content', - 'admin display suite', - 'admin fields', - 'administer blocks', - 'administer block_content display', - ]); - $this->drupalLogin($this->adminUser); - } - - /** - * Test adding a block, modifying output. - */ - public function testBlock() { - - // Create basic block type. - $edit = [ - 'label' => 'Basic Block', - 'id' => 'basic', - ]; - $this->drupalPostForm('admin/structure/block/block-content/types/add', $edit,'Save', []); - $this->assertSession()->pageTextContains('Custom block type Basic Block has been added.'); - - // Create a basic block. - $edit = []; - $edit['info[0][value]'] = 'Test Block'; - $edit['body[0][value]'] = $this->randomMachineName(16); - $this->drupalPostForm('block/add/basic', $edit, t('Save'), []); - $this->assertSession()->pageTextContains('Basic Block Test Block has been created.'); - - // Place the block. - $instance = [ - 'id' => 'testblock', - 'settings[label]' => $edit['info[0][value]'], - 'region' => 'sidebar_first', - ]; - $block = BlockContent::load(1); - $url = 'admin/structure/block/add/block_content:' . $block->uuid() . '/' . $this->config('system.theme')->get('default'); - $this->drupalPostForm($url, $instance, t('Save block')); - - // Change to a DS layout. - $url = 'admin/structure/block/block-content/manage/basic/display'; - $edit = ['layout' => 'ds_2col']; - $this->drupalPostForm($url, $edit, t('Save'), []); - - $fields = [ - 'fields[block_description][region]' => 'left', - 'fields[body][region]' => 'right', - ]; - $this->dsConfigureUi($fields, 'admin/structure/block/block-content/manage/basic/display'); - - // View the block. - $this->drupalGet('<front>'); - $this->assertSession()->pageTextContains('Test Block'); - $xpath = $this->xpath('//div[@class="region region-sidebar-first"]/div/div[@class="block-content block-content--type-basic block-content--view-mode-full ds-2col clearfix"]/div[@class="group-left"]/div[@class="field field--name-block-description field--type-ds field--label-hidden field__item"]/h2'); - $this->assertEquals(count($xpath), 1, 'Description in group-left'); - $xpath = $this->xpath('//div[@class="region region-sidebar-first"]/div/div[@class="block-content block-content--type-basic block-content--view-mode-full ds-2col clearfix"]/div[@class="group-right"]/div[@class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"]/p'); - $this->assertEquals(count($xpath), 1, 'Body in group-right'); - } - -} diff --git a/web/modules/ds/tests/src/Functional/CacheTagsTest.php b/web/modules/ds/tests/src/Functional/CacheTagsTest.php deleted file mode 100644 index cacf4f1c1f..0000000000 --- a/web/modules/ds/tests/src/Functional/CacheTagsTest.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php - -namespace Drupal\Tests\ds\Functional; - -/** - * Tests for cache tags associated with an entity. - * - * @group ds - */ -class CacheTagsTest extends FastTestBase { - - /** - * Tests setting the correct cache tags. - */ - public function testUserCacheTags() { - // Create a node. - $settings = ['type' => 'article', 'promote' => 1]; - $node = $this->drupalCreateNode($settings); - - // Create field CSS classes. - $edit = ['fields' => "test_field_class\ntest_field_class_2|Field class 2"]; - $this->drupalPostForm('admin/structure/ds/classes', $edit, t('Save configuration')); - - // Create a token field. - $token_field = [ - 'name' => 'Token field', - 'id' => 'token_field', - 'entities[node]' => '1', - 'content[value]' => '[node:title]', - ]; - $this->dsCreateTokenField($token_field); - - // Select layout. - $this->dsSelectLayout(); - - // Configure fields. - $fields = [ - 'fields[dynamic_token_field:node-token_field][region]' => 'header', - 'fields[body][region]' => 'right', - 'fields[node_link][region]' => 'footer', - 'fields[body][label]' => 'above', - 'fields[node_submitted_by][region]' => 'header', - ]; - $this->dsConfigureUi($fields); - - $this->drupalGet('node/' . $node->id()); - $headers = $this->drupalGetHeader('X-Drupal-Cache-Tags'); - $this->assertTrue( - strpos($headers, 'user:' . $node->getRevisionUser()->getOriginalId()), - 'User cache tag found' - ); - } - -} diff --git a/web/modules/ds/tests/src/Functional/CloneTest.php b/web/modules/ds/tests/src/Functional/CloneTest.php deleted file mode 100644 index aeb3af282b..0000000000 --- a/web/modules/ds/tests/src/Functional/CloneTest.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php - -namespace Drupal\Tests\ds\Functional; - -/** - * Tests for the manage display tab in Display Suite. - * - * @group ds - */ -class CloneTest extends FastTestBase { - - use DsTestTrait; - - /** - * Modules to install. - * - * @var array - */ - public static $modules = [ - 'node', - 'user', - 'comment', - 'field_ui', - 'ds', - ]; - - /** - * Test adding a cloning a layout. - */ - public function testClone() { - // Go to the teaser display mode and select a DS layout. - $this->dsSelectLayout([], [], 'admin/structure/types/manage/article/display/teaser'); - $this->assertSession()->pageTextContains('Two column stacked layout'); - - // Go back to the default view mode. - $this->drupalGet('admin/structure/types/manage/article/display'); - - // Clone layout, this will clone from the teaser view mode. - $page = $this->getSession()->getPage(); - $button = $page->findById('edit-clone-submit'); - $button->click(); - - // Check for message. - $this->assertSession()->pageTextContains('The layout has been cloned.'); - - // Check that this now also has the expected region layout. - $option_field = $this->assertSession()->optionExists('edit-layout', 'ds_2col_stacked'); - $this->assertTrue($option_field->hasAttribute('selected')); - } - -} diff --git a/web/modules/ds/tests/src/Functional/DsFieldCacheTest.php b/web/modules/ds/tests/src/Functional/DsFieldCacheTest.php deleted file mode 100644 index 12e6357255..0000000000 --- a/web/modules/ds/tests/src/Functional/DsFieldCacheTest.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php - -namespace Drupal\Tests\ds\Functional; - -use Drupal\Core\Cache\Cache; -use Drupal\simpletest\NodeCreationTrait; - -/** - * Cache field test. - * - * @group ds - */ -class DsFieldCacheTest extends FastTestBase { - - use NodeCreationTrait; - use DsTestTrait; - - public static $modules = ['page_cache', 'dynamic_page_cache']; - - /** - * {@inheritdoc} - */ - public function setUp() { - parent::setUp(); - $this->drupalLogin($this->adminUser); - } - - /** - * Test a DS field that returns cache data. - */ - public function testCachedDsField() { - $fields = [ - 'fields[test_caching_field][region]' => 'left', - 'fields[test_caching_field][label]' => 'above', - ]; - $this->drupalPostForm('admin/structure/types/manage/article/display', ['layout' => 'ds_2col'], t('Save')); - $this->dsConfigureUi($fields); - - // Create and visit the node so that it is cached as empty, ensure the title - // doesn't appear. - $node = $this->createNode(['type' => 'article']); - $this->drupalGet($node->toUrl()); - $this->assertSession()->pageTextNotContains('DsField Shown'); - - // Enable our toggle flag and invalidate the cache so that our field should - // appear. - \Drupal::state()->set('ds_test_show_field', TRUE); - Cache::invalidateTags(['ds_my_custom_tags']); - - // Visit the node and assert that it now appears. - $this->drupalGet($node->toUrl()); - $this->assertSession()->pageTextContains('DsField Shown'); - } - -} diff --git a/web/modules/ds/tests/src/Functional/DsTestTrait.php b/web/modules/ds/tests/src/Functional/DsTestTrait.php deleted file mode 100644 index cc3c330020..0000000000 --- a/web/modules/ds/tests/src/Functional/DsTestTrait.php +++ /dev/null @@ -1,227 +0,0 @@ -<?php - -namespace Drupal\Tests\ds\Functional; - -/** - * Provides common functionality for the Display Suite test classes. - */ -trait DsTestTrait { - - /** - * Select a layout. - */ - public function dsSelectLayout($edit = [], $assert = [], $url = 'admin/structure/types/manage/article/display', $options = []) { - $edit += [ - 'layout' => 'ds_2col_stacked', - ]; - - $this->drupalPostForm($url, $edit, t('Save'), $options); - - $assert += [ - 'regions' => [ - 'header' => '<td colspan="8">' . t('Header') . '</td>', - 'left' => '<td colspan="8">' . t('Left') . '</td>', - 'right' => '<td colspan="8">' . t('Right') . '</td>', - 'footer' => '<td colspan="8">' . t('Footer') . '</td>', - ], - ]; - - foreach ($assert['regions'] as $region => $raw) { - $this->assertSession()->responseContains($region); - } - } - - /** - * Configure classes. - */ - public function dsConfigureClasses($edit = []) { - - $edit += [ - 'regions' => "class_name_1\nclass_name_2|Friendly name", - ]; - - $this->drupalPostForm('admin/structure/ds/classes', $edit, t('Save configuration')); - $this->assertSession()->pageTextContains('The configuration options have been saved.'); - $this->assertSession()->responseContains('class_name_1', 'Class name 1 found'); - $this->assertSession()->responseContains('class_name_2', 'Class name 1 found'); - } - - /** - * Configure classes on a layout. - */ - public function dsSelectClasses($edit = [], $url = 'admin/structure/types/manage/article/display') { - - $edit += [ - "layout_configuration[ds_classes][header][]" => 'class_name_1', - "layout_configuration[ds_classes][footer][]" => 'class_name_2', - ]; - - $this->drupalPostForm($url, $edit, t('Save')); - } - - /** - * Configure Field UI. - */ - public function dsConfigureUi($edit, $url = 'admin/structure/types/manage/article/display') { - $this->drupalPostForm($url, $edit,'Save'); - } - - /** - * Edit field formatter settings. - */ - public function dsEditFormatterSettings($edit, $field_name = 'body', $url = 'admin/structure/types/manage/article/display') { - $element_value = 'edit ' . $field_name; - $this->drupalPostForm($url, [], $element_value); - - if (isset($edit['fields[' . $field_name . '][settings_edit_form][third_party_settings][ds][ft][id]'])) { - $this->drupalPostForm(NULL, ['fields[' . $field_name . '][settings_edit_form][third_party_settings][ds][ft][id]' => $edit['fields[' . $field_name . '][settings_edit_form][third_party_settings][ds][ft][id]']], t('Update')); - $this->drupalPostForm(NULL, [], $element_value); - unset($edit['fields[' . $field_name . '][settings_edit_form][third_party_settings][ds][ft][id]']); - } - - $this->drupalPostForm(NULL, $edit, t('Update')); - $this->drupalPostForm(NULL, [], t('Save')); - } - - /** - * Edit limit. - */ - public function dsEditLimitSettings($edit, $field_name = 'body', $url = 'admin/structure/types/manage/article/display') { - $element_value = 'edit ' . $field_name; - $this->drupalPostForm($url, [], $element_value); - - if (isset($edit['fields[' . $field_name . '][settings_edit_form][third_party_settings][ds][ft][id]'])) { - $this->drupalPostForm(NULL, ['fields[' . $field_name . '][settings_edit_form][third_party_settings][ds][ds_limit]' => $edit['fields[' . $field_name . '][settings_edit_form][third_party_settings][ds][ds_limit]']], t('Update')); - $this->drupalPostForm(NULL, [], $element_value); - unset($edit['fields[' . $field_name . '][settings_edit_form][third_party_settings][ds][ds_limit]']); - } - - $this->drupalPostForm(NULL, $edit, t('Update')); - $this->drupalPostForm(NULL, [], t('Save')); - } - - /** - * Create a token field. - * - * @param array $edit - * An optional array of field properties. - * @param string $url - * The url to post to. - */ - public function dsCreateTokenField(array $edit = [], $url = 'admin/structure/ds/fields/manage_token') { - $edit += [ - 'name' => 'Test field', - 'id' => 'test_field', - 'entities[node]' => '1', - 'content[value]' => 'Test field', - ]; - - $this->drupalPostForm($url, $edit, t('Save')); - $this->assertSession()->responseContains(t('The field %name has been saved', ['%name' => $edit['name']])); - } - - /** - * Create a block field. - * - * @param array $edit - * An optional array of field properties. - * @param string $url - * The URL of the manage block page. - */ - public function dsCreateBlockField(array $edit = [], $url = 'admin/structure/ds/fields/manage_block') { - $edit += [ - 'name' => 'Test block field', - 'id' => 'test_block_field', - 'entities[node]' => '1', - 'block' => 'system_powered_by_block', - ]; - - $this->drupalPostForm($url, $edit, t('Save')); - $this->assertSession()->responseContains(t('The field %name has been saved', ['%name' => $edit['name']])); - } - - /** - * Utility function to setup for all kinds of tests. - * - * @param string $label - * How the body label must be set. - */ - public function entitiesTestSetup($label = 'above') { - - // Create a node. - $settings = ['type' => 'article', 'promote' => 1]; - $node = $this->drupalCreateNode($settings); - - // Create field CSS classes. - $edit = ['fields' => "test_field_class\ntest_field_class_2|Field class 2\n[node:nid]"]; - $this->drupalPostForm('admin/structure/ds/classes', $edit,'Save configuration'); - - // Create a token field. - $token_field = [ - 'name' => 'Token field', - 'id' => 'token_field', - 'entities[node]' => '1', - 'content[value]' => '[node:title]', - ]; - $this->dsCreateTokenField($token_field); - - // Select layout. - $this->dsSelectLayout(); - - // Configure fields. - $fields = [ - 'fields[dynamic_token_field:node-token_field][region]' => 'header', - 'fields[body][region]' => 'right', - 'fields[node_link][region]' => 'footer', - 'fields[body][label]' => $label, - 'fields[node_submitted_by][region]' => 'header', - ]; - $this->dsConfigureUi($fields); - - return $node; - } - - /** - * Utility function to clear field settings. - */ - public function entitiesClearFieldSettings() { - $display = EntityViewDisplay::load('node.article.default'); - - // Remove all third party settings from components. - foreach ($display->getComponents() as $key => $info) { - $info['third_party_settings'] = []; - $display->setComponent($key, $info); - } - - // Remove entity display third party settings. - $tps = $display->getThirdPartySettings('ds'); - if (!empty($tps)) { - foreach (array_keys($tps) as $key) { - $display->unsetThirdPartySetting('ds', $key); - } - } - - // Save. - $display->save(); - } - - /** - * Set the label. - */ - public function entitiesSetLabelClass($label, $field_name, $text = '', $class = '', $show_colon = FALSE) { - $edit = [ - 'fields[' . $field_name . '][label]' => $label, - ]; - if (!empty($text)) { - $edit['fields[' . $field_name . '][settings_edit_form][third_party_settings][ds][ft][settings][lb]'] = $text; - } - if (!empty($class)) { - $edit['fields[' . $field_name . '][settings_edit_form][third_party_settings][ds][ft][settings][classes][]'] = $class; - } - if ($show_colon) { - $edit['fields[' . $field_name . '][settings_edit_form][third_party_settings][ds][ft][settings][lb-col]'] = '1'; - } - $this->dsEditFormatterSettings($edit); - } - -} diff --git a/web/modules/ds/tests/src/Functional/DynamicFieldPluginTest.php b/web/modules/ds/tests/src/Functional/DynamicFieldPluginTest.php deleted file mode 100644 index 47259ded35..0000000000 --- a/web/modules/ds/tests/src/Functional/DynamicFieldPluginTest.php +++ /dev/null @@ -1,170 +0,0 @@ -<?php - -namespace Drupal\Tests\ds\Functional; - -/** - * Tests for managing custom code, and block fields. - * - * @group ds - */ -class DynamicFieldPluginTest extends FastTestBase { - - /** - * Test Display fields. - */ - public function testDsFields() { - - $edit = [ - 'name' => 'Test field', - 'id' => 'test_field', - 'entities[node]' => '1', - 'content[value]' => 'Test field', - ]; - - $this->dsCreateTokenField($edit); - - // Create the same and assert it already exists. - $this->drupalPostForm('admin/structure/ds/fields/manage_token', $edit, 'Save'); - $this->assertSession()->pageTextContains('The machine-readable name is already in use. It must be unique.'); - - $this->dsSelectLayout(); - - // Assert it's found on the Field UI for article. - $this->drupalGet('admin/structure/types/manage/article/display'); - $this->assertSession()->responseContains('fields[dynamic_token_field:node-test_field][weight]'); - - // Assert it's not found on the Field UI for users. - $this->drupalGet('admin/config/people/accounts/display'); - $this->assertSession()->responseNotContains('fields[dynamic_token_field:node-test_field][weight]'); - - // Update testing label. - $edit = [ - 'name' => 'Test field 2', - ]; - $this->drupalPostForm('admin/structure/ds/fields/manage_token/test_field', $edit,'Save'); - $this->assertSession()->pageTextContains('The field Test field 2 has been saved'); - - // Use the Field UI limit option. - $this->dsSelectLayout([], [], 'admin/structure/types/manage/page/display'); - $this->dsSelectLayout([], [], 'admin/structure/types/manage/article/display/teaser'); - $edit = [ - 'ui_limit' => 'article|default', - ]; - $this->drupalPostForm('admin/structure/ds/fields/manage_token/test_field', $edit,'Save'); - - $this->drupalGet('admin/structure/types/manage/article/display'); - $this->assertSession()->responseContains('fields[dynamic_token_field:node-test_field][weight]'); - - $this->drupalGet('admin/structure/types/manage/article/display/teaser'); - $this->assertSession()->responseNotContains('fields[dynamic_token_field:node-test_field][weight]'); - $this->drupalGet('admin/structure/types/manage/page/display'); - $this->assertSession()->responseNotContains('fields[dynamic_token_field:node-test_field][weight]'); - $edit = [ - 'ui_limit' => 'article|*', - ]; - $this->drupalPostForm('admin/structure/ds/fields/manage_token/test_field', $edit,'Save'); - $this->drupalGet('admin/structure/types/manage/article/display'); - $this->assertSession()->responseContains('fields[dynamic_token_field:node-test_field][weight]'); - $this->drupalGet('admin/structure/types/manage/article/display/teaser'); - $this->assertSession()->responseContains('fields[dynamic_token_field:node-test_field][weight]'); - - // Remove the field. - $this->drupalPostForm('admin/structure/ds/fields/delete/test_field', [],'Confirm'); - $this->assertSession()->pageTextContains('The field Test field 2 has been deleted'); - - // Assert the field is gone at the manage display screen. - $this->drupalGet('admin/structure/types/manage/article/display'); - $this->assertSession()->responseNotContains('fields[dynamic_token_field:node-test_field][weight]'); - - // Block fields. - $edit = [ - 'name' => 'Test block field', - 'id' => 'test_block_field', - 'entities[node]' => '1', - 'block' => 'system_powered_by_block', - ]; - - $this->dsCreateBlockField($edit); - - // Create the same and assert it already exists. - $this->drupalPostForm('admin/structure/ds/fields/manage_block', $edit,'Save'); - $this->assertSession()->pageTextContains('The machine-readable name is already in use. It must be unique.'); - - $this->dsSelectLayout(); - - // Assert it's found on the Field UI for article. - $this->drupalGet('admin/structure/types/manage/article/display'); - $this->assertSession()->responseContains('fields[dynamic_block_field:node-test_block_field][weight]'); - - // Assert it's not found on the Field UI for users. - $this->drupalGet('admin/config/people/accounts/display'); - $this->assertSession()->responseNotContains('fields[dynamic_block_field:node-test_block_field][weight]'); - - // Update testing label. - $edit = [ - 'name' => 'Test block field 2', - ]; - $this->drupalPostForm('admin/structure/ds/fields/manage_block/test_block_field', $edit,'Save'); - $this->assertSession()->pageTextContains('The field Test block field 2 has been saved'); - - // Remove the block field. - $this->drupalPostForm('admin/structure/ds/fields/delete/test_block_field', [],'Confirm'); - $this->assertSession()->pageTextContains('The field Test block field 2 has been deleted'); - - // Assert the block field is gone at the manage display screen. - $this->drupalGet('admin/structure/types/manage/article/display'); - $this->assertSession()->responseNotContains('fields[dynamic_block_field:node-test_block_field][weight]'); - - // Create a configurable block field. - $edit = [ - 'name' => 'Configurable block <script>alert("XSS")</script>', - 'id' => 'test_block_configurable', - 'entities[node]' => '1', - 'block' => 'system_menu_block:tools', - ]; - - $this->dsCreateBlockField($edit); - - // Try to set the depth to 3, to ensure we can save the block. - $edit = [ - 'depth' => '3', - ]; - $this->drupalPostForm('admin/structure/ds/fields/manage_block/test_block_configurable/block_config', $edit,'Save'); - - // Assert it's found on the Field UI for article. - $this->drupalGet('admin/structure/types/manage/article/display'); - $this->assertSession()->responseContains('fields[dynamic_block_field:node-test_block_configurable][weight]'); - - // Assert it's not found on the Field UI for users. - $this->drupalGet('admin/config/people/accounts/display'); - $this->assertSession()->responseNotContains('fields[dynamic_block_field:node-test_block_configurable][weight]'); - - // Add block to display. - $fields = [ - 'fields[dynamic_block_field:node-test_block_configurable][region]' => 'left', - 'fields[dynamic_block_field:node-test_block_configurable][label]' => 'above', - ]; - $this->dsConfigureUi($fields, 'admin/structure/types/manage/article/display'); - - /* @var \Drupal\node\NodeInterface $node */ - $node = $this->entitiesTestSetup(); - - // Look at node and verify the menu is visible. - $this->drupalGet('node/' . $node->id()); - $this->assertSession()->responseContains('Add content'); - - // Ensure that there is no XSS attack possible - $this->assertSession()->responseNotContains('<script>alert("XSS")</script>'); - - // Try to set the depth to 3, to ensure we can save the block. - $edit = [ - 'level' => '2', - ]; - $this->drupalPostForm('admin/structure/ds/fields/manage_block/test_block_configurable/block_config', $edit,'Save'); - - // Look at node and verify the menu is not visible. - $this->drupalGet('node/' . $node->id()); - $this->assertSession()->responseNotContains('Add content'); - } - -} diff --git a/web/modules/ds/tests/src/Functional/EntitiesTest.php b/web/modules/ds/tests/src/Functional/EntitiesTest.php deleted file mode 100644 index aa83a227b3..0000000000 --- a/web/modules/ds/tests/src/Functional/EntitiesTest.php +++ /dev/null @@ -1,245 +0,0 @@ -<?php - -namespace Drupal\Tests\ds\Functional; - -/** - * Tests for display of nodes and fields. - * - * @group ds - */ -class EntitiesTest extends FastTestBase { - - /** - * Modules to install. - * - * @var array - */ - public static $modules = [ - 'node', - 'field_ui', - 'taxonomy', - 'block', - 'ds', - 'ds_test', - 'ds_switch_view_mode', - ]; - - /** - * {@inheritdoc} - */ - protected function setup() { - parent::setup(); - - // Enable field templates. - \Drupal::configFactory()->getEditable('ds.settings') - ->set('field_template', TRUE) - ->save(); - - $this->container->get('theme_installer')->install(['ds_test_layout_theme']); - $config = \Drupal::configFactory()->getEditable('system.theme'); - $config->set('default', 'ds_test_layout_theme')->save(); - } - - /** - * Test basic node display fields. - */ - public function testDsNodeEntity() { - - /* @var \Drupal\node\NodeInterface $node */ - $node = $this->entitiesTestSetup(); - - // Test theme_hook_suggestions in ds_entity_variables(). - $this->drupalGet('node/' . $node->id(), ['query' => ['store_suggestions' => 1]]); - $cache = $this->container->get('cache.default')->get('ds_test_suggestions'); - $hook_suggestions = $cache->data; - $expected_hook_suggestions = [ - 'ds_2col_stacked', - 'ds_2col_stacked__node', - 'ds_2col_stacked__node_full', - 'ds_2col_stacked__node_article', - 'ds_2col_stacked__node_article_full', - 'ds_2col_stacked__node__1', - ]; - $this->assertEquals($hook_suggestions, $expected_hook_suggestions); - - // Look at node and verify token and block field. - $this->drupalGet('node/' . $node->id()); - $this->assertSession()->responseContains('node--view-mode-full', 'Template file found (in full view mode)'); - $this->assertSession()->responseContains('<div class="field field--name-dynamic-token-fieldnode-token-field field--type-ds field--label-hidden field__item">'); - $elements = $this->xpath('//div[@class="field field--name-dynamic-token-fieldnode-token-field field--type-ds field--label-hidden field__item"]'); - $this->assertEquals($elements[0]->find('xpath', 'p')->getText(), $node->getTitle(), 'Token field content found'); - $this->assertSession()->responseContains('group-header'); - $this->assertSession()->responseContains('group-footer'); - $this->assertSession()->responseContains('group-left'); - $this->assertSession()->responseContains('group-right'); - $this->assertSession()->responseContains('<div class="field field--name-node-submitted-by field--type-ds field--label-hidden field__item">'); - $elements = $this->xpath('//div[@class="field field--name-node-submitted-by field--type-ds field--label-hidden field__item"]'); - $this->assertSession()->pageTextContains('Submitted by ' . $elements[0]->find('xpath', 'a')->find('xpath', 'span')->getText() . ' on', 'Submitted by line found'); - - // Configure teaser layout. - $teaser = [ - 'layout' => 'ds_2col', - ]; - $teaser_assert = [ - 'regions' => [ - 'left' => '<td colspan="8">' . t('Left') . '</td>', - 'right' => '<td colspan="8">' . t('Right') . '</td>', - ], - ]; - $this->dsSelectLayout($teaser, $teaser_assert, 'admin/structure/types/manage/article/display/teaser'); - - $fields = [ - 'fields[dynamic_token_field:node-token_field][region]' => 'left', - 'fields[body][region]' => 'right', - 'fields[node_links][region]' => 'right', - ]; - $this->dsConfigureUi($fields, 'admin/structure/types/manage/article/display/teaser'); - - // Switch view mode on full node page. - $edit = ['ds_switch' => 'teaser']; - $this->drupalPostForm('node/' . $node->id() . '/edit', $edit,'Save and keep published'); - $this->assertSession()->responseContains('node--view-mode-teaser', 'Switched to teaser mode'); - $this->assertSession()->responseContains('group-left'); - $this->assertSession()->responseContains('group-right'); - $this->assertSession()->responseNotContains('group-header'); - $this->assertSession()->responseNotContains('group-footer'); - - $edit = ['ds_switch' => '']; - $this->drupalPostForm('node/' . $node->id() . '/edit', $edit,'Save and keep published'); - $this->assertSession()->responseContains('node--view-mode-full'); - - // Test all options of a block field. - $block = [ - 'name' => 'Test block field', - ]; - $this->dsCreateBlockField($block); - $fields = [ - 'fields[dynamic_block_field:node-test_block_field][region]' => 'left', - 'fields[dynamic_token_field:node-token_field][region]' => 'hidden', - 'fields[body][region]' => 'hidden', - 'fields[node_links][region]' => 'hidden', - ]; - $this->dsConfigureUi($fields); - $this->drupalGet('node/' . $node->id()); - $this->assertSession()->responseContains('field--name-dynamic-block-fieldnode-test-block-field'); - - // Test revisions. Enable the revision view mode. - $edit = [ - 'display_modes_custom[revision]' => '1', - ]; - $this->drupalPostForm('admin/structure/types/manage/article/display', $edit,'Save'); - - // Enable the override revision mode and configure it. - $edit = [ - 'fs3[override_node_revision]' => TRUE, - 'fs3[override_node_revision_view_mode]' => 'revision', - ]; - $this->drupalPostForm('admin/structure/ds/settings', $edit,'Save configuration'); - - // Select layout and configure fields. - $edit = [ - 'layout' => 'ds_2col', - ]; - $assert = [ - 'regions' => [ - 'left' => '<td colspan="8">' . t('Left') . '</td>', - 'right' => '<td colspan="8">' . t('Right') . '</td>', - ], - ]; - $this->dsSelectLayout($edit, $assert, 'admin/structure/types/manage/article/display/revision'); - $edit = [ - 'fields[body][region]' => 'left', - 'fields[node_link][region]' => 'right', - 'fields[node_author][region]' => 'right', - ]; - $this->dsConfigureUi($edit, 'admin/structure/types/manage/article/display/revision'); - - // Create revision of the node. - $edit = [ - 'revision' => TRUE, - 'revision_log[0][value]' => 'Test revision', - ]; - $this->drupalPostForm('node/' . $node->id() . '/edit', $edit,'Save and keep published'); - - // Verify the revision is created. - $node = \Drupal::entityTypeManager()->getStorage('node')->load($node->id()); - $revision = \Drupal::entityTypeManager()->getStorage('node')->loadRevision($node->getRevisionId()); - $this->assertEquals($revision->revision_log->value, 'Test revision'); - - // Assert revision is using 2 col template. - $this->drupalGet('node/' . $node->id() . '/revisions/1/view'); - $this->assertSession()->pageTextContains('Body', 'Body label'); - - // Assert full view is using stacked template. - $this->drupalGet('node/' . $node->id()); - $this->assertSession()->pageTextNotContains('Body', 'No Body label'); - - // Test formatter limit on article with tags. - $edit = [ - 'ds_switch' => '', - 'field_tags[0][target_id]' => 'Tag 1', - 'field_tags[1][target_id]' => 'Tag 2', - ]; - $this->drupalPostForm('node/' . $node->id() . '/edit', $edit,'Save and keep published'); - $edit = [ - 'fields[field_tags][region]' => 'right', - 'fields[field_tags][type]' => 'entity_reference_label', - ]; - $this->dsConfigureUi($edit, 'admin/structure/types/manage/article/display'); - $this->drupalGet('node/' . $node->id()); - $this->assertSession()->pageTextContains('Tag 1'); - $this->assertSession()->pageTextContains('Tag 2'); - $edit = [ - 'fields[field_tags][settings_edit_form][third_party_settings][ds][ds_limit]' => '1', - ]; - $this->dsEditLimitSettings($edit, 'field_tags'); - $this->drupalGet('node/' . $node->id()); - $this->assertSession()->pageTextContains('Tag 1'); - $this->assertSession()->pageTextNotContains('Tag 2'); - - // Tests using the title field. - $edit = [ - 'fields[node_title][region]' => 'right', - ]; - $this->dsConfigureUi($edit, 'admin/structure/types/manage/article/display'); - - // Test \Drupal\Component\Utility\Html::escape() on ds_render_field(). - $edit = [ - 'title[0][value]' => 'Hi, I am an article <script>alert(\'with a javascript tag in the title\');</script>', - ]; - $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save and keep published')); - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="field field--name-node-title field--type-ds field--label-hidden field__item"]/h2'); - $this->assertTrimEqual($elements[0]->getText(), 'Hi, I am an article <script>alert(\'with a javascript tag in the title\');</script>'); - - // Test previews while using a ds field. - $title_key = 'title[0][value]'; - $edit = [$title_key => $this->randomMachineName()]; - $this->drupalPostForm('node/add/article', $edit,'Preview'); - $this->assertSession()->pageTextContains($edit[$title_key], 'Title visible in preview'); - - // Convert layout from test theme. - // Configure teaser layout. - $test_theme_template = [ - 'layout' => 'ds_test_layout_theme', - ]; - $test_theme_template_assert = [ - 'regions' => [ - 'ds_content' => '<td colspan="8">' . t('Content') . '</td>', - ], - ]; - $this->dsSelectLayout($test_theme_template, $test_theme_template_assert, 'admin/structure/types/manage/page/display'); - // Tests using the title field. - $edit = [ - 'fields[node_title][region]' => 'ds_content', - ]; - $this->dsConfigureUi($edit, 'admin/structure/types/manage/page/display'); - $node = $this->drupalCreateNode(['type' => 'page']); - $this->drupalGet('node/' . $node->id()); - $this->assertSession()->responseContains('test-template-defined-in-theme-class'); - $this->assertSession()->pageTextContains($node->get('body')->value); - $this->assertSession()->responseContains('div class="ds-content-wrapper"'); - - } - -} diff --git a/web/modules/ds/tests/src/Functional/ExportablesTest.php b/web/modules/ds/tests/src/Functional/ExportablesTest.php deleted file mode 100644 index ef9cb19ce5..0000000000 --- a/web/modules/ds/tests/src/Functional/ExportablesTest.php +++ /dev/null @@ -1,86 +0,0 @@ -<?php - -namespace Drupal\Tests\ds\Functional; - -use Drupal\Core\Entity\Entity\EntityViewDisplay; - -/** - * Tests for exportables in Display Suite. - * - * @group ds - */ -class ExportablesTest extends FastTestBase { - - /** - * Enables the exportables module. - */ - public function dsExportablesSetup() { - /* @var $display EntityViewDisplay */ - $display = EntityViewDisplay::load('node.article.default'); - $display->delete(); - \Drupal::service('module_installer')->install(['ds_exportables_test']); - } - - /** - * Test layout and field settings configuration. - */ - public function testDsExportablesLayoutFieldsettings() { - $this->dsExportablesSetup(); - - // Look for default custom field. - $this->drupalGet('admin/structure/ds/fields'); - $this->assertSession()->pageTextContains('Exportable field'); - $this->drupalGet('admin/structure/types/manage/article/display'); - $this->assertSession()->pageTextContains('Exportable field'); - - $settings = [ - 'type' => 'article', - 'title' => 'Exportable', - ]; - $node = $this->drupalCreateNode($settings); - $this->drupalGet('node/' . $node->id()); - $this->assertSession()->responseContains('group-left'); - $this->assertSession()->responseContains('group-right'); - $this->assertSession()->responseNotContains('group-header'); - $this->assertSession()->responseNotContains('group-footer'); - $link = $this->xpath('//h3/a[text()=:text]', [ - ':text' => 'Exportable', - ]); - $this->assertEquals(count($link), 1, 'Default title with h3 found'); - $link = $this->xpath('//a[text()=:text]', [ - ':text' => 'Read more', - ]); - $this->assertEquals(count($link), 1, 'Default read more found'); - - // Override default layout. - $layout = [ - 'layout' => 'ds_2col_stacked', - ]; - - $assert = [ - 'regions' => [ - 'header' => '<td colspan="8">' . t('Header') . '</td>', - 'left' => '<td colspan="8">' . t('Left') . '</td>', - 'right' => '<td colspan="8">' . t('Right') . '</td>', - 'footer' => '<td colspan="8">' . t('Footer') . '</td>', - ], - ]; - - $fields = [ - 'fields[node_post_date][region]' => 'header', - 'fields[node_author][region]' => 'left', - 'fields[node_link][region]' => 'left', - 'fields[body][region]' => 'right', - ]; - - $this->dsSelectLayout($layout, $assert); - $this->dsConfigureUi($fields); - - $this->drupalGet('node/' . $node->id()); - $this->assertSession()->responseContains('group-left'); - $this->assertSession()->responseContains('group-right'); - $this->assertSession()->responseContains('group-header'); - $this->assertSession()->responseContains('group-footer'); - } - -} diff --git a/web/modules/ds/tests/src/Functional/FastTestBase.php b/web/modules/ds/tests/src/Functional/FastTestBase.php deleted file mode 100644 index d783ab1876..0000000000 --- a/web/modules/ds/tests/src/Functional/FastTestBase.php +++ /dev/null @@ -1,190 +0,0 @@ -<?php - -namespace Drupal\Tests\ds\Functional; - -use Drupal\Core\Language\LanguageInterface; -use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait; -use Drupal\field_ui\Tests\FieldUiTestTrait; -use Drupal\taxonomy\Entity\Term; -use Drupal\taxonomy\Entity\Vocabulary; -use Drupal\taxonomy\Tests\TaxonomyTestTrait; -use Drupal\Tests\BrowserTestBase; - -/** - * Base test for Display Suite. - * - * @group ds - */ -abstract class FastTestBase extends BrowserTestBase { - - use DsTestTrait; - use EntityReferenceTestTrait; - use FieldUiTestTrait; - use TaxonomyTestTrait; - - /** - * Modules to install. - * - * @var array - */ - public static $modules = [ - 'node', - 'user', - 'field_ui', - 'rdf', - 'quickedit', - 'taxonomy', - 'block', - 'ds', - 'ds_extras', - 'ds_test', - 'ds_switch_view_mode', - 'layout_discovery', - 'field_group', - ]; - - /** - * The label for a random field to be created for testing. - * - * @var string - */ - protected $fieldLabel; - - /** - * The input name of a random field to be created for testing. - * - * @var string - */ - protected $fieldNameInput; - - /** - * The name of a random field to be created for testing. - * - * @var string - */ - protected $fieldName; - - /** - * The created taxonomy vocabulary. - * - * @var \Drupal\taxonomy\Entity\Vocabulary - */ - protected $vocabulary; - - /** - * The created user. - * - * @var \Drupal\user\UserInterface - */ - protected $adminUser; - - /** - * {@inheritdoc} - */ - protected function setUp() { - parent::setUp(); - $this->drupalPlaceBlock('system_breadcrumb_block'); - $this->drupalPlaceBlock('local_tasks_block'); - - // Create a test user. - $this->adminUser = $this->drupalCreateUser([ - 'access content', - 'access in-place editing', - 'admin classes', - 'admin display suite', - 'admin fields', - 'administer nodes', - 'view all revisions', - 'administer content types', - 'administer node fields', - 'administer node form display', - 'administer node display', - 'administer taxonomy', - 'administer taxonomy_term fields', - 'administer taxonomy_term display', - 'administer users', - 'administer permissions', - 'administer account settings', - 'administer user display', - 'administer software updates', - 'access site in maintenance mode', - 'administer site configuration', - 'bypass node access', - 'ds switch view mode', - ]); - $this->drupalLogin($this->adminUser); - - // Create random field name. - $this->fieldLabel = $this->randomMachineName(8); - $this->fieldNameInput = strtolower($this->randomMachineName(8)); - $this->fieldName = 'field_' . $this->fieldNameInput; - - // Create Article node type. - $this->drupalCreateContentType([ - 'type' => 'article', - 'name' => 'Article', - 'revision' => TRUE, - ]); - $this->drupalCreateContentType([ - 'type' => 'page', - 'name' => 'Page', - 'revision' => TRUE, - ]); - - // Create a vocabulary named "Tags". - $this->vocabulary = Vocabulary::create([ - 'name' => 'Tags', - 'vid' => 'tags', - 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, - ]); - $this->vocabulary->save(); - - $term1 = Term::create([ - 'name' => 'Tag 1', - 'vid' => 'tags', - 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, - ]); - $term1->save(); - - $term2 = Term::create([ - 'name' => 'Tag 2', - 'vid' => 'tags', - 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, - ]); - $term2->save(); - - $handler_settings = [ - 'target_bundles' => [ - $this->vocabulary->id() => $this->vocabulary->id(), - ], - // Enable auto-create. - 'auto_create' => TRUE, - ]; - $this->createEntityReferenceField('node', 'article', 'field_' . $this->vocabulary->id(), 'Tags', 'taxonomy_term', 'default', $handler_settings, 10); - - /** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $display */ - $display = \Drupal::entityTypeManager() - ->getStorage('entity_form_display') - ->load('node.article.default'); - - $display->setComponent('field_' . $this->vocabulary->id())->save(); - } - - /** - * Check to see if two trimmed values are equal. - * - * @param $first - * First element to compare - * @param $second - * Second element to compare - * @param string $message - * The message - */ - protected function assertTrimEqual($first, $second, $message = '') { - $first = (string) $first; - $second = (string) $second; - - $this->assertEquals(trim($first), trim($second), $message); - } - -} diff --git a/web/modules/ds/tests/src/Functional/FieldGroupTest.php b/web/modules/ds/tests/src/Functional/FieldGroupTest.php deleted file mode 100644 index 32bfe949be..0000000000 --- a/web/modules/ds/tests/src/Functional/FieldGroupTest.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php - -namespace Drupal\Tests\ds\Functional; - -use Drupal\field_group\Tests\FieldGroupTestTrait; - -/** - * Tests for field group integration with Display Suite. - * - * @group ds - */ -class FieldGroupTest extends FastTestBase { - - use FieldGroupTestTrait; - - /** - * Test tabs. - */ - public function testFieldPlugin() { - // Create a node. - $settings = ['type' => 'article', 'promote' => 1]; - /* @var \Drupal\node\NodeInterface $node */ - $node = $this->drupalCreateNode($settings); - - // Configure layout. - $layout = [ - 'layout' => 'ds_2col', - ]; - $layout_assert = [ - 'regions' => [ - 'left' => '<td colspan="8">' . t('Left') . '</td>', - 'right' => '<td colspan="8">' . t('Right') . '</td>', - ], - ]; - $this->dsSelectLayout($layout, $layout_assert); - - $data = [ - 'weight' => '1', - 'label' => 'Link', - 'format_type' => 'html_element', - 'format_settings' => [ - 'label' => 'Link', - 'element' => 'div', - 'id' => 'wrapper-id', - 'classes' => 'test-class', - ], - ]; - $group = $this->createGroup('node', 'article', 'view', 'default', $data); - - $fields = [ - 'fields[' . $group->group_name . '][region]' => 'right', - 'fields[body][region]' => 'right', - ]; - $this->dsConfigureUi($fields); - - $fields = [ - 'fields[body][parent]' => $group->group_name, - ]; - $this->dsConfigureUi($fields); - - $this->drupalGet('node/' . $node->id()); - - $elements = $this->xpath("//div[contains(@class, 'group-right')]/div"); - - $this->assertTrue($elements[0]->hasClass('test-class')); - $this->assertEquals($elements[0]->getAttribute('id'), 'wrapper-id'); - } - -} diff --git a/web/modules/ds/tests/src/Functional/FieldLayoutTest.php b/web/modules/ds/tests/src/Functional/FieldLayoutTest.php deleted file mode 100644 index 38818098e4..0000000000 --- a/web/modules/ds/tests/src/Functional/FieldLayoutTest.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php - -namespace Drupal\Tests\ds\Functional; - -/** - * Tests compatibility with field layout - * - * @group ds - */ -class FieldLayoutTest extends FastTestBase { - - /** - * Modules to install. - * - * @var array - */ - public static $modules = [ - 'node', - 'field_ui', - 'ds', - 'field_layout', - ]; - - /** - * Tests that the entity view works when field layout is enabled - */ - public function testCompatibility() { - // Create a node. - $settings = ['type' => 'article']; - /* @var \Drupal\node\NodeInterface $node */ - $node = $this->drupalCreateNode($settings); - - $fields = [ - 'fields[node_title][region]' => 'right', - ]; - - $this->dsSelectLayout(); - $this->dsConfigureUi($fields); - - $this->drupalGet('node/' . $node->id()); - - // Assert that the title is visible. - $elements = $this->xpath('//div[@class="field field--name-node-title field--type-ds field--label-hidden field__item"]/h2'); - $this->assertEquals(count($elements), 1); - } - -} diff --git a/web/modules/ds/tests/src/Functional/FieldPermissionsTest.php b/web/modules/ds/tests/src/Functional/FieldPermissionsTest.php deleted file mode 100644 index e77247d0cd..0000000000 --- a/web/modules/ds/tests/src/Functional/FieldPermissionsTest.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php - -namespace Drupal\Tests\ds\Functional; - -/** - * Tests for testing field permissions. - * - * @group ds - */ -class FieldPermissionsTest extends FastTestBase { - - /** - * Modules to install. - * - * @var array - */ - public static $modules = [ - 'node', - 'field_ui', - 'taxonomy', - 'block', - 'ds', - 'ds_extras', - 'ds_test', - 'views', - 'views_ui', - ]; - - /** - * Tests field permissions. - */ - public function testFieldPermissions() { - - $fields = [ - 'fields[body][region]' => 'right', - 'fields[test_field][region]' => 'left', - ]; - - $this->config('ds_extras.settings')->set('field_permissions', TRUE)->save(); - \Drupal::moduleHandler()->resetImplementations(); - - $this->dsSelectLayout(); - $this->dsConfigureUi($fields); - - // Create a node. - $settings = ['type' => 'article']; - $node = $this->drupalCreateNode($settings); - $this->drupalGet('node/' . $node->id()); - $this->assertSession()->responseContains('group-right'); - $this->assertSession()->pageTextNotContains('Test field plugin on node ' . $node->id()); - - // Give permissions. - $edit = [ - 'authenticated[view node_author on node]' => 1, - 'authenticated[view test_field on node]' => 1, - ]; - $this->drupalPostForm('admin/people/permissions', $edit,'Save permissions'); - $this->drupalGet('node/' . $node->id()); - $this->assertSession()->responseContains('group-left'); - $this->assertSession()->pageTextContains('Test field plugin on node ' . $node->id()); - } - -} diff --git a/web/modules/ds/tests/src/Functional/FieldPluginTest.php b/web/modules/ds/tests/src/Functional/FieldPluginTest.php deleted file mode 100644 index c0efd7b43b..0000000000 --- a/web/modules/ds/tests/src/Functional/FieldPluginTest.php +++ /dev/null @@ -1,105 +0,0 @@ -<?php - -namespace Drupal\Tests\ds\Functional; - -/** - * Tests DS field plugins. - * - * @group ds - */ -class FieldPluginTest extends FastTestBase { - - /** - * Test basic Display Suite fields plugins. - */ - public function testFieldPlugin() { - // Rename the title field. - $edit = [ - 'title_label' => 'alternative article title', - ]; - $this->drupalPostForm('admin/structure/types/manage/article', $edit, t('Save content type')); - - $this->dsSelectLayout(); - - // Find the two field plugins from the test module on the node type. - $this->drupalGet('admin/structure/types/manage/article/display'); - $this->assertSession()->pageTextContains('Test field plugin'); - // One is altered by hook_ds_fields_info_alter() - $this->assertSession()->pageTextContains('Field altered'); - - $empty = []; - $edit = ['layout' => 'ds_2col_stacked']; - $this->dsSelectLayout($edit, $empty, 'admin/config/people/accounts/display'); - - // Fields can not be found on user. - $this->drupalGet('admin/config/people/accounts/display'); - $this->assertSession()->pageTextNotContains('Test code field from plugin'); - $this->assertSession()->pageTextNotContains('Field altered'); - - // Select layout. - $this->dsSelectLayout(); - - $fields = [ - 'fields[node_title][region]' => 'right', - 'fields[node_title][label]' => 'inline', - 'fields[node_author][region]' => 'left', - 'fields[node_links][region]' => 'left', - 'fields[body][region]' => 'right', - 'fields[test_field][region]' => 'right', - 'fields[test_multiple_field][region]' => 'right', - 'fields[test_field_empty_string][region]' => 'right', - 'fields[test_field_empty_string][label]' => 'inline', - 'fields[test_field_false][region]' => 'right', - 'fields[test_field_false][label]' => 'inline', - 'fields[test_field_null][region]' => 'right', - 'fields[test_field_null][label]' => 'inline', - 'fields[test_field_nothing][region]' => 'right', - 'fields[test_field_nothing][label]' => 'inline', - 'fields[test_field_zero_int][region]' => 'right', - 'fields[test_field_zero_int][label]' => 'inline', - 'fields[test_field_zero_string][region]' => 'right', - 'fields[test_field_zero_string][label]' => 'inline', - 'fields[test_field_zero_float][region]' => 'right', - 'fields[test_field_zero_float][label]' => 'inline', - 'fields[test_multiple_entity_test_field][region]' => 'right', - 'fields[test_multiple_entity_test_field][label]' => 'inline', - ]; - - $this->dsSelectLayout(); - $this->dsConfigureUi($fields); - - // Create a node. - $settings = ['type' => 'article']; - $node = $this->drupalCreateNode($settings); - $this->drupalGet('node/' . $node->id()); - - $this->assertSession()->responseContains('group-left'); - $this->assertSession()->responseContains('group-right'); - $this->assertSession()->pageTextContains('Test field plugin on node ' . $node->id()); - $this->assertSession()->pageTextContains('Test row one of multiple field plugin on node ' . $node->id()); - $this->assertSession()->pageTextContains('Test row two of multiple field plugin on node ' . $node->id()); - $this->assertSession()->pageTextContains('Test field plugin that returns an empty string'); - $this->assertSession()->pageTextNotContains('Test field plugin that returns FALSE'); - $this->assertSession()->pageTextNotContains('Test field plugin that returns NULL'); - $this->assertSession()->pageTextNotContains('Test field plugin that returns nothing'); - $this->assertSession()->pageTextNotContains('Test field plugin that returns an empty array'); - $this->assertSession()->pageTextContains('Test field plugin that returns zero as an integer'); - $this->assertSession()->pageTextContains('Test field plugin that returns zero as a string'); - $this->assertSession()->pageTextContains('Test field plugin that returns zero as a floating point number'); - $this->assertSession()->pageTextContains('alternative article title'); - $this->assertSession()->pageTextContains('Multiple entity test field plugin'); - - // Check if the multiple entity test field appears on user entities - $this->dsSelectLayout([], [],'admin/config/people/accounts/display'); - $fields = [ - 'fields[test_multiple_entity_test_field][region]' => 'right', - 'fields[test_multiple_entity_test_field][label]' => 'inline', - ]; - - $this->dsConfigureUi($fields,'admin/config/people/accounts/display'); - $this->drupalGet('user/' . $this->adminUser->id()); - - $this->assertSession()->pageTextContains('Multiple entity test field plugin'); - } - -} diff --git a/web/modules/ds/tests/src/Functional/FieldTemplateTest.php b/web/modules/ds/tests/src/Functional/FieldTemplateTest.php deleted file mode 100644 index 6f69c270b0..0000000000 --- a/web/modules/ds/tests/src/Functional/FieldTemplateTest.php +++ /dev/null @@ -1,603 +0,0 @@ -<?php - -namespace Drupal\Tests\ds\Functional; - -use Drupal\Core\Cache\Cache; - -/** - * Tests for display of nodes and fields. - * - * @group ds - */ -class FieldTemplateTest extends FastTestBase { - - /** - * {@inheritdoc} - */ - protected function setup() { - parent::setup(); - - // Enable field templates. - \Drupal::configFactory()->getEditable('ds.settings') - ->set('field_template', TRUE) - ->save(); - } - - /** - * Tests on field templates. - */ - public function testDsFieldTemplate() { - // Get a node. - /** @var \Drupal\node\NodeInterface $node */ - $node = $this->entitiesTestSetup('hidden'); - $body_field = $node->body->value; - - // Default theming function. - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"]/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - - $this->entitiesSetLabelClass('above', 'body'); - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-above"]/div[@class="field__label"]'); - $this->assertTrimEqual($elements[0]->getText(), 'Body'); - $elements = $this->xpath('//div[@class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-above"]/div[@class="field__item"]/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - - $this->entitiesSetLabelClass('above', 'body', 'My body'); - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-above"]/div[@class="field__label"]'); - $this->assertTrimEqual($elements[0]->getText(), 'My body'); - $elements = $this->xpath('//div[@class="clearfix text-formatted field field--name-body field--type-text-with-summary field--label-above"]/div[@class="field__item"]/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - - $this->entitiesSetLabelClass('hidden', 'body', '', 'test_field_class'); - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="test_field_class clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item"]/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - } - - /** - * Tests on field templates. - */ - public function testDsFieldTemplate2() { - // Get a node. - /** @var \Drupal\node\NodeInterface $node */ - $node = $this->entitiesTestSetup('hidden'); - $body_field = $node->body->value; - - // Reset theming function. - $edit = [ - 'fs1[ft-default]' => 'reset', - ]; - $this->drupalPostForm('admin/structure/ds/settings', $edit, t('Save configuration')); - - // As long as we don't change anything in the UI, the default template will - // be used. - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="group-right"]/div/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - - $this->entitiesSetLabelClass('above', 'body'); - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="group-right"]/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - $elements = $this->xpath('//div[@class="group-right"]/div[@class="field-label-above"]'); - $this->assertTrimEqual($elements[0]->getText(), 'Body'); - - $this->entitiesSetLabelClass('inline', 'body'); - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="group-right"]/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - $elements = $this->xpath('//div[@class="group-right"]/div[@class="field-label-inline"]'); - $this->assertTrimEqual($elements[0]->getText(), 'Body'); - - $this->entitiesSetLabelClass('above', 'body', 'My body'); - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="group-right"]/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - $elements = $this->xpath('//div[@class="group-right"]/div[@class="field-label-above"]'); - $this->assertTrimEqual($elements[0]->getText(), 'My body'); - - $this->entitiesSetLabelClass('inline', 'body', 'My body'); - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="group-right"]/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - $elements = $this->xpath('//div[@class="group-right"]/div[@class="field-label-inline"]'); - $this->assertTrimEqual($elements[0]->getText(), 'My body'); - - $edit = [ - 'fs1[ft-show-colon]' => 'reset', - ]; - $this->drupalPostForm('admin/structure/ds/settings', $edit, t('Save configuration')); - // Clear node cache to get the colon. - $tags = $node->getCacheTags(); - Cache::invalidateTags($tags); - - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="group-right"]/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - $elements = $this->xpath('//div[@class="group-right"]/div[@class="field-label-inline"]'); - $this->assertTrimEqual($elements[0]->getText(), 'My body:'); - - $this->entitiesSetLabelClass('hidden', 'body'); - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="group-right"]/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - } - - /** - * Tests on field templates. - */ - public function testDsFieldTemplate3() { - // Get a node. - /** @var \Drupal\node\NodeInterface $node */ - $node = $this->entitiesTestSetup('hidden'); - $body_field = $node->body->value; - - // Custom field function with outer wrapper. - $edit = [ - 'fields[body][settings_edit_form][third_party_settings][ds][ft][id]' => 'expert', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-el]' => 'div', - ]; - $this->dsEditFormatterSettings($edit); - drupal_flush_all_caches(); - - // As long as we don't change anything in the UI, the default template will - // be used. - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="group-right"]/div/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - - // With outer div wrapper and class. - $edit = [ - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-cl]' => 'ow-class', - ]; - $this->dsEditFormatterSettings($edit); - drupal_flush_all_caches(); - - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="group-right"]/div[@class="ow-class"]/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - - // With outer span wrapper and class. - $edit = [ - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-el]' => 'span', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-cl]' => 'ow-class-2', - ]; - $this->dsEditFormatterSettings($edit); - drupal_flush_all_caches(); - - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="group-right"]/span[@class="ow-class-2"]/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - } - - /** - * Tests on field templates. - */ - public function testDsFieldTemplate4() { - // Get a node. - /** @var \Drupal\node\NodeInterface $node */ - $node = $this->entitiesTestSetup('hidden'); - $body_field = $node->body->value; - - // With outer wrapper and field items wrapper. - $edit = [ - 'fields[body][settings_edit_form][third_party_settings][ds][ft][id]' => 'expert', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-el]' => 'div', - ]; - $this->dsEditFormatterSettings($edit); - - drupal_flush_all_caches(); - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="group-right"]/div/div/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - - // With outer wrapper and field items div wrapper with class. - $edit = [ - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-cl]' => 'fi-class', - ]; - $this->dsEditFormatterSettings($edit); - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="group-right"]/div/div[@class="fi-class"]/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - - // With outer wrapper and field items span wrapper and class. - $edit = [ - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-el]' => 'span', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-cl]' => 'fi-class', - ]; - $this->dsEditFormatterSettings($edit); - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="group-right"]/div/span[@class="fi-class"]/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - - // With outer wrapper class and field items span wrapper and class. - $edit = [ - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-cl]' => 'ow-class', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-el]' => 'span', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-cl]' => 'fi-class', - ]; - $this->dsEditFormatterSettings($edit); - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="group-right"]/div[@class="ow-class"]/span[@class="fi-class"]/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - - // With outer wrapper span class and field items span wrapper and class. - $edit = [ - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-el]' => 'span', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-cl]' => 'ow-class', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-el]' => 'span', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-cl]' => 'fi-class-2', - ]; - $this->dsEditFormatterSettings($edit); - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="group-right"]/span[@class="ow-class"]/span[@class="fi-class-2"]/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - } - - /** - * Tests on field templates. - */ - public function testDsFieldTemplate5() { - // Get a node. - /** @var \Drupal\node\NodeInterface $node */ - $node = $this->entitiesTestSetup('hidden'); - $body_field = $node->body->value; - - // With field item div wrapper. - $edit = [ - 'fields[body][settings_edit_form][third_party_settings][ds][ft][id]' => 'expert', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi]' => '1', - ]; - $this->dsEditFormatterSettings($edit); - drupal_flush_all_caches(); - - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="group-right"]/div/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - - // With field item span wrapper. - $edit = [ - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-el]' => 'span', - ]; - $this->dsEditFormatterSettings($edit); - drupal_flush_all_caches(); - - $this->drupalGet('node/' . $node->id()); - - $elements = $this->xpath('//div[@class="group-right"]/span/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - - // With field item span wrapper and class. - $edit = [ - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-el]' => 'span', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-cl]' => 'fi-class', - ]; - $this->dsEditFormatterSettings($edit); - drupal_flush_all_caches(); - - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="group-right"]/span[@class="fi-class"]/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - - // With fis and fi. - $edit = [ - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-cl]' => 'fi-class-2', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-cl]' => 'fi-class', - ]; - $this->dsEditFormatterSettings($edit); - drupal_flush_all_caches(); - - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="group-right"]/div[@class="fi-class-2"]/div[@class="fi-class"]/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - - // With all wrappers. - $edit = [ - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-cl]' => 'ow-class', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-cl]' => 'fi-class-2', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-el]' => 'span', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-cl]' => 'fi-class', - ]; - $this->dsEditFormatterSettings($edit); - drupal_flush_all_caches(); - - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="group-right"]/div[@class="ow-class"]/div[@class="fi-class-2"]/span[@class="fi-class"]/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - - // With all wrappers and attributes. - $edit = [ - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-cl]' => 'ow-class', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-at]' => 'name="ow-att"', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-cl]' => 'fi-class-2', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-at]' => 'name="fis-att"', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-el]' => 'span', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-cl]' => 'fi-class', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-at]' => 'name="fi-at"', - ]; - $this->dsEditFormatterSettings($edit); - drupal_flush_all_caches(); - - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="group-right"]/div[@class="ow-class" and @name="ow-att"]/div[@class="fi-class-2" and @name="fis-att"]/span[@class="fi-class" and @name="fi-at"]/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - - // Remove attributes. - $edit = [ - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-cl]' => 'ow-class', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-at]' => '', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-cl]' => 'fi-class-2', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-at]' => '', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-el]' => 'span', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-cl]' => 'fi-class', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-at]' => '', - ]; - $this->dsEditFormatterSettings($edit); - - // Label tests with custom function. - $this->entitiesSetLabelClass('above', 'body'); - drupal_flush_all_caches(); - - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="group-right"]/div[@class="ow-class"]/div[@class="field-label-above"]'); - $this->assertTrimEqual($elements[0]->getText(), 'Body'); - $elements = $this->xpath('//div[@class="group-right"]/div[@class="ow-class"]/div[@class="fi-class-2"]/span[@class="fi-class"]/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - - $this->entitiesSetLabelClass('inline', 'body'); - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="group-right"]/div[@class="ow-class"]/div[@class="field-label-inline"]'); - $this->assertTrimEqual($elements[0]->getText(), 'Body'); - $elements = $this->xpath('//div[@class="group-right"]/div[@class="ow-class"]/div[@class="fi-class-2"]/span[@class="fi-class"]/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - - $this->entitiesSetLabelClass('above', 'body', 'My body'); - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="group-right"]/div[@class="ow-class"]/div[@class="field-label-above"]'); - $this->assertTrimEqual($elements[0]->getText(), 'My body'); - $elements = $this->xpath('//div[@class="group-right"]/div[@class="ow-class"]/div[@class="fi-class-2"]/span[@class="fi-class"]/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - - $this->entitiesSetLabelClass('inline', 'body', 'My body'); - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="group-right"]/div[@class="ow-class"]/div[@class="field-label-inline"]'); - $this->assertTrimEqual($elements[0]->getText(), 'My body'); - $elements = $this->xpath('//div[@class="group-right"]/div[@class="ow-class"]/div[@class="fi-class-2"]/span[@class="fi-class"]/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - - $this->entitiesSetLabelClass('inline', 'body', 'My body', '', TRUE); - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="group-right"]/div[@class="ow-class"]/div[@class="field-label-inline"]'); - $this->assertTrimEqual($elements[0]->getText(), 'My body:'); - $elements = $this->xpath('//div[@class="group-right"]/div[@class="ow-class"]/div[@class="fi-class-2"]/span[@class="fi-class"]/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - - $this->entitiesSetLabelClass('hidden', 'body'); - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="group-right"]/div[@class="ow-class"]/div[@class="fi-class-2"]/span[@class="fi-class"]/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - - // Test default classes on outer wrapper. - // @todo figure out a way to actually test this as the default cases don't - // have classes anymore. - $edit = [ - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-cl]' => 'ow-class', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-def-cl]' => '1', - ]; - $this->dsEditFormatterSettings($edit); - drupal_flush_all_caches(); - - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="group-right"]/div[@class="ow-class"]/div[@class="fi-class-2"]/span[@class="fi-class"]/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - - // Test default attributes on field item. - $edit = [ - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-el]' => 'div', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-cl]' => 'ow-class', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-def-at]' => '1', - ]; - $this->dsEditFormatterSettings($edit); - drupal_flush_all_caches(); - - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="group-right"]/div[@class="ow-class" and @data-quickedit-field-id="node/1/body/en/full"]/div[@class="fi-class-2"]/span[@class="fi-class"]/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - - // Use the test field theming function to test that this function is - // registered in the theme registry through ds_extras_theme(). - $edit = [ - 'fields[body][settings_edit_form][third_party_settings][ds][ft][id]' => 'ds_test_template', - ]; - - $this->dsEditFormatterSettings($edit); - drupal_flush_all_caches(); - - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="group-right"]'); - $this->assertTrimEqual($elements[0]->getText(), 'Testing field output through custom function'); - } - - /** - * Tests XSS on field templates. - */ - public function testDsFieldTemplateXss() { - // Get a node. - /** @var \Drupal\node\NodeInterface $node */ - $node = $this->entitiesTestSetup('hidden'); - - $edit = [ - 'fields[body][settings_edit_form][third_party_settings][ds][ft][id]' => 'expert', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi]' => '1', - ]; - $this->dsEditFormatterSettings($edit); - - // Inject XSS everywhere and see if it brakes. - $edit = [ - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][prefix]' => '<div class="not-stripped"><script>alert("XSS")</script>', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][suffix]' => '</div><script>alert("XSS")</script>', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-el]' => '<script>alert("XSS")</script>', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-cl]' => '<script>alert("XSS")</script>', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][ow-at]' => "name=\"<script>alert('XSS')</script>\"", - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-el]' => '<script>alert("XSS")</script>', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-cl]' => '<script>alert("XSS")</script>', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fis-at]' => "name=\"<script>alert('XSS')</script>\"", - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi]' => '1', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-el]' => '<script>alert("XSS")</script>', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-cl]' => '<script>alert("XSS")</script>', - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][fi-at]' => "name=\"<script>alert('XSS')</script>\"", - ]; - $this->dsEditFormatterSettings($edit); - drupal_flush_all_caches(); - - $this->drupalGet('node/' . $node->id()); - $this->assertSession()->responseNotContains('<script>alert("XSS")</script>'); - - // Verify the prefix/suffix is filtered but not escaped. - $elements = $this->xpath('//div[@class="not-stripped"]'); - $this->assertEquals(count($elements), 1, 'Stripped but not escaped'); - } - - /** - * Tests multiple field items. - */ - public function testDsMultipleFieldItems() { - // Get a node. - /** @var \Drupal\node\NodeInterface $node */ - $node = $this->entitiesTestSetup('hidden'); - - $edit = [ - 'fields[field_tags][region]' => 'right', - 'fields[field_tags][type]' => 'entity_reference_label', - ]; - $this->dsConfigureUi($edit, 'admin/structure/types/manage/article/display'); - - // Set expert field on. - $edit = [ - 'fields[field_tags][settings_edit_form][third_party_settings][ds][ft][id]' => 'expert', - 'fields[field_tags][settings_edit_form][third_party_settings][ds][ft][settings][fis]' => '1', - 'fields[field_tags][settings_edit_form][third_party_settings][ds][ft][settings][fis-cl]' => 'tags', - 'fields[field_tags][settings_edit_form][third_party_settings][ds][ft][settings][fi]' => '1', - 'fields[field_tags][settings_edit_form][third_party_settings][ds][ft][settings][fi-cl]' => 'tag', - ]; - $this->dsEditFormatterSettings($edit, 'field_tags'); - drupal_flush_all_caches(); - - // Add multiple tags. - $edit = [ - 'field_tags[0][target_id]' => 'Tag 1', - 'field_tags[1][target_id]' => 'Tag 2', - ]; - $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, 'Save and keep published'); - - // Count the found tags. - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="group-right"]/div[@class="tags"]/div[@class="tag"]'); - $this->assertEquals(count($elements), 2, '2 tags found'); - } - - /** - * Tests minimal template functionality. - */ - public function testFieldTemplateMinimal() { - // Get a node. - /** @var \Drupal\node\NodeInterface $node */ - $node = $this->entitiesTestSetup('hidden'); - $body_field = $node->body->value; - - $edit = [ - 'fields[body][region]' => 'right', - ]; - $this->dsConfigureUi($edit, 'admin/structure/types/manage/article/display'); - - // Set minimal template on. - $edit = [ - 'fields[body][settings_edit_form][third_party_settings][ds][ft][id]' => 'minimal', - ]; - $this->dsEditFormatterSettings($edit, 'body'); - drupal_flush_all_caches(); - - $this->drupalGet('node/' . $node->id()); - $elements = $this->xpath('//div[@class="group-right"]/div[@class="field field-name-body"]/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - - // Choose field classes. - $classes = [ - 'test_field_class', - '[node:nid]', - ]; - $edit = [ - 'fields[body][settings_edit_form][third_party_settings][ds][ft][settings][classes][]' => $classes, - ]; - $this->dsEditFormatterSettings($edit, 'body'); - drupal_flush_all_caches(); - - $this->drupalGet('node/' . $node->id()); - $classes = 'test_field_class ' . $node->id() . ' field field-name-body'; - $elements = $this->xpath('//div[@class="group-right"]/div[@class="' . $classes . '"]/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - - // Switch theme. - $this->container->get('theme_installer')->install(['ds_test_layout_theme']); - $config = \Drupal::configFactory()->getEditable('system.theme'); - $config->set('default', 'ds_test_layout_theme')->save(); - drupal_flush_all_caches(); - - // Go to the node. - $this->drupalGet('node/' . $node->id()); - $this->assertSession()->responseContains('minimal overridden in test theme!'); - $classes = 'test_field_class ' . $node->id() . ' field field-name-body'; - $elements = $this->xpath('//div[@class="group-right"]/div[@class="' . $classes . '"]/p'); - $this->assertTrimEqual($elements[0]->getText(), $body_field); - - } - -} diff --git a/web/modules/ds/tests/src/Functional/HiddenRegionTest.php b/web/modules/ds/tests/src/Functional/HiddenRegionTest.php deleted file mode 100644 index ae1f106f3a..0000000000 --- a/web/modules/ds/tests/src/Functional/HiddenRegionTest.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php - -namespace Drupal\Tests\ds\Functional; - -/** - * Tests for testing the hidden region option. - * - * @group ds - */ -class HiddenRegionTest extends FastTestBase { - - /** - * Tests hidden region functionality. - */ - public function testHiddenRegion() { - // Enable the hidden region option. - $edit = [ - 'fs3[hidden_region]' => TRUE, - ]; - $this->drupalPostForm('admin/structure/ds/settings', $edit, t('Save configuration')); - - $this->dsSelectLayout(); - - // Create a node. - $settings = ['type' => 'article']; - $node = $this->drupalCreateNode($settings); - - // Configure fields. - $fields = [ - 'fields[body][region]' => 'right', - 'fields[test_field][region]' => 'ds_hidden', - ]; - $this->dsConfigureUi($fields); - - // Test field not printed. - $this->drupalGet('node/' . $node->id()); - $this->assertSession()->pageTextNotContains('Test field plugin on node ' . $node->id()); - - // Configure fields. - $fields = [ - 'fields[body][region]' => 'right', - 'fields[test_field][region]' => 'right', - ]; - $this->dsConfigureUi($fields); - - // Test field printed. - $this->drupalGet('node/' . $node->id()); - $this->assertSession()->pageTextContains('Test field plugin on node ' . $node->id()); - } - -} diff --git a/web/modules/ds/tests/src/Functional/LayoutClassesTest.php b/web/modules/ds/tests/src/Functional/LayoutClassesTest.php deleted file mode 100644 index 6aa9d85194..0000000000 --- a/web/modules/ds/tests/src/Functional/LayoutClassesTest.php +++ /dev/null @@ -1,231 +0,0 @@ -<?php - -namespace Drupal\Tests\ds\Functional; - -use Drupal\Core\Entity\Entity\EntityViewDisplay; - -/** - * Tests for managing layouts and classes on Field UI screen. - * - * @group ds - */ -class LayoutClassesTest extends FastTestBase { - - /** - * {@inheritdoc} - */ - protected function setup() { - parent::setup(); - - // Set extra fields. - \Drupal::configFactory()->getEditable('ds_extras.settings') - ->set('region_to_block', TRUE) - ->set('fields_extra', TRUE) - ->set('fields_extra_list', ['node|article|ds_extras_extra_test_field', 'node|article|ds_extras_second_field']) - ->save(); - - \Drupal::service('entity_field.manager')->clearCachedFieldDefinitions(); - } - - /** - * Test selecting layouts, classes, region to block and fields. - */ - public function testDsTestLayouts() { - // Check that the ds_3col_equal_width layout is not available (through the - // alter). - $this->drupalGet('admin/structure/types/manage/article/display'); - $this->assertSession()->responseNotContains('ds_3col_stacked_equal_width'); - - // Create code and block field. - $this->dsCreateTokenField(); - $this->dsCreateBlockField(); - - $layout = [ - 'layout' => 'ds_2col_stacked', - ]; - - $assert = [ - 'regions' => [ - 'header' => '<td colspan="8">' . t('Header') . '</td>', - 'left' => '<td colspan="8">' . t('Left') . '</td>', - 'right' => '<td colspan="8">' . t('Right') . '</td>', - 'footer' => '<td colspan="8">' . t('Footer') . '</td>', - ], - ]; - - $fields = [ - 'fields[node_post_date][region]' => 'header', - 'fields[node_author][region]' => 'left', - 'fields[node_links][region]' => 'left', - 'fields[body][region]' => 'right', - 'fields[dynamic_token_field:node-test_field][region]' => 'left', - 'fields[dynamic_block_field:node-test_block_field][region]' => 'left', - 'fields[node_submitted_by][region]' => 'left', - 'fields[ds_extras_extra_test_field][region]' => 'header', - ]; - - // Setup first layout. - $this->dsSelectLayout($layout, $assert); - $this->dsConfigureClasses(); - $this->dsSelectClasses(); - $this->dsConfigureUi($fields); - - // Assert the two extra fields are found. - $this->drupalGet('admin/structure/types/manage/article/display'); - $this->assertSession()->responseContains('ds_extras_extra_test_field'); - $this->assertSession()->responseContains('ds_extras_second_field'); - - // Assert we have configuration. - $entity_manager = \Drupal::entityTypeManager(); - /** @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface $entity_display */ - $entity_display = $entity_manager->getStorage('entity_view_display')->load('node.article.default'); - $data = $entity_display->getThirdPartySettings('ds'); - - $this->assertTrue(!empty($data), t('Configuration found for layout settings for node article')); - $this->assertTrue(in_array('ds_extras_extra_test_field', $data['regions']['header']), t('Extra field is in header')); - $this->assertTrue(in_array('node_post_date', $data['regions']['header']), t('Post date is in header')); - $this->assertTrue(in_array('dynamic_token_field:node-test_field', $data['regions']['left']), t('Test field is in left')); - $this->assertTrue(in_array('node_author', $data['regions']['left']), t('Author is in left')); - $this->assertTrue(in_array('node_links', $data['regions']['left']), t('Links is in left')); - $this->assertTrue(in_array('dynamic_block_field:node-test_block_field', $data['regions']['left']), t('Test block field is in left')); - $this->assertTrue(in_array('body', $data['regions']['right']), t('Body is in right')); - $this->assertTrue(in_array('class_name_1', $data['layout']['settings']['classes']['header']), t('Class name 1 is in header')); - $this->assertTrue(empty($data['layout']['settings']['classes']['left']), t('Left has no classes')); - $this->assertTrue(empty($data['layout']['settings']['classes']['right']), t('Right has classes')); - $this->assertTrue(in_array('class_name_2', $data['layout']['settings']['classes']['footer']), t('Class name 2 is in header')); - - // Create a article node and verify settings. - $settings = [ - 'type' => 'article', - ]; - $node = $this->drupalCreateNode($settings); - $this->drupalGet('node/' . $node->id()); - - // Assert default classes. - $this->assertSession()->responseContains('node node--type-article node--view-mode-full'); - - // Assert regions. - $this->assertSession()->responseContains('group-header'); - $this->assertSession()->responseContains('class_name_1 group-header'); - $this->assertSession()->responseContains('group-left'); - $this->assertSession()->responseContains('group-right'); - $this->assertSession()->responseContains('group-footer'); - $this->assertSession()->responseContains('class_name_2 group-footer'); - - // Assert custom fields. - $this->assertSession()->responseContains('field--name-dynamic-token-fieldnode-test-field'); - $this->assertSession()->responseContains('field--name-dynamic-block-fieldnode-test-block-field'); - - $this->assertSession()->responseContains('Submitted by'); - $this->assertSession()->pageTextContains('This is an extra field made available through "Extra fields" functionality.'); - - // Test HTML5 wrappers. - $this->assertSession()->responseNotContains('<header class="class_name_1 group-header'); - $this->assertSession()->responseNotContains('<footer class="group-right'); - $this->assertSession()->responseNotContains('<article'); - $wrappers = [ - 'layout_configuration[region_wrapper][header]' => 'header', - 'layout_configuration[region_wrapper][right]' => 'footer', - 'layout_configuration[region_wrapper][outer_wrapper]' => 'article', - ]; - $this->dsConfigureUi($wrappers); - $this->drupalGet('node/' . $node->id()); - $this->assertSession()->responseContains('<header class="class_name_1 group-header'); - $this->assertSession()->responseContains('<footer class="group-right'); - $this->assertSession()->responseContains('<article'); - - // Remove all the node classes. - $edit = ['entity_classes' => 'no_classes']; - $this->drupalPostForm('admin/structure/types/manage/article/display', $edit, t('Save')); - $this->drupalGet('node/' . $node->id()); - - // Assert that there are no entity classes. - $this->assertSession()->responseNotContains('node node--type-article node--view-mode-full'); - - // Only show view mode (deprecated). - $edit = ['entity_classes' => 'old_view_mode']; - $this->drupalPostForm('admin/structure/types/manage/article/display', $edit, t('Save')); - $this->drupalGet('node/' . $node->id()); - - // Assert that the old view mode class name is added (deprecated). - $this->assertSession()->responseContains('view-mode-full'); - - // Let's create a block field, enable the full mode first. - $edit = ['display_modes_custom[full]' => '1']; - $this->drupalPostForm('admin/structure/types/manage/article/display', $edit, t('Save')); - - // Select layout. - $layout = [ - 'layout' => 'ds_2col', - ]; - - $assert = [ - 'regions' => [ - 'left' => '<td colspan="8">' . t('Left') . '</td>', - 'right' => '<td colspan="8">' . t('Right') . '</td>', - ], - ]; - $this->dsSelectLayout($layout, $assert, 'admin/structure/types/manage/article/display/full'); - - // Create new block field. - $edit = [ - 'new_block_region' => 'Block region', - 'new_block_region_key' => 'block_region', - ]; - $this->drupalPostForm('admin/structure/types/manage/article/display/full', $edit, t('Save')); - $this->assertSession()->responseContains('<td colspan="9">' . t('Block region') . '</td>'); - - // Configure fields. - $fields = [ - 'fields[node_author][region]' => 'left', - 'fields[node_links][region]' => 'left', - 'fields[body][region]' => 'right', - 'fields[dynamic_token_field:node-test_field][region]' => 'block_region', - ]; - $this->dsConfigureUi($fields, 'admin/structure/types/manage/article/display/full'); - - // Change layout via admin/structure/ds/layout-change. - // First verify that header and footer are not here. - $this->drupalGet('admin/structure/types/manage/article/display/full'); - $this->assertSession()->responseNotContains('<td colspan="8">' . t('Header') . '</td>'); - $this->assertSession()->responseNotContains('<td colspan="8">' . t('Footer') . '</td>'); - - // Remap the regions. - $edit = [ - 'ds_left' => 'header', - 'ds_right' => 'footer', - 'ds_block_region' => 'footer', - ]; - $this->drupalPostForm('admin/structure/ds/change-layout/node/article/full/ds_2col_stacked', $edit, t('Save')); - $this->drupalGet('admin/structure/types/manage/article/display/full'); - - // Verify new regions. - $this->assertSession()->responseContains('<td colspan="9">' . t('Header') . '</td>'); - $this->assertSession()->responseContains('<td colspan="9">' . t('Footer') . '</td>'); - $this->assertSession()->responseContains('<td colspan="9">' . t('Block region') . '</td>'); - - // Verify settings. - /** @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface $entity_display */ - $entity_display = EntityViewDisplay::load('node.article.full'); - $data = $entity_display->getThirdPartySettings('ds'); - $this->assertTrue(in_array('node_author', $data['regions']['header']), t('Author is in header')); - $this->assertTrue(in_array('node_links', $data['regions']['header']), t('Links field is in header')); - $this->assertTrue(in_array('body', $data['regions']['footer']), t('Body field is in footer')); - $this->assertTrue(in_array('dynamic_token_field:node-test_field', $data['regions']['footer']), t('Test field is in footer')); - - // Test that a default view mode with no layout is not affected by a - // disabled view mode. - $edit = [ - 'layout' => '_none', - 'display_modes_custom[full]' => FALSE, - ]; - $this->drupalPostForm('admin/structure/types/manage/article/display', $edit,'Save'); - - $elements = $this->xpath('//*[@id="edit-fields-body-region"]'); - - $this->assertTrue($elements[0]->find('xpath', '//option[@value = "content" and @selected = "selected"]')); - $this->drupalGet('node/' . $node->id()); - $this->assertSession()->pageTextNotContains('Test code field on node 1'); - } - -} diff --git a/web/modules/ds/tests/src/Functional/LayoutFluidTest.php b/web/modules/ds/tests/src/Functional/LayoutFluidTest.php deleted file mode 100644 index 6e303981bc..0000000000 --- a/web/modules/ds/tests/src/Functional/LayoutFluidTest.php +++ /dev/null @@ -1,93 +0,0 @@ -<?php - -namespace Drupal\Tests\ds\Functional; - -/** - * Tests DS layout plugins. - * - * @group ds - */ -class LayoutFluidTest extends FastTestBase { - - /** - * Test fluid Display Suite layouts. - */ - public function testFluidLayout() { - // Assert our 2 tests layouts are found. - $this->drupalGet('admin/structure/types/manage/article/display'); - $this->assertSession()->responseContains('Test Fluid two column'); - - $layout = [ - 'layout' => 'dstest_2col_fluid', - ]; - - $assert = [ - 'regions' => [ - 'left' => '<td colspan="8">' . t('Left') . '</td>', - 'right' => '<td colspan="8">' . t('Right') . '</td>', - ], - ]; - - $fields = [ - 'fields[node_author][region]' => 'left', - 'fields[node_links][region]' => 'left', - 'fields[body][region]' => 'left', - ]; - - $this->dsSelectLayout($layout, $assert); - $this->dsConfigureUi($fields); - - // Create a node. - $settings = ['type' => 'article']; - $node = $this->drupalCreateNode($settings); - - $this->drupalGet('node/' . $node->id()); - $this->assertSession()->responseContains('group-left'); - $this->assertSession()->responseNotContains('group-right'); - $this->assertSession()->responseContains('group-one-column'); - $this->assertSession()->responseContains('dstest-2col-fluid.css'); - - // Add fields to the right column. - $fields = [ - 'fields[node_author][region]' => 'left', - 'fields[node_links][region]' => 'left', - 'fields[body][region]' => 'right', - ]; - - $this->dsSelectLayout($layout, $assert); - $this->dsConfigureUi($fields); - - $this->drupalGet('node/' . $node->id()); - $this->assertSession()->responseContains('group-left'); - $this->assertSession()->responseContains('group-right'); - $this->assertSession()->responseNotContains('group-one-column'); - - // Move all fields to the right column. - $fields = [ - 'fields[node_author][region]' => 'right', - 'fields[node_links][region]' => 'right', - 'fields[heavy_field][region]' => 'right', - 'fields[body][region]' => 'right', - ]; - - $this->dsSelectLayout($layout, $assert); - $this->dsConfigureUi($fields); - - $this->drupalGet('node/' . $node->id()); - $this->assertSession()->responseNotContains('group-left'); - $this->assertSession()->responseContains('group-right'); - $this->assertSession()->responseContains('group-one-column'); - - // Remove the css - $fields = [ - 'disable_css' => TRUE, - ]; - - $this->dsSelectLayout($layout, $assert); - $this->dsConfigureUi($fields); - - $this->drupalGet('node/' . $node->id()); - $this->assertSession()->responseNotContains('dstest-2col-fluid.css'); - } - -} diff --git a/web/modules/ds/tests/src/Functional/LayoutPluginTest.php b/web/modules/ds/tests/src/Functional/LayoutPluginTest.php deleted file mode 100644 index 8f1d9352db..0000000000 --- a/web/modules/ds/tests/src/Functional/LayoutPluginTest.php +++ /dev/null @@ -1,136 +0,0 @@ -<?php - -namespace Drupal\Tests\ds\Functional; - -/** - * Tests DS layout plugins. - * - * @group ds - */ -class LayoutPluginTest extends FastTestBase { - - /** - * Test basic Display Suite layout plugins. - */ - public function testFieldPlugin() { - // Assert our 2 tests layouts are found. - $this->drupalGet('admin/structure/types/manage/article/display'); - $this->assertSession()->responseContains('Test One column'); - $this->assertSession()->responseContains('Test Two column'); - - $layout = [ - 'layout' => 'dstest_2col', - ]; - - $assert = [ - 'regions' => [ - 'left' => '<td colspan="8">' . t('Left') . '</td>', - 'right' => '<td colspan="8">' . t('Right') . '</td>', - ], - ]; - - $fields = [ - 'fields[node_author][region]' => 'left', - 'fields[node_links][region]' => 'left', - 'fields[body][region]' => 'right', - ]; - - $this->dsSelectLayout($layout, $assert); - $this->dsConfigureUi($fields); - - // Create a node. - $settings = ['type' => 'article']; - $node = $this->drupalCreateNode($settings); - - $this->drupalGet('node/' . $node->id()); - $this->assertSession()->responseContains('group-left'); - $this->assertSession()->responseContains('group-right'); - $this->assertSession()->responseContains('dstest-2col.css'); - - // Alter a region. - $settings = [ - 'type' => 'article', - 'title' => 'Alter me!', - ]; - $node = $this->drupalCreateNode($settings); - $this->drupalGet('node/' . $node->id()); - $this->assertSession()->responseContains('cool!'); - } - - /** - * Test reset layout. - */ - public function testResetLayout() { - $layout = [ - 'layout' => 'ds_reset', - ]; - - $assert = [ - 'regions' => [ - 'ds_content' => '<td colspan="8">' . t('Content') . '</td>', - ], - ]; - - $fields = [ - 'fields[node_author][region]' => 'ds_content', - ]; - - $this->dsSelectLayout($layout, $assert); - $this->dsConfigureUi($fields); - - // Create a node. - $settings = ['type' => 'article']; - $node = $this->drupalCreateNode($settings); - - $this->drupalGet('node/' . $node->id()); - } - - /** - * Tests settings default wrappers. - */ - public function testDefaultWrappers() { - // Create a node. - $settings = ['type' => 'article']; - $node = $this->drupalCreateNode($settings); - - // Select a layout. - $this->dsSelectLayout(); - - // Go to the node. - $this->drupalGet('node/' . $node->id()); - - // Check we don't have empty wrappers. - $this->assertSession()->responseNotContains('<>'); - - // Select 1 col wrapper. - $assert = [ - 'regions' => [ - 'ds_content' => '<td colspan="8">' . t('Content') . '</td>', - ], - ]; - $this->dsSelectLayout(['layout' => 'ds_1col'], $assert); - - // Go to the node. - $this->drupalGet('node/' . $node->id()); - - // Check we don't have empty wrappers. - $elements = $this->xpath('//div[@class="node node--type-article node--view-mode-full ds-1col clearfix"]/div/p'); - $this->assertTrue(count($elements) == 1); - $this->assertTrimEqual($elements[0]->getText(), $node->get('body')->value); - - // Switch theme. - $this->container->get('theme_installer')->install(['ds_test_layout_theme']); - $config = \Drupal::configFactory()->getEditable('system.theme'); - $config->set('default', 'ds_test_layout_theme')->save(); - drupal_flush_all_caches(); - - // Go to the node. - $this->drupalGet('node/' . $node->id()); - $this->assertSession()->responseContains('id="overridden-ds-1-col-template"'); - $elements = $this->xpath('//div[@class="node node--type-article node--view-mode-full ds-1col clearfix"]/div/p'); - $this->assertTrue(count($elements) == 1); - $this->assertTrimEqual($elements[0]->getText(), $node->get('body')->value); - - } - -} diff --git a/web/modules/ds/tests/src/Functional/ManageDisplayTabTest.php b/web/modules/ds/tests/src/Functional/ManageDisplayTabTest.php deleted file mode 100644 index 1af646aca6..0000000000 --- a/web/modules/ds/tests/src/Functional/ManageDisplayTabTest.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php - -namespace Drupal\Tests\ds\Functional; - -/** - * Tests for the manage display tab in Display Suite. - * - * @group ds - */ -class ManageDisplayTabTest extends FastTestBase { - - /** - * Test tabs. - */ - public function testFieldPlugin() { - /* @var \Drupal\node\NodeInterface $node */ - $node = $this->entitiesTestSetup(); - - // Verify we can see the manage display tab on a node and can click on it. - $this->drupalGet('node/' . $node->id()); - $this->assertSession()->responseContains('Manage display'); - $this->assertSession()->responseContains('node/' . $node->id() . '/manage-display'); - $this->drupalGet('node/' . $node->id() . '/manage-display'); - - // Verify we can see the manage display tab on a user and can click on it. - $this->drupalGet('user/' . $this->adminUser->id()); - $this->assertSession()->responseContains('Manage display'); - $this->assertSession()->responseContains('user/' . $this->adminUser->id() . '/manage-display'); - $this->drupalGet('user/' . $this->adminUser->id() . '/manage-display'); - - // Verify we can see the manage display tab on a taxonomy term and can click - // on it. - $this->drupalGet('taxonomy/term/1'); - $this->assertSession()->responseContains('Manage display'); - $this->assertSession()->responseContains('taxonomy/term/1/manage-display'); - $this->drupalGet('taxonomy/term/1/manage-display'); - } - -} diff --git a/web/modules/ds/tests/src/Functional/RdfTest.php b/web/modules/ds/tests/src/Functional/RdfTest.php deleted file mode 100644 index 956883e41e..0000000000 --- a/web/modules/ds/tests/src/Functional/RdfTest.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php - -namespace Drupal\Tests\ds\Functional; - -/** - * Tests for Rdf integration. - * - * @group ds - */ -class RdfTest extends FastTestBase { - - /** - * Modules to install. - * - * @var array - */ - public static $modules = [ - 'node', - 'field_ui', - 'ds', - 'rdf', - ]; - - /** - * Test rdf integration. - */ - public function testRdf() { - \Drupal::service('module_installer')->install(['ds_test_rdf']); - - /* @var \Drupal\node\NodeInterface $node */ - $node = $this->entitiesTestSetup(); - - // Look at node and verify the rdf tags are available. - $this->drupalGet('node/' . $node->id()); - - $this->assertSession()->responseContains('typeof="schema:Article'); - } - -} diff --git a/web/modules/ds/tests/src/Functional/TwigRenderTest.php b/web/modules/ds/tests/src/Functional/TwigRenderTest.php deleted file mode 100644 index e9ca367af9..0000000000 --- a/web/modules/ds/tests/src/Functional/TwigRenderTest.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php - -namespace Drupal\Tests\ds\Functional; - -/** - * Tests for twig specific functionality. - * - * @group ds - */ -class TwigRenderTest extends FastTestBase { - - /** - * Tests targeting the field in a twig template. - */ - public function testFieldNameTargeting() { - // Create a node. - $settings = ['type' => 'article', 'promote' => 1]; - /* @var \Drupal\node\NodeInterface $node */ - $node = $this->drupalCreateNode($settings); - - // Configure layout. - $layout = [ - 'layout' => 'dstest_1col_title', - ]; - $layout_assert = [ - 'regions' => [ - 'ds_content' => '<td colspan="8">' . t('Content') . '</td>', - ], - ]; - $this->dsSelectLayout($layout, $layout_assert); - - $fields = [ - 'fields[node_title][region]' => 'ds_content', - ]; - $this->dsConfigureUi($fields); - - $this->drupalGet('node/' . $node->id()); - - // Assert that the title is visible. - $elements = $this->xpath('//div[@class="field field--name-node-title field--type-ds field--label-hidden field__item"]/h2'); - $this->assertEquals(count($elements), 1); - - $this->assertSession()->pageTextContains($node->getTitle()); - - $edit = [ - 'fs3[use_field_names]' => FALSE, - ]; - $this->drupalPostForm('admin/structure/ds/settings', $edit, 'Save configuration'); - - $this->drupalGet('node/' . $node->id()); - - // Assert that the title is not visible anymore. - $elements = $this->xpath('//div[@class="field field--name-node-title field--type-ds field--label-hidden field__item"]/h2'); - $this->assertEquals(count($elements), 0); - } - -} diff --git a/web/modules/ds/tests/src/Functional/UserTest.php b/web/modules/ds/tests/src/Functional/UserTest.php deleted file mode 100644 index 18edac37d2..0000000000 --- a/web/modules/ds/tests/src/Functional/UserTest.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php - -namespace Drupal\Tests\ds\Functional; - -/** - * Tests user functionality - * - * @group ds - */ -class UserTest extends FastTestBase { - - /** - * Tests hook_ds_pre_render_alter() with user entities - */ - public function testCompatibility() { - - // Create a test user. - /** @var \Drupal\user\UserInterface $new_user */ - $new_user = $this->drupalCreateUser([ - 'access content', - ]); - - $this->dsSelectLayout([], [],'admin/config/people/accounts/display'); - - $fields = [ - 'fields[username][region]' => 'right', - ]; - - $this->dsConfigureUi($fields,'admin/config/people/accounts/display'); - - $this->drupalGet('user/' . $new_user->id()); - - $this->assertSession()->responseContains('entity-label-class-' . $new_user->label()); - } - -} diff --git a/web/modules/ds/tests/src/Functional/ViewsTest.php b/web/modules/ds/tests/src/Functional/ViewsTest.php deleted file mode 100644 index 848b5c635d..0000000000 --- a/web/modules/ds/tests/src/Functional/ViewsTest.php +++ /dev/null @@ -1,180 +0,0 @@ -<?php - -namespace Drupal\Tests\ds\Functional; - -use Drupal\views\Tests\ViewTestData; -use Drupal\views\ViewExecutable; - -/** - * Tests for Display Suite Views integration. - * - * @group ds - */ -class ViewsTest extends FastTestBase { - - /** - * Modules to install. - * - * @var array - */ - public static $modules = [ - 'node', - 'field_ui', - 'taxonomy', - 'block', - 'ds', - 'ds_test', - 'views', - 'views_ui', - ]; - - /** - * Views used by this test. - * - * @var array - */ - public static $testViews = ['ds-testing']; - - /** - * {@inheritdoc} - */ - protected function setUp() { - parent::setUp(); - - // Ensure that the plugin definitions are cleared. - foreach (ViewExecutable::getPluginTypes() as $plugin_type) { - $this->container->get("plugin.manager.views.$plugin_type")->clearCachedDefinitions(); - } - - ViewTestData::createTestViews(get_class($this), ['ds_test']); - } - - /** - * Test views integration. - */ - public function testDsViews() { - $tag1 = $this->createTerm($this->vocabulary); - $tag2 = $this->createTerm($this->vocabulary); - - $edit_tag_1 = [ - 'field_tags[0][target_id]' => $tag1->getName(), - ]; - $edit_tag_2 = [ - 'field_tags[0][target_id]' => $tag2->getName(), - ]; - - // Create 3 nodes. - $settings_1 = [ - 'type' => 'article', - 'title' => 'Article 1', - 'created' => \Drupal::time()->getRequestTime(), - ]; - $node_1 = $this->drupalCreateNode($settings_1); - $this->drupalPostForm('node/' . $node_1->id() . '/edit', $edit_tag_1, t('Save and keep published')); - $settings_2 = [ - 'type' => 'article', - 'title' => 'Article 2', - 'created' => \Drupal::time()->getRequestTime() + 3600, - ]; - $node_2 = $this->drupalCreateNode($settings_2); - $this->drupalPostForm('node/' . $node_2->id() . '/edit', $edit_tag_1, t('Save and keep published')); - $settings_3 = [ - 'type' => 'article', - 'title' => 'Article 3', - 'created' => \Drupal::time()->getRequestTime() + 7200, - ]; - $node_3 = $this->drupalCreateNode($settings_3); - $this->drupalPostForm('node/' . $node_3->id() . '/edit', $edit_tag_2, t('Save and keep published')); - - // Configure teaser and full layout. - $layout = [ - 'layout' => 'ds_2col', - ]; - $fields = [ - 'fields[node_title][region]' => 'left', - 'fields[body][region]' => 'right', - ]; - $assert = [ - 'regions' => [ - 'left' => '<td colspan="8">' . t('Left') . '</td>', - 'right' => '<td colspan="8">' . t('Right') . '</td>', - ], - ]; - $this->dsSelectLayout($layout, $assert, 'admin/structure/types/manage/article/display/teaser'); - $this->dsConfigureUi($fields, 'admin/structure/types/manage/article/display/teaser'); - $layout = [ - 'layout' => 'ds_4col', - ]; - $fields = [ - 'fields[node_post_date][region]' => 'first', - 'fields[body][region]' => 'second', - 'fields[node_author][region]' => 'third', - 'fields[node_links][region]' => 'fourth', - ]; - $assert = [ - 'regions' => [ - 'first' => '<td colspan="8">' . t('First') . '</td>', - 'second' => '<td colspan="8">' . t('Second') . '</td>', - 'third' => '<td colspan="8">' . t('Third') . '</td>', - 'fourth' => '<td colspan="8">' . t('Fourth') . '</td>', - ], - ]; - $this->dsSelectLayout($layout, $assert); - $this->dsConfigureUi($fields); - - // Get default teaser view. - $this->drupalGet('ds-testing'); - foreach (['group-left', 'group-right'] as $region) { - $this->assertSession()->responseContains($region); - } - $this->assertSession()->responseContains('Article 1'); - $this->assertSession()->responseContains('Article 2'); - $this->assertSession()->responseContains('Article 3'); - - // Get alternating view. - $this->drupalGet('ds-testing-2'); - $regions = [ - 'group-left', - 'group-right', - 'first', - 'second', - 'third', - 'fourth', - ]; - foreach ($regions as $region) { - $this->assertSession()->responseContains($region); - } - $this->assertSession()->responseNotContains('Article 1'); - $this->assertSession()->responseContains('Article 2'); - $this->assertSession()->responseContains('Article 3'); - - // Get grouping view (without changing header function). - $this->drupalGet('ds-testing-3'); - foreach (['group-left', 'group-right'] as $region) { - $this->assertSession()->responseContains($region); - } - $this->assertSession()->responseContains('Article 1'); - $this->assertSession()->responseContains('Article 2'); - $this->assertSession()->responseContains('Article 3'); - $this->assertSession()->responseContains('<h2 class="grouping-title">' . $tag1->id() . '</h2>'); - $this->assertSession()->responseContains('<h2 class="grouping-title">' . $tag2->id() . '</h2>'); - - // Get grouping view (with changing header function). - $this->drupalGet('ds-testing-4'); - foreach (['group-left', 'group-right'] as $region) { - $this->assertSession()->responseContains($region); - } - $this->assertSession()->responseContains('Article 1'); - $this->assertSession()->responseContains('Article 2'); - $this->assertSession()->responseContains('Article 3'); - $this->assertSession()->responseContains('<h2 class="grouping-title">' . $tag1->getName() . '</h2>'); - $this->assertSession()->responseContains('<h2 class="grouping-title">' . $tag2->getName() . '</h2>'); - - // Get advanced function view. - $this->drupalGet('ds-testing-5'); - $this->assertSession()->responseContains('Advanced display for id 1'); - $this->assertSession()->responseContains('Advanced display for id 2'); - $this->assertSession()->responseContains('Advanced display for id 3'); - } - -} diff --git a/web/modules/ds/tests/src/FunctionalJavascript/JavascriptTest.php b/web/modules/ds/tests/src/FunctionalJavascript/JavascriptTest.php deleted file mode 100644 index c7fd88b8ff..0000000000 --- a/web/modules/ds/tests/src/FunctionalJavascript/JavascriptTest.php +++ /dev/null @@ -1,94 +0,0 @@ -<?php - -namespace Drupal\Tests\ds\FunctionalJavascript; - -use Drupal\Core\Entity\Entity\EntityViewDisplay; -use Drupal\FunctionalJavascriptTests\JavascriptTestBase; - -/** - * Tests javascript behavior for the admin UI. - * - * @group ds - */ -class JavascriptTest extends JavascriptTestBase { - - /** - * {@inheritdoc} - */ - public static $modules = [ - 'node', - 'user', - 'field_ui', - 'ds', - ]; - - /** - * The created user. - * - * @var \Drupal\user\UserInterface - */ - protected $adminUser; - - /** - * {@inheritdoc} - */ - protected function setUp() { - parent::setUp(); - - // Create a test user. - $this->adminUser = $this->drupalCreateUser([ - 'access content', - 'admin display suite', - 'admin fields', - 'administer nodes', - 'administer content types', - 'administer node fields', - 'administer node form display', - 'administer node display', - ]); - $this->drupalLogin($this->adminUser); - - $this->drupalCreateContentType([ - 'type' => 'article', - 'name' => 'Article', - ]); - - } - - /** - * Test DS settings. - */ - public function testSettings() { - // Go to the article manage display page. - $this->drupalGet('admin/structure/types/manage/article/display'); - $page = $this->getSession()->getPage(); - - // Change the layout to 2 column layout and wait for it to be changed, see - // if the new template is displayed. - $page->selectFieldOption('layout', 'ds_2col'); - $this->assertSession()->assertWaitOnAjaxRequest(); - $this->assertSession()->pageTextContains('ds-2col--node.html.twig'); - $page->pressButton('Save'); - - $this->drupalGet('admin/structure/types/manage/article/display'); - $this->assertSession()->fieldValueEquals('fields[body][region]', 'left'); - - // Check that all settings are saved. - /** @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display */ - $display = EntityViewDisplay::load('node.article.default'); - $settings = $display->getThirdPartySetting('ds', 'layout'); - $this->assertSame($settings['id'], 'ds_2col'); - - // Switch back to not using a layout. - $page->selectFieldOption('layout', ''); - $this->assertSession()->assertWaitOnAjaxRequest(); - $page->pressButton('Save'); - - $this->drupalGet('admin/structure/types/manage/article/display'); - $this->assertSession()->fieldValueEquals('fields[body][region]', 'content'); - - $display = EntityViewDisplay::load('node.article.default'); - $this->assertSame('content', $display->getComponent('body')['region']); - } - -} diff --git a/web/modules/ds/tests/src/Unit/DsServiceTest.php b/web/modules/ds/tests/src/Unit/DsServiceTest.php deleted file mode 100644 index 1b94914333..0000000000 --- a/web/modules/ds/tests/src/Unit/DsServiceTest.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php - -namespace Drupal\Tests\ds\Unit; - -use Drupal\ds\Ds; -use Drupal\Tests\UnitTestCase; - -/** - * @coversDefaultClass \Drupal\ds\Ds - * @group ds - */ -class DsServiceTest extends UnitTestCase { - - /** - * @covers ::getLayouts - */ - public function testMissingLayoutService() { - $this->assertFalse(\Drupal::hasService('plugin.manager.core.layout')); - $this->assertSame([], Ds::getLayouts()); - } - -} diff --git a/web/modules/ds/tests/themes/ds_test_layout_theme/ds_test_layout_theme.info.yml b/web/modules/ds/tests/themes/ds_test_layout_theme/ds_test_layout_theme.info.yml deleted file mode 100644 index e147312dbd..0000000000 --- a/web/modules/ds/tests/themes/ds_test_layout_theme/ds_test_layout_theme.info.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: 'DS Test layout theme' -type: theme -description: 'Theme for testing a theme-provided layout' -base theme: classy -# core: 8.x - -# Information added by Drupal.org packaging script on 2017-05-24 -version: '8.x-3.1' -core: '8.x' -project: 'ds' -datestamp: 1495660091 diff --git a/web/modules/ds/tests/themes/ds_test_layout_theme/ds_test_layout_theme.layouts.yml b/web/modules/ds/tests/themes/ds_test_layout_theme/ds_test_layout_theme.layouts.yml deleted file mode 100644 index d333e381e7..0000000000 --- a/web/modules/ds/tests/themes/ds_test_layout_theme/ds_test_layout_theme.layouts.yml +++ /dev/null @@ -1,8 +0,0 @@ -ds_test_layout_theme: - label: 'DS Test Layout - Theme' - category: 'Test Layout Theme' - template: templates/ds-test-layout-theme - class: '\Drupal\ds\Plugin\DsLayout' - regions: - ds_content: - label: Content diff --git a/web/modules/ds/tests/themes/ds_test_layout_theme/templates/ds-1col--node.html.twig b/web/modules/ds/tests/themes/ds_test_layout_theme/templates/ds-1col--node.html.twig deleted file mode 100644 index c18dbc46f5..0000000000 --- a/web/modules/ds/tests/themes/ds_test_layout_theme/templates/ds-1col--node.html.twig +++ /dev/null @@ -1,18 +0,0 @@ -{# -/** - * @file - * Display Suite 1 column template. - * - * Available variables: - * - ds_content_wrapper: wrapper around content - * - attributes: content region attributes - * - ds_content: content region - */ -#} -<{{ ds_content_wrapper }}{{ attributes.addClass('ds-1col', 'clearfix') }} id="overridden-ds-1-col-template"> - - {{ title_suffix.contextual_links }} - - {{ ds_content }} - -</{{ ds_content_wrapper }}> diff --git a/web/modules/ds/tests/themes/ds_test_layout_theme/templates/ds-field-minimal.html.twig b/web/modules/ds/tests/themes/ds_test_layout_theme/templates/ds-field-minimal.html.twig deleted file mode 100644 index ba4c09614a..0000000000 --- a/web/modules/ds/tests/themes/ds_test_layout_theme/templates/ds-field-minimal.html.twig +++ /dev/null @@ -1,34 +0,0 @@ -{# -/** - * @file - * Template to provide minimal HTML for the field. - * - * Available variables: - * - element: The field element. - * - label: The label of the field. - * - settings: The settings for the field. - * - items: List of all the field items. Each item contains: - * - attributes: List of HTML attributes for each item. - * - content: The field item's content. - */ -#} -{% - set classes = [ - 'field', - 'field-name-' ~ element['#field_name']|clean_class, - ] -%} -<div{{ attributes.addClass(classes) }}> - - minimal overridden in test theme! - - {% if not label_hidden %} - <div class="field-label-{{ element['#label_display']|clean_class }}"> - {{- label }}{% if settings['lb-col'] %}:{% endif -%} - </div> - {% endif %} - - {% for item in items %} - {{ item.content }} - {% endfor %} -</div> diff --git a/web/modules/ds/tests/themes/ds_test_layout_theme/templates/ds-test-layout-theme.html.twig b/web/modules/ds/tests/themes/ds_test_layout_theme/templates/ds-test-layout-theme.html.twig deleted file mode 100644 index 22b0c4b4ea..0000000000 --- a/web/modules/ds/tests/themes/ds_test_layout_theme/templates/ds-test-layout-theme.html.twig +++ /dev/null @@ -1,5 +0,0 @@ -<{{ outer_wrapper }} class="test-template-defined-in-theme-class"> - <{{ ds_content_wrapper }} class="ds-content-wrapper"> - {{ ds_content }} - </{{ ds_content_wrapper }}> -</{{ outer_wrapper }}> -- GitLab