This repository has been archived by the owner on Aug 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b0c0786
commit 945f130
Showing
5 changed files
with
90 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
{% extends "_layouts/cp" %} | ||
|
||
{% set title = "Matrix Inventory" %} | ||
|
||
{% set content %} | ||
{% block content %} | ||
<h2>Matrix Block Types</h2> | ||
<ul style="margin-left: 20px; list-style: disc;"> | ||
{% for matrixField in matrixFields %} | ||
<li> | ||
<a href="{{ cpUrl() }}/matrix-inventory/view/{{ matrixField.key }}">{{ matrixField.label }}</a> | ||
<a href="{{ cpUrl('matrix-inventory/view/' ~ matrixField.key) }}">{{ matrixField.label }}</a> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
{% endset %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
namespace nthmedia\MatrixInventory\utilities; | ||
|
||
use Craft; | ||
use craft\base\Utility; | ||
use nthmedia\MatrixInventory\MatrixInventoryPlugin; | ||
|
||
class MatrixInventoryUtility extends Utility | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public static function displayName(): string | ||
{ | ||
return Craft::t('matrix-inventory', 'Matrix Inventory'); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public static function id(): string | ||
{ | ||
return 'matrix-inventory'; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public static function iconPath(): ?string | ||
{ | ||
// Set the icon mask path | ||
$iconPath = Craft::getAlias('@vendor/nthmedia/matrix-inventory/src/icon-mask.svg'); | ||
|
||
// If not a string, bail | ||
if (!is_string($iconPath)) { | ||
return null; | ||
} | ||
|
||
// Return the icon mask path | ||
return $iconPath; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public static function contentHtml(): string | ||
{ | ||
return Craft::$app->getView()->renderTemplate('matrix-inventory/index', [ | ||
'matrixFields' => MatrixInventoryPlugin::getInstance()->settings->matrixFields | ||
]); | ||
// Render the utility template | ||
// return Craft::$app->getView()->renderTemplate('matrix-inventory/index'); | ||
} | ||
|
||
} |