diff --git a/administrator/components/com_admin/sql/updates/mysql/3.9.0-2018-05-19.sql b/administrator/components/com_admin/sql/updates/mysql/3.9.0-2018-05-19.sql new file mode 100644 index 0000000000000..512acbd7f707e --- /dev/null +++ b/administrator/components/com_admin/sql/updates/mysql/3.9.0-2018-05-19.sql @@ -0,0 +1,2 @@ +INSERT INTO `#__extensions` (`extension_id`, `package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `custom_data`, `system_data`, `checked_out`, `checked_out_time`, `ordering`, `state`) VALUES +(481, 0, 'plg_fields_repeatable', 'plugin', 'repeatable', 'fields', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0); diff --git a/administrator/components/com_admin/sql/updates/postgresql/3.9.0-2018-05-19.sql b/administrator/components/com_admin/sql/updates/postgresql/3.9.0-2018-05-19.sql new file mode 100644 index 0000000000000..b8ce724e76bf4 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/postgresql/3.9.0-2018-05-19.sql @@ -0,0 +1,2 @@ +INSERT INTO "#__extensions" ("extension_id", "package_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "custom_data", "system_data", "checked_out", "checked_out_time", "ordering", "state") VALUES +(481, 0, 'plg_fields_repeatable', 'plugin', 'repeatable', 'fields', 0, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0); diff --git a/administrator/components/com_admin/sql/updates/sqlazure/3.9.0-2018-05-19.sql b/administrator/components/com_admin/sql/updates/sqlazure/3.9.0-2018-05-19.sql new file mode 100644 index 0000000000000..3536e787202f0 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/sqlazure/3.9.0-2018-05-19.sql @@ -0,0 +1,2 @@ +INSERT INTO "#__extensions" ("extension_id", "package_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "custom_data", "system_data", "checked_out", "checked_out_time", "ordering", "state") VALUES +(481, 0, 'plg_fields_repeatable', 'plugin', 'repeatable', 'fields', 0, 1, 1, 0, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0); diff --git a/administrator/language/en-GB/en-GB.plg_fields_repeatable.ini b/administrator/language/en-GB/en-GB.plg_fields_repeatable.ini new file mode 100644 index 0000000000000..b9b6200ec2ebf --- /dev/null +++ b/administrator/language/en-GB/en-GB.plg_fields_repeatable.ini @@ -0,0 +1,18 @@ +; Joomla! Project +; Copyright (C) 2005 - 2018 Open Source Matters. All rights reserved. +; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php +; Note : All ini files need to be saved as UTF-8 + +PLG_FIELDS_REPEATABLE="Fields - Repeatable" +PLG_FIELDS_REPEATABLE_LABEL="Repeatable (%s)" +PLG_FIELDS_REPEATABLE_PARAMS_FIELDNAME_NAME_DESC="The name of the field to display in the form" +PLG_FIELDS_REPEATABLE_PARAMS_FIELDNAME_NAME_LABEL="Name" +PLG_FIELDS_REPEATABLE_PARAMS_FIELDNAME_TYPE_DESC="Set the field type" +PLG_FIELDS_REPEATABLE_PARAMS_FIELDNAME_TYPE_EDITOR="Editor" +PLG_FIELDS_REPEATABLE_PARAMS_FIELDNAME_TYPE_LABEL="Type" +PLG_FIELDS_REPEATABLE_PARAMS_FIELDNAME_TYPE_MEDIA="Media" +PLG_FIELDS_REPEATABLE_PARAMS_FIELDNAME_TYPE_NUMBER="Number" +PLG_FIELDS_REPEATABLE_PARAMS_FIELDNAME_TYPE_TEXT="Text" +PLG_FIELDS_REPEATABLE_PARAMS_FIELDNAME_TYPE_TEXTAREA="Text Area" +PLG_FIELDS_REPEATABLE_PARAMS_FIELDS_DESC="Add one or more form fields" +PLG_FIELDS_REPEATABLE_PARAMS_FIELDS_LABEL="Form Fields" diff --git a/administrator/language/en-GB/en-GB.plg_fields_repeatable.sys.ini b/administrator/language/en-GB/en-GB.plg_fields_repeatable.sys.ini new file mode 100644 index 0000000000000..8d4d8a4610b2c --- /dev/null +++ b/administrator/language/en-GB/en-GB.plg_fields_repeatable.sys.ini @@ -0,0 +1,7 @@ +; Joomla! Project +; Copyright (C) 2005 - 2018 Open Source Matters. All rights reserved. +; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php +; Note : All ini files need to be saved as UTF-8 + +PLG_FIELDS_REPEATABLE="Fields - Repeatable" +PLG_FIELDS_REPEATABLE_XML_DESCRIPTION="Plugin to create a repeatable form with customizable fields" diff --git a/installation/sql/mysql/joomla.sql b/installation/sql/mysql/joomla.sql index 764e32d3af954..4e80613e403e8 100644 --- a/installation/sql/mysql/joomla.sql +++ b/installation/sql/mysql/joomla.sql @@ -643,6 +643,7 @@ INSERT INTO `#__extensions` (`extension_id`, `package_id`, `name`, `type`, `elem (478, 0, 'plg_editors-xtd_fields', 'plugin', 'fields', 'editors-xtd', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (479, 0, 'plg_sampledata_blog', 'plugin', 'blog', 'sampledata', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (480, 0, 'plg_system_sessiongc', 'plugin', 'sessiongc', 'system', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), +(481, 0, 'plg_fields_repeatable', 'plugin', 'repeatable', 'fields', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (503, 0, 'beez3', 'template', 'beez3', '', 0, 1, 1, 0, '', '{"wrapperSmall":"53","wrapperLarge":"72","sitetitle":"","sitedescription":"","navposition":"center","templatecolor":"nature"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (504, 0, 'hathor', 'template', 'hathor', '', 1, 1, 1, 0, '', '{"showSiteName":"0","colourChoice":"0","boldText":"0"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (506, 0, 'protostar', 'template', 'protostar', '', 0, 1, 1, 0, '', '{"templateColor":"","logoFile":"","googleFont":"1","googleFontName":"Open+Sans","fluidContainer":"0"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), diff --git a/installation/sql/postgresql/joomla.sql b/installation/sql/postgresql/joomla.sql index 42f10d6b6d255..6fff15ed52447 100644 --- a/installation/sql/postgresql/joomla.sql +++ b/installation/sql/postgresql/joomla.sql @@ -657,6 +657,7 @@ INSERT INTO "#__extensions" ("extension_id", "package_id", "name", "type", "elem (478, 0, 'plg_editors-xtd_fields', 'plugin', 'fields', 'editors-xtd', 0, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), (479, 0, 'plg_sampledata_blog', 'plugin', 'blog', 'sampledata', 0, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), (480, 0, 'plg_system_sessiongc', 'plugin', 'sessiongc', 'system', 0, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), +(481, 0, 'plg_fields_repeatable', 'plugin', 'repeatable', 'fields', 0, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), (503, 0, 'beez3', 'template', 'beez3', '', 0, 1, 1, 0, '', '{"wrapperSmall":"53","wrapperLarge":"72","sitetitle":"","sitedescription":"","navposition":"center","templatecolor":"nature"}', '', '', 0, '1970-01-01 00:00:00', 0, 0), (504, 0, 'hathor', 'template', 'hathor', '', 1, 1, 1, 0, '', '{"showSiteName":"0","colourChoice":"0","boldText":"0"}', '', '', 0, '1970-01-01 00:00:00', 0, 0), (506, 0, 'protostar', 'template', 'protostar', '', 0, 1, 1, 0, '', '{"templateColor":"","logoFile":"","googleFont":"1","googleFontName":"Open+Sans","fluidContainer":"0"}', '', '', 0, '1970-01-01 00:00:00', 0, 0), diff --git a/installation/sql/sqlazure/joomla.sql b/installation/sql/sqlazure/joomla.sql index 0bc5b3c0db071..14ed187c8cf7e 100644 --- a/installation/sql/sqlazure/joomla.sql +++ b/installation/sql/sqlazure/joomla.sql @@ -872,6 +872,7 @@ INSERT INTO "#__extensions" ("extension_id", "package_id", "name", "type", "elem (478, 0, 'plg_editors-xtd_fields', 'plugin', 'fields', 'editors-xtd', 0, 1, 1, 0, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0), (479, 0, 'plg_sampledata_blog', 'plugin', 'blog', 'sampledata', 0, 1, 1, 0, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0), (480, 0, 'plg_system_sessiongc', 'plugin', 'sessiongc', 'system', 0, 1, 1, 0, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0), +(481, 0, 'plg_fields_repeatable', 'plugin', 'repeatable', 'fields', 0, 1, 1, 0, '', '', '', '', 0, '1900-01-01 00:00:00', 0, 0), (503, 0, 'beez3', 'template', 'beez3', '', 0, 1, 1, 0, '', '{"wrapperSmall":"53","wrapperLarge":"72","sitetitle":"","sitedescription":"","navposition":"center","templatecolor":"nature"}', '', '', 0, '1900-01-01 00:00:00', 0, 0), (504, 0, 'hathor', 'template', 'hathor', '', 1, 1, 1, 0, '', '{"showSiteName":"0","colourChoice":"0","boldText":"0"}', '', '', 0, '1900-01-01 00:00:00', 0, 0), (506, 0, 'protostar', 'template', 'protostar', '', 0, 1, 1, 0, '', '{"templateColor":"","logoFile":"","googleFont":"1","googleFontName":"Open+Sans","fluidContainer":"0"}', '', '', 0, '1900-01-01 00:00:00', 0, 0), diff --git a/libraries/src/Extension/ExtensionHelper.php b/libraries/src/Extension/ExtensionHelper.php index 373fd1b6f6bee..e1e4baf3bba0c 100644 --- a/libraries/src/Extension/ExtensionHelper.php +++ b/libraries/src/Extension/ExtensionHelper.php @@ -176,6 +176,7 @@ class ExtensionHelper array('plugin', 'list', 'fields', 0), array('plugin', 'media', 'fields', 0), array('plugin', 'radio', 'fields', 0), + array('plugin', 'repeatable', 'fields', 0), array('plugin', 'sql', 'fields', 0), array('plugin', 'text', 'fields', 0), array('plugin', 'textarea', 'fields', 0), diff --git a/plugins/fields/repeatable/params/repeatable.xml b/plugins/fields/repeatable/params/repeatable.xml new file mode 100644 index 0000000000000..9866980cf37c8 --- /dev/null +++ b/plugins/fields/repeatable/params/repeatable.xml @@ -0,0 +1,38 @@ + +
diff --git a/plugins/fields/repeatable/repeatable.php b/plugins/fields/repeatable/repeatable.php new file mode 100644 index 0000000000000..bceb02ee1c13e --- /dev/null +++ b/plugins/fields/repeatable/repeatable.php @@ -0,0 +1,143 @@ +setAttribute('type', 'subform'); + $fieldNode->setAttribute('multiple', 'true'); + $fieldNode->setAttribute('layout', 'joomla.form.field.subform.repeatable-table'); + + // Build the form source + $fieldsXml = new SimpleXMLElement('