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.
This is a combination of 10 commits.
This is the 1st commit message: First commit which integrates the subform custom field type. This is the commit message joomla#2: Rename manifest file for plg_fields_subform This is the commit message joomla#3: plg_fields_subform: Improve code comments and made the subform field type optionally non-repeatable. This is the commit message joomla#4: Fix not being able to change the type of a subfield. This is the commit message joomla#5: Implement a small in-memory renderCache for subform custom fields This is the commit message joomla#6: Prepare to load the subfields into a subform custom field directly via their own xml definition. This is the commit message joomla#7: After merge with PR joomla#17552 we can now successfully show the subforms options for the different types. This is the commit message joomla#8: The subform custom field type doesnt need a default value. This is the commit message joomla#9: Implement an option for a subform customfield to disable rendering the field values. This is the commit message joomla#10: Remove unused code and set hidden fields to not-required.
- Loading branch information
Rene Pasing
committed
Sep 24, 2018
1 parent
17c3ec7
commit 480d469
Showing
16 changed files
with
731 additions
and
7 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
administrator/components/com_admin/sql/updates/mysql/3.8.0-2017-07-13.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` (`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 | ||
(479, 0, 'plg_fields_subform', 'plugin', 'subform', 'fields', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0); |
2 changes: 2 additions & 0 deletions
2
administrator/components/com_admin/sql/updates/postgresql/3.8.0-2017-07-13.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" ("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 | ||
(479, 0, 'plg_fields_subform', 'plugin', 'subform', 'fields', 0, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0); |
2 changes: 2 additions & 0 deletions
2
administrator/components/com_admin/sql/updates/sqlazure/3.8.0-2017-07-13.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" ("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 | ||
(479, 0, 'plg_fields_subform', 'plugin', 'subform', 'fields', 0, 1, 1, 0, '', '', '', '', 0, '1900-01-01 00:00:00', 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
57 changes: 57 additions & 0 deletions
57
administrator/components/com_fields/models/fields/subformtype.php
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,57 @@ | ||
<?php | ||
/** | ||
* @package Joomla.Administrator | ||
* @subpackage com_fields | ||
* | ||
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
defined('_JEXEC') or die; | ||
|
||
JFormHelper::loadFieldClass('list'); | ||
|
||
/** | ||
* Fields Subformtype | ||
* | ||
* @see \JFormFieldType | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
class JFormFieldSubformtype extends JFormFieldList | ||
{ | ||
public $type = 'Subformtype'; | ||
|
||
/** | ||
* Method to get the field options. | ||
* | ||
* @return array The field option objects. | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
protected function getOptions() | ||
{ | ||
$options = parent::getOptions(); | ||
|
||
$fieldTypes = FieldsHelper::getFieldTypes(); | ||
|
||
foreach ($fieldTypes as $fieldType) | ||
{ | ||
// Skip subform type. We (currently) won't have subforms in subforms. | ||
if ($fieldType['type'] == 'subform') | ||
{ | ||
continue; | ||
} | ||
$options[] = JHtml::_('select.option', $fieldType['type'], $fieldType['label']); | ||
} | ||
|
||
// Sorting the fields based on the text which is displayed | ||
usort( | ||
$options, | ||
function ($a, $b) | ||
{ | ||
return strcmp($a->text, $b->text); | ||
} | ||
); | ||
|
||
return $options; | ||
} | ||
} |
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,16 @@ | ||
; Joomla! Project | ||
; Copyright (C) 2005 - 2017 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_SUBFORM="Fields - Subform" | ||
PLG_FIELDS_SUBFORM_XML_DESCRIPTION="This plugin lets you create new fields of type 'subform' in any extensions where custom fields are supported." | ||
PLG_FIELDS_SUBFORM_LABEL="Subform (%s)" | ||
PLG_FIELDS_SUBFORM_PARAMS_OPTIONS_LABEL="Fields" | ||
PLG_FIELDS_SUBFORM_PARAMS_OPTIONS_DESC="The fields of the subform." | ||
PLG_FIELDS_SUBFORM_PARAMS_REPEAT_LABEL="Repeatable" | ||
PLG_FIELDS_SUBFORM_PARAMS_REPEAT_DESC="Whether this subform shall be repeatable." | ||
PLG_FIELDS_SUBFORM_PARAMS_RENDER_VALUES_LABEL="Render values" | ||
PLG_FIELDS_SUBFORM_PARAMS_RENDER_VALUES_DESC="Do you want the custom field plugin to render the values of this subforms fields? Rendering is, for example, unneeded if your subform only contains 'text' fields, because text values does't change when being rendered. But when you e.g. have a 'media' field, the unrendered value will be the url to that media, the rendered value will be a HTML <img>-tag, for example. If you create your own layout override, where you can take care of the unrendered value, you should always disable rendering, as rendering always comes at a cost of performance." | ||
PLG_FIELDS_SUBFORM_PARAMS_OPTIONS_NAME_LABEL="Name" | ||
PLG_FIELDS_SUBFORM_PARAMS_OPTIONS_NAME_DESC="The name to identify the field." |
7 changes: 7 additions & 0 deletions
7
administrator/language/en-GB/en-GB.plg_fields_subform.sys.ini
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 | ||
; Copyright (C) 2005 - 2017 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_SUBFORM="Fields - Subform" | ||
PLG_FIELDS_SUBFORM_XML_DESCRIPTION="This plugin lets you create new fields of type 'subform' 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.