Parcourir la source

Add Reverb entry to admin left-nav with r_icon.svg

- upload/admin/view/image/reverb/r_icon.svg  — icon asset served by admin
- upload/admin/view/stylesheet/reverb.css    — CSS mask technique so the
  SVG icon inherits currentColor (matches sidebar text at all states)
- install.xml: two new OCMOD patches
    * admin/controller/common/header.php: loads reverb.css via document->addStyle
    * admin/controller/common/column_left.php: injects menu-reverb item above
      menu-sale using a whitespace-agnostic regex search

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Benjamin Harris il y a 1 semaine
Parent
commit
da47a7c86a

+ 44 - 0
install.xml

@@ -6,6 +6,50 @@
     <author>Reverb OpenCart</author>
     <link>https://reverb.com/au/page/integrations</link>
 
+    <!--
+        ========================================================================
+        FILE: admin/controller/common/header.php
+
+        Loads reverb.css so the sidebar icon class is defined before the
+        column_left template renders.
+        ========================================================================
+    -->
+    <file path="admin/controller/common/header.php">
+        <operation error="skip">
+            <search><![CDATA[addStyle('view/stylesheet/opencart.css');]]></search>
+            <add position="after"><![CDATA[
+		$this->document->addStyle('view/stylesheet/reverb.css');]]></add>
+        </operation>
+    </file>
+
+    <!--
+        ========================================================================
+        FILE: admin/controller/common/column_left.php
+
+        Adds the Reverb menu item to the left-hand navigation, positioned
+        above the Sale (menu-sale) block.  A regex search is used so the match
+        is whitespace-agnostic across OC3 minor versions.
+        ========================================================================
+    -->
+    <file path="admin/controller/common/column_left.php">
+        <operation error="skip">
+            <search regex="true"><![CDATA[if \(\$sale\) \{\s+\$data\['menus'\]\[\]\s*=\s*array\(]]></search>
+            <add position="before"><![CDATA[
+		// Reverb
+		if ($this->user->hasPermission('access', 'extension/module/reverb')) {
+			$data['menus'][] = array(
+				'id'       => 'menu-reverb',
+				'icon'     => 'reverb-nav-icon',
+				'name'     => 'Reverb',
+				'href'     => $this->url->link('extension/module/reverb', 'user_token=' . $this->session->data['user_token'], true),
+				'children' => array()
+			);
+		}
+
+		]]></add>
+        </operation>
+    </file>
+
     <!--
         ========================================================================
         FILE: admin/view/template/catalog/product_form.twig

+ 1 - 0
upload/admin/view/image/reverb/r_icon.svg

@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28" aria-hidden="true"><path d="M18.717 8.665c.12-1.055-.275-1.748-.628-2.143-.503-.564-1.148-.798-1.382-.798a.35.35 0 0 0-.215.068c-.015.011-.04.027-.068.044a1.112 1.112 0 0 0-.403.386c-.11.194-.919 1.956-2.075 5.637l-.124.389c-.256.796-.351 1.094-.192 1.312a.36.36 0 0 0 .272.148c.037.003.134.012.279.012.929 0 4.001-.365 4.536-5.055Z"></path><path d="M22.329 20.989c-.828.51-2.345 1.493-4.024 1.517h-.058c-.812 0-1.465-.255-1.94-.759-1.012-1.073-1.059-3.044-.996-4.124.082-1.409-.355-2.299-.737-2.797-.168-.22-.474-.444-.778-.444-.223 0-.488.132-.56.503-.07.364-.273 1.128-.49 1.937-.232.871-.472 1.772-.598 2.363-.24 1.128-.418 2.27-.49 3.134 0 .013-.045.325-1.62.325-.242 0-.472-.006-.675-.012a14.54 14.54 0 0 0-.387-.009c-.06 0-.107.002-.147.004a1.287 1.287 0 0 1-.088.004c-.193 0-.235-.053-.254-.076-.054-.066-.162-.307.004-1.1.455-2.165 3.425-12.218 3.828-13.326.374-1.03 1.208-2.208 1.208-2.208a5.21 5.21 0 0 0-.128-.002c-1.375 0-2.956.561-4.228 1.5-1.343.991-2.114 2.22-2.114 3.373 0 .52.134 1.732 1.378 1.732.263 0 .522-.058.733-.125-.098.51-.382.905-.633 1.166a3.559 3.559 0 0 1-2.487 1.055c-.83 0-1.5-.246-1.938-.71-.432-.459-.626-1.112-.576-1.941.163-2.73 2.036-4.694 5.564-5.837 2.867-.929 5.922-1.001 6.79-1.001 1.083 0 2.478.06 3.674.528 1.465.573 2.178 1.585 2.178 3.092 0 4.07-5.148 5.217-5.378 5.537-.151.21.158.435.356.64.307.32.773.804 1.09 1.946.31 1.118 1.206 3.717 2.819 3.717.84 0 1.267-.143 1.66-.357.64-.35.94.202.042.755ZM14 0C6.268 0 0 6.268 0 14s6.268 14 14 14 14-6.268 14-14S21.732 0 14 0Z"></path></svg>

+ 20 - 0
upload/admin/view/stylesheet/reverb.css

@@ -0,0 +1,20 @@
+/*
+ * Reverb admin navigation icon
+ *
+ * The <i class="reverb-nav-icon"> is rendered by OC3 AdminLTE sidebar.
+ * CSS mask lets the SVG shape act as a clipping mask over background-color,
+ * so the icon inherits currentColor and matches whatever the sidebar text
+ * colour is (white on hover/active, 75% white when inactive).
+ */
+.reverb-nav-icon {
+    display: inline-block;
+    width: 18px;
+    height: 18px;
+    vertical-align: -3px;
+    background-color: currentColor;
+    -webkit-mask: url('../image/reverb/r_icon.svg') no-repeat center / contain;
+    mask: url('../image/reverb/r_icon.svg') no-repeat center / contain;
+    /* suppress any inherited font glyph */
+    font-size: 0;
+    line-height: 1;
+}