소스 검색

added admin_toolbar_content contrib module, changed toolbar home button to go to client

bach 2 년 전
부모
커밋
ef271210d2

+ 1 - 0
src/composer.json

@@ -16,6 +16,7 @@
     ],
     "require": {
         "composer/installers": "^1.9",
+        "drupal/admin_toolbar_content": "^1.3",
         "drupal/administerusersbyrole": "^3.3",
         "drupal/amswap": "^3.1",
         "drupal/audiofield": "1.x-dev@dev",

+ 125 - 1
src/composer.lock

@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "e86b83d13c4b5d3fd33d66bc0e622158",
+    "content-hash": "b71d40ad5fdae20202852b65c352ee54",
     "packages": [
         {
             "name": "alchemy/zippy",
@@ -2303,6 +2303,130 @@
                 "issues": "https://www.drupal.org/project/issues/admin_toolbar"
             }
         },
+        {
+            "name": "drupal/admin_toolbar_content",
+            "version": "1.3.12",
+            "source": {
+                "type": "git",
+                "url": "https://git.drupalcode.org/project/admin_toolbar_content.git",
+                "reference": "1.3.12"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://ftp.drupal.org/files/projects/admin_toolbar_content-1.3.12.zip",
+                "reference": "1.3.12",
+                "shasum": "62c73317d0c94a4c1cc4ff488e08b6f23b99f505"
+            },
+            "require": {
+                "drupal/admin_toolbar": "*",
+                "drupal/admin_toolbar_tools": "*",
+                "drupal/core": "^8.8 || ^9 || ^10"
+            },
+            "type": "drupal-module",
+            "extra": {
+                "drupal": {
+                    "version": "1.3.12",
+                    "datestamp": "1676377124",
+                    "security-coverage": {
+                        "status": "covered",
+                        "message": "Covered by Drupal's security advisory policy"
+                    }
+                }
+            },
+            "notification-url": "https://packages.drupal.org/8/downloads",
+            "license": [
+                "GPL-2.0-or-later"
+            ],
+            "authors": [
+                {
+                    "name": "Kris Booghmans",
+                    "homepage": "http://www.calibrate.be",
+                    "email": "kris@calibrate.be"
+                },
+                {
+                    "name": "Mschudders",
+                    "homepage": "https://www.drupal.org/user/1314320"
+                },
+                {
+                    "name": "Stefdewa",
+                    "homepage": "https://www.drupal.org/user/2480344"
+                },
+                {
+                    "name": "tim-diels",
+                    "homepage": "https://www.drupal.org/user/2915097"
+                }
+            ],
+            "description": "Provides extra content admin enhancements in the admin toolbar.",
+            "homepage": "https://www.drupal.org/project/admin_toolbar_content",
+            "keywords": [
+                "Calibr8",
+                "Calibrate",
+                "Drupal 9",
+                "Toolbar",
+                "UX"
+            ],
+            "support": {
+                "source": "https://git.drupalcode.org/project/admin_toolbar_content"
+            }
+        },
+        {
+            "name": "drupal/admin_toolbar_tools",
+            "version": "3.3.0",
+            "require": {
+                "drupal/admin_toolbar": "*",
+                "drupal/core": "^9.2 || ^10"
+            },
+            "type": "metapackage",
+            "extra": {
+                "drupal": {
+                    "version": "3.3.0",
+                    "datestamp": "1669567837",
+                    "security-coverage": {
+                        "status": "covered",
+                        "message": "Covered by Drupal's security advisory policy"
+                    }
+                }
+            },
+            "notification-url": "https://packages.drupal.org/8/downloads",
+            "license": [
+                "GPL-2.0-or-later"
+            ],
+            "authors": [
+                {
+                    "name": "adriancid",
+                    "homepage": "https://www.drupal.org/user/1962106"
+                },
+                {
+                    "name": "bolbol",
+                    "homepage": "https://www.drupal.org/user/3400070"
+                },
+                {
+                    "name": "eme",
+                    "homepage": "https://www.drupal.org/user/542492"
+                },
+                {
+                    "name": "fethi.krout",
+                    "homepage": "https://www.drupal.org/user/3206765"
+                },
+                {
+                    "name": "matio89",
+                    "homepage": "https://www.drupal.org/user/2320090"
+                },
+                {
+                    "name": "Musa.thomas",
+                    "homepage": "https://www.drupal.org/user/1213824"
+                },
+                {
+                    "name": "romainj",
+                    "homepage": "https://www.drupal.org/user/370706"
+                }
+            ],
+            "description": "Adds menu links like Flush cache, Run cron, Run updates, and Logout under Drupal icon.",
+            "homepage": "https://www.drupal.org/project/admin_toolbar",
+            "support": {
+                "source": "https://git.drupalcode.org/project/admin_toolbar"
+            }
+        },
         {
             "name": "drupal/adminimal_theme",
             "version": "1.6.0",

+ 13 - 0
src/config/sync/admin_toolbar_content.settings.yml

@@ -0,0 +1,13 @@
+_core:
+  default_config_hash: J_pW_t3Kr8hKGmouyvHK7hwllxgm5E7Ur85BMZJjfao
+langcode: fr
+recent_items: 10
+recent_items_link: default
+hide_non_content_items: true
+show_account_link: edit
+enhance_content_item: true
+show_categories_item: true
+show_media_item: true
+show_webforms_item: true
+show_menus_item: true
+group_collections: ''

+ 6 - 0
src/config/sync/admin_toolbar_tools.settings.yml

@@ -0,0 +1,6 @@
+_core:
+  default_config_hash: WgdZsrd_5w9jlmcHV4R9dD2tG9OZEkYo4I_O8h7Gq8Q
+langcode: fr
+max_bundle_number: 20
+hoverintent_functionality: true
+show_local_tasks: false

+ 2 - 0
src/config/sync/core.extension.yml

@@ -5,7 +5,9 @@ module:
   actions_permissions: 0
   admin_menus: 0
   admin_toolbar: 0
+  admin_toolbar_content: 0
   admin_toolbar_links_access_filter: 0
+  admin_toolbar_tools: 0
   administerusersbyrole: 0
   advanced_text_formatter: 0
   amswap: 0

+ 1 - 1
src/config/sync/field.field.paragraph.entite_concernement.field_prise.yml

@@ -15,7 +15,7 @@ required: false
 translatable: false
 default_value:
   -
-    value: !!float 0
+    value: !!float 100
 default_value_callback: ''
 settings:
   min: !!float 0

+ 1 - 1
src/config/sync/system.site.yml

@@ -8,7 +8,7 @@ slogan: 'S’outiller collectivement, se préparer pour atterrir autrement, et s
 page:
   403: ''
   404: ''
-  front: /user/login
+  front: /
 admin_compact_mode: false
 weight_select_max: 100
 default_langcode: fr

+ 4 - 0
src/web/modules/custom/ouatt_graphql/graphql/ouatt_extension.extension.graphqls

@@ -39,6 +39,10 @@ extend type Query {
   static(id: Int!): Static
 }
 
+extend type Query {
+  user(id: Int!): User
+}
+
 extend type Query {
   allgroups: [Group]
 }

+ 10 - 1
src/web/modules/custom/ouatt_graphql/src/Plugin/GraphQL/SchemaExtension/OuattSchemaExtension.php

@@ -215,7 +215,9 @@ class OuattSchemaExtension extends SdlSchemaExtensionPluginBase {
           ->map('entity', $builder->fromParent())
           ->map('field', $builder->fromValue('field_entite')),
         $builder->callback(function ($items) {
-            return $items[0];
+            if (isset($items[0])) {
+              return $items[0];
+            }
           })
       ));
 
@@ -559,6 +561,13 @@ class OuattSchemaExtension extends SdlSchemaExtensionPluginBase {
   // \____/____/\___/_/     
   protected function addUser(ResolverRegistryInterface $registry, ResolverBuilder $builder) {
     
+    $registry->addFieldResolver('Query', 'user',
+      $builder->produce('entity_load')
+        ->map('type', $builder->fromValue('user'))
+        // ->map('bundles', $builder->fromValue(['static']))
+        ->map('id', $builder->fromArgument('id'))
+    );
+
     $registry->addFieldResolver('User', 'id',
       $builder->produce('entity_id')
         ->map('entity', $builder->fromParent())

+ 2 - 2
src/web/themes/custom/ouatminimal_theme/css/ouatminimal.css

@@ -171,9 +171,9 @@
 #boussole-layout .form-item[data-drupal-selector="edit-field-entite"] table.field-multiple-table>tbody>tr{
   border: none;
 }
-#boussole-layout .form-item[data-drupal-selector="edit-field-entite"] table.field-multiple-table>tbody>tr>td.field-multiple-drag{
+/* #boussole-layout .form-item[data-drupal-selector="edit-field-entite"] table.field-multiple-table>tbody>tr>td.field-multiple-drag{
   
-}
+} */
 #boussole-layout .form-item[data-drupal-selector="edit-field-entite"] table.field-multiple-table>tbody>tr>td:not(.field-multiple-drag)>div{
   padding:0.5em;
   border: 1px solid #bbb;

+ 11 - 1
src/web/themes/custom/ouatminimal_theme/ouatminimal.theme

@@ -6,7 +6,8 @@
  */
 
 use Drupal\Core\Form\FormStateInterface;
-
+use \Drupal\Core\Url;
+use Drupal\Core\Render\Markup;
 
 /**
  * Implements hook_preprocess_HOOK() for HTML document templates.
@@ -99,3 +100,12 @@ function ouatminimal_preprocess_field_multiple_value_form__field_entite__node_co
 //     $t="t";
 //   }
 // }
+
+function ouatminimal_preprocess_toolbar(&$variables) {
+  unset($variables['tabs']['home']['link']['#options']['attributes']['data-toolbar-escape-admin']);
+  unset($variables['tabs']['home']['link']['#attributes']['data-toolbar-escape-admin']);
+  unset($variables['tabs']['home']['link']['#markup']);
+  unset($variables['tabs']['home']['link']['#children']);
+  $uri = $_SERVER['HTTP_REFERER'];
+  $variables['tabs']['home']['link']['#url'] = Url::fromUri($uri);
+}

+ 46 - 0
src/web/themes/custom/ouatminimal_theme/templates/toolbar.html.twig

@@ -0,0 +1,46 @@
+{#
+/**
+ * @file
+ * Theme override for the administrative toolbar.
+ *
+ * Available variables:
+ * - attributes: HTML attributes for the wrapper.
+ * - toolbar_attributes: HTML attributes to apply to the toolbar.
+ * - toolbar_heading: The heading or label for the toolbar.
+ * - tabs: List of tabs for the toolbar.
+ *   - attributes: HTML attributes for the tab container.
+ *   - link: Link or button for the menu tab.
+ * - trays: Toolbar tray list, each associated with a tab. Each tray in trays
+ *   contains:
+ *   - attributes: HTML attributes to apply to the tray.
+ *   - label: The tray's label.
+ *   - links: The tray menu links.
+ * - remainder: Any non-tray, non-tab elements left to be rendered.
+ *
+ * @see template_preprocess_toolbar()
+ */
+#}
+<div{{ attributes.addClass('toolbar') }}>
+  <nav{{ toolbar_attributes.addClass('toolbar-bar', 'clearfix') }}>
+    <h2 class="visually-hidden">{{ toolbar_heading }}</h2>
+    {% for key, tab in tabs %}
+      {% set tray = trays[key] %}
+      <div{{ tab.attributes.addClass('toolbar-tab') }}>
+        {{ tab.link }}
+        {% apply spaceless %}
+          <div{{ tray.attributes }}>
+            {% if tray.label %}
+              <nav class="toolbar-lining clearfix" role="navigation" aria-label="{{ tray.label }}">
+                <h3 class="toolbar-tray-name visually-hidden">{{ tray.label }}</h3>
+            {% else %}
+              <nav class="toolbar-lining clearfix" role="navigation">
+            {% endif %}
+            {{ tray.links }}
+            </nav>
+          </div>
+        {% endapply %}
+      </div>
+    {% endfor %}
+  </nav>
+  {{ remainder }}
+</div>