JoomlaPolska / jezyk-J4

Język polski dla Joomla 4
GNU General Public License v2.0
3 stars 5 forks source link

[4.2] Menu item custom field #211

Closed joomlapl-bot closed 2 years ago

joomlapl-bot commented 2 years ago

PR w związku ze zmianą oryginału https://github.com/joomla/joomla-cms/pull/38244 Poniżej zmiany w oryginale:

Click to expand the diff! ```diff diff --git a/administrator/components/com_admin/sql/updates/mysql/4.2.0-2022-07-07.sql b/administrator/components/com_admin/sql/updates/mysql/4.2.0-2022-07-07.sql new file mode 100644 index 000000000000..11f3ead36a4e --- /dev/null +++ b/administrator/components/com_admin/sql/updates/mysql/4.2.0-2022-07-07.sql @@ -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); diff --git a/administrator/components/com_admin/sql/updates/postgresql/4.2.0-2022-07-07.sql b/administrator/components/com_admin/sql/updates/postgresql/4.2.0-2022-07-07.sql new file mode 100644 index 000000000000..4c83bf2f3ef9 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/postgresql/4.2.0-2022-07-07.sql @@ -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); diff --git a/administrator/language/en-GB/plg_fields_menuitem.ini b/administrator/language/en-GB/plg_fields_menuitem.ini new file mode 100644 index 000000000000..7893b9009302 --- /dev/null +++ b/administrator/language/en-GB/plg_fields_menuitem.ini @@ -0,0 +1,8 @@ +; Joomla! Project +; (C) 2022 Open Source Matters, Inc. +; 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." diff --git a/administrator/language/en-GB/plg_fields_menuitem.sys.ini b/administrator/language/en-GB/plg_fields_menuitem.sys.ini new file mode 100644 index 000000000000..8f28f1d78838 --- /dev/null +++ b/administrator/language/en-GB/plg_fields_menuitem.sys.ini @@ -0,0 +1,7 @@ +; Joomla! Project +; (C) 2022 Open Source Matters, Inc. +; 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." diff --git a/installation/sql/mysql/base.sql b/installation/sql/mysql/base.sql index dc7e9a94bfc2..a482de6f7a4c 100644 --- a/installation/sql/mysql/base.sql +++ b/installation/sql/mysql/base.sql @@ -286,14 +286,15 @@ INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, (0, 'plg_fields_integer', 'plugin', 'integer', 'fields', 0, 1, 1, 0, 1, '', '{"multiple":"0","first":"1","last":"100","step":"1"}', '', 6, 0), (0, 'plg_fields_list', 'plugin', 'list', 'fields', 0, 1, 1, 0, 1, '', '', '', 7, 0), (0, 'plg_fields_media', 'plugin', 'media', 'fields', 0, 1, 1, 0, 1, '', '', '', 8, 0), -(0, 'plg_fields_radio', 'plugin', 'radio', 'fields', 0, 1, 1, 0, 1, '', '', '', 9, 0), -(0, 'plg_fields_sql', 'plugin', 'sql', 'fields', 0, 1, 1, 0, 1, '', '', '', 10, 0), -(0, 'plg_fields_subform', 'plugin', 'subform', 'fields', 0, 1, 1, 0, 1, '', '', '', 11, 0), -(0, 'plg_fields_text', 'plugin', 'text', 'fields', 0, 1, 1, 0, 1, '', '', '', 12, 0), -(0, 'plg_fields_textarea', 'plugin', 'textarea', 'fields', 0, 1, 1, 0, 1, '', '', '', 13, 0), -(0, 'plg_fields_url', 'plugin', 'url', 'fields', 0, 1, 1, 0, 1, '', '', '', 14, 0), -(0, 'plg_fields_user', 'plugin', 'user', 'fields', 0, 1, 1, 0, 1, '', '', '', 15, 0), -(0, 'plg_fields_usergrouplist', 'plugin', 'usergrouplist', 'fields', 0, 1, 1, 0, 1, '', '', '', 16, 0), +(0, 'plg_fields_menuitem', 'plugin', 'menuitem', 'fields', 0, 1, 1, 0, 1, '', '', '', 9, 0), +(0, 'plg_fields_radio', 'plugin', 'radio', 'fields', 0, 1, 1, 0, 1, '', '', '', 10, 0), +(0, 'plg_fields_sql', 'plugin', 'sql', 'fields', 0, 1, 1, 0, 1, '', '', '', 11, 0), +(0, 'plg_fields_subform', 'plugin', 'subform', 'fields', 0, 1, 1, 0, 1, '', '', '', 12, 0), +(0, 'plg_fields_text', 'plugin', 'text', 'fields', 0, 1, 1, 0, 1, '', '', '', 13, 0), +(0, 'plg_fields_textarea', 'plugin', 'textarea', 'fields', 0, 1, 1, 0, 1, '', '', '', 14, 0), +(0, 'plg_fields_url', 'plugin', 'url', 'fields', 0, 1, 1, 0, 1, '', '', '', 15, 0), +(0, 'plg_fields_user', 'plugin', 'user', 'fields', 0, 1, 1, 0, 1, '', '', '', 16, 0), +(0, 'plg_fields_usergrouplist', 'plugin', 'usergrouplist', 'fields', 0, 1, 1, 0, 1, '', '', '', 17, 0), (0, 'plg_filesystem_local', 'plugin', 'local', 'filesystem', 0, 1, 1, 0, 1, '', '{}', '', 1, 0), (0, 'plg_finder_categories', 'plugin', 'categories', 'finder', 0, 1, 1, 0, 1, '', '', '', 1, 0), (0, 'plg_finder_contacts', 'plugin', 'contacts', 'finder', 0, 1, 1, 0, 1, '', '', '', 2, 0), diff --git a/installation/sql/postgresql/base.sql b/installation/sql/postgresql/base.sql index beebddfbb49f..5de080f9b3a5 100644 --- a/installation/sql/postgresql/base.sql +++ b/installation/sql/postgresql/base.sql @@ -292,14 +292,15 @@ INSERT INTO "#__extensions" ("package_id", "name", "type", "element", "folder", (0, 'plg_fields_integer', 'plugin', 'integer', 'fields', 0, 1, 1, 0, 1, '', '{"multiple":"0","first":"1","last":"100","step":"1"}', '', 6, 0), (0, 'plg_fields_list', 'plugin', 'list', 'fields', 0, 1, 1, 0, 1, '', '', '', 7, 0), (0, 'plg_fields_media', 'plugin', 'media', 'fields', 0, 1, 1, 0, 1, '', '', '', 8, 0), -(0, 'plg_fields_radio', 'plugin', 'radio', 'fields', 0, 1, 1, 0, 1, '', '', '', 9, 0), -(0, 'plg_fields_sql', 'plugin', 'sql', 'fields', 0, 1, 1, 0, 1, '', '', '', 10, 0), -(0, 'plg_fields_subform', 'plugin', 'subform', 'fields', 0, 1, 1, 0, 1, '', '', '', 11, 0), -(0, 'plg_fields_text', 'plugin', 'text', 'fields', 0, 1, 1, 0, 1, '', '', '', 12, 0), -(0, 'plg_fields_textarea', 'plugin', 'textarea', 'fields', 0, 1, 1, 0, 1, '', '', '', 13, 0), -(0, 'plg_fields_url', 'plugin', 'url', 'fields', 0, 1, 1, 0, 1, '', '', '', 14, 0), -(0, 'plg_fields_user', 'plugin', 'user', 'fields', 0, 1, 1, 0, 1, '', '', '', 15, 0), -(0, 'plg_fields_usergrouplist', 'plugin', 'usergrouplist', 'fields', 0, 1, 1, 0, 1, '', '', '', 16, 0), +(0, 'plg_fields_menuitem', 'plugin', 'menuitem', 'fields', 0, 1, 1, 0, 1, '', '', '', 9, 0), +(0, 'plg_fields_radio', 'plugin', 'radio', 'fields', 0, 1, 1, 0, 1, '', '', '', 10, 0), +(0, 'plg_fields_sql', 'plugin', 'sql', 'fields', 0, 1, 1, 0, 1, '', '', '', 11, 0), +(0, 'plg_fields_subform', 'plugin', 'subform', 'fields', 0, 1, 1, 0, 1, '', '', '', 12, 0), +(0, 'plg_fields_text', 'plugin', 'text', 'fields', 0, 1, 1, 0, 1, '', '', '', 13, 0), +(0, 'plg_fields_textarea', 'plugin', 'textarea', 'fields', 0, 1, 1, 0, 1, '', '', '', 14, 0), +(0, 'plg_fields_url', 'plugin', 'url', 'fields', 0, 1, 1, 0, 1, '', '', '', 15, 0), +(0, 'plg_fields_user', 'plugin', 'user', 'fields', 0, 1, 1, 0, 1, '', '', '', 16, 0), +(0, 'plg_fields_usergrouplist', 'plugin', 'usergrouplist', 'fields', 0, 1, 1, 0, 1, '', '', '', 17, 0), (0, 'plg_filesystem_local', 'plugin', 'local', 'filesystem', 0, 1, 1, 0, 1, '', '{}', '', 1, 0), (0, 'plg_finder_categories', 'plugin', 'categories', 'finder', 0, 1, 1, 0, 1, '', '', '', 1, 0), (0, 'plg_finder_contacts', 'plugin', 'contacts', 'finder', 0, 1, 1, 0, 1, '', '', '', 2, 0), diff --git a/libraries/src/Extension/ExtensionHelper.php b/libraries/src/Extension/ExtensionHelper.php index b47c41d51218..103ae50d3625 100644 --- a/libraries/src/Extension/ExtensionHelper.php +++ b/libraries/src/Extension/ExtensionHelper.php @@ -216,6 +216,7 @@ class ExtensionHelper array('plugin', 'integer', 'fields', 0), array('plugin', 'list', 'fields', 0), array('plugin', 'media', 'fields', 0), + array('plugin', 'menuitem', 'fields', 0), array('plugin', 'radio', 'fields', 0), array('plugin', 'sql', 'fields', 0), array('plugin', 'subform', 'fields', 0), diff --git a/plugins/fields/menuitem/menuitem.php b/plugins/fields/menuitem/menuitem.php new file mode 100644 index 000000000000..c93c3512de50 --- /dev/null +++ b/plugins/fields/menuitem/menuitem.php @@ -0,0 +1,20 @@ + + * @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 +{ +} diff --git a/plugins/fields/menuitem/menuitem.xml b/plugins/fields/menuitem/menuitem.xml new file mode 100644 index 000000000000..a392ce341967 --- /dev/null +++ b/plugins/fields/menuitem/menuitem.xml @@ -0,0 +1,20 @@ + + + plg_fields_menuitem + Joomla! Project + 2022-07 + (C) 2022 Open Source Matters, Inc. + GNU General Public License version 2 or later; see LICENSE.txt + admin@joomla.org + www.joomla.org + 4.2.0 + PLG_FIELDS_MENUITEM_XML_DESCRIPTION + + menuitem.php + tmpl + + + language/en-GB/plg_fields_menuitem.ini + language/en-GB/plg_fields_menuitem.sys.ini + + diff --git a/plugins/fields/menuitem/tmpl/menuitem.php b/plugins/fields/menuitem/tmpl/menuitem.php new file mode 100644 index 000000000000..63b63ce2ab18 --- /dev/null +++ b/plugins/fields/menuitem/tmpl/menuitem.php @@ -0,0 +1,22 @@ + + * @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 "{$title}"; ```