forked from joomla/joomla-cms
-
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.
[4.2] Menu item custom field (joomla#38244)
* [4.2] Menu item custom field * Update menuitem.php * Thanks @richard67 * less haste more speed
- Loading branch information
1 parent
a354423
commit 32ef564
Showing
10 changed files
with
100 additions
and
16 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
administrator/components/com_admin/sql/updates/mysql/4.2.0-2022-07-07.sql
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,2 @@ | ||
INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `locked`, `manifest_cache`, `params`, `custom_data`, `ordering`, `state`) VALUES | ||
(0, 'plg_fields_menuitem', 'plugin', 'menuitem', 'fields', 0, 1, 1, 0, 1, '', '', '', 0, 0); |
2 changes: 2 additions & 0 deletions
2
administrator/components/com_admin/sql/updates/postgresql/4.2.0-2022-07-07.sql
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,2 @@ | ||
INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "locked", "manifest_cache", "params", "custom_data", "ordering", "state") VALUES | ||
(0, 'plg_fields_menuitem', 'plugin', 'menuitem', 'fields', 0, 1, 1, 0, 1, '', '', '', 0, 0); |
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,8 @@ | ||
; Joomla! Project | ||
; (C) 2022 Open Source Matters, Inc. <https://www.joomla.org> | ||
; License GNU General Public License version 2 or later; see LICENSE.txt | ||
; Note : All ini files need to be saved as UTF-8 | ||
|
||
PLG_FIELDS_MENUITEM="Fields - Menu Item" | ||
PLG_FIELDS_MENUITEM_LABEL="List of Menu Items (%s)" | ||
PLG_FIELDS_MENUITEM_XML_DESCRIPTION="This plugin lets you create new fields of type 'menuitem' in any extensions where custom fields are supported." |
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,7 @@ | ||
; Joomla! Project | ||
; (C) 2022 Open Source Matters, Inc. <https://www.joomla.org> | ||
; License GNU General Public License version 2 or later; see LICENSE.txt | ||
; Note : All ini files need to be saved as UTF-8 | ||
|
||
PLG_FIELDS_MENUITEM="Fields - Menu Item" | ||
PLG_FIELDS_MENUITEM_XML_DESCRIPTION="This plugin lets you create new fields of type 'menuitem' in any extensions where custom fields are supported." |
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
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,20 @@ | ||
<?php | ||
|
||
/** | ||
* @package Joomla.Plugin | ||
* @subpackage Fields.Menuitem | ||
* | ||
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org> | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
* @phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace | ||
*/ | ||
|
||
/** | ||
* Fields Menuitem Plugin | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
class PlgFieldsMenuitem extends \Joomla\Component\Fields\Administrator\Plugin\FieldsPlugin | ||
{ | ||
} |
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,20 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<extension type="plugin" group="fields" method="upgrade"> | ||
<name>plg_fields_menuitem</name> | ||
<author>Joomla! Project</author> | ||
<creationDate>2022-07</creationDate> | ||
<copyright>(C) 2022 Open Source Matters, Inc.</copyright> | ||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license> | ||
<authorEmail>[email protected]</authorEmail> | ||
<authorUrl>www.joomla.org</authorUrl> | ||
<version>4.2.0</version> | ||
<description>PLG_FIELDS_MENUITEM_XML_DESCRIPTION</description> | ||
<files> | ||
<filename plugin="menuitem">menuitem.php</filename> | ||
<folder>tmpl</folder> | ||
</files> | ||
<languages> | ||
<language tag="en-GB">language/en-GB/plg_fields_menuitem.ini</language> | ||
<language tag="en-GB">language/en-GB/plg_fields_menuitem.sys.ini</language> | ||
</languages> | ||
</extension> |
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,22 @@ | ||
<?php | ||
|
||
/** | ||
* @package Joomla.Plugin | ||
* @subpackage Fields.Menuitem | ||
* | ||
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org> | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
|
||
defined('_JEXEC') or die; | ||
|
||
$value = $field->value; | ||
|
||
if ($value == '') { | ||
return; | ||
} | ||
|
||
$url = \Joomla\CMS\Router\Route::_("index.php?Itemid={$value}"); | ||
$title = \Joomla\CMS\Factory::getApplication()->getMenu()->getItem($value)->title; | ||
|
||
echo "<a href=\"{$url}\">{$title}</a>"; |