Adds option to add more field paths or rule paths to both module or plugin forms.

This commit is contained in:
Llewellyn van der Merwe 2022-02-04 12:50:24 +02:00
parent e8b0bf8ede
commit 2ce36117d4
Signed by: Llewellyn
GPG Key ID: EFC0C720A240551C
8 changed files with 259 additions and 36 deletions

View File

@ -143,12 +143,12 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 2nd February, 2022
+ *Last Build*: 4th February, 2022
+ *Version*: 2.12.15
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **286129**
+ *Field count*: **1572**
+ *Line count*: **286249**
+ *Field count*: **1580**
+ *File count*: **1829**
+ *Folder count*: **256**

View File

@ -143,12 +143,12 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 2nd February, 2022
+ *Last Build*: 4th February, 2022
+ *Version*: 2.12.15
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **286129**
+ *Field count*: **1572**
+ *Line count*: **286249**
+ *Field count*: **1580**
+ *File count*: **1829**
+ *Folder count*: **256**

View File

@ -9389,6 +9389,8 @@ class Get
$module->form_files = array();
$module->fieldsets_label = array();
$module->fieldsets_paths = array();
$module->add_rule_path = array();
$module->add_field_path = array();
// set global fields rule to default component path
$module->fields_rules_paths = 1;
// set the fields data
@ -9463,6 +9465,30 @@ class Get
// set where to path is pointing
$module->fieldsets_paths[$unique]
= $form['fields_rules_paths'];
// check for extra rule paths
if (isset($form['addrulepath'])
&& ComponentbuilderHelper::checkArray($form['addrulepath']))
{
foreach ($form['addrulepath'] as $add_rule_path)
{
if (ComponentbuilderHelper::checkString($add_rule_path['path']))
{
$module->add_rule_path[$unique][] = $add_rule_path['path'];
}
}
}
// check for extra field paths
if (isset($form['addfieldpath'])
&& ComponentbuilderHelper::checkArray($form['addfieldpath']))
{
foreach ($form['addfieldpath'] as $add_field_path)
{
if (ComponentbuilderHelper::checkString($add_field_path['path']))
{
$module->add_field_path[$unique][] = $add_field_path['path'];
}
}
}
// add the label if set to lang
if (isset($form['label'])
&& ComponentbuilderHelper::checkString(
@ -10297,6 +10323,8 @@ class Get
$plugin->form_files = array();
$plugin->fieldsets_label = array();
$plugin->fieldsets_paths = array();
$plugin->add_rule_path = array();
$plugin->add_field_path = array();
// set global fields rule to default component path
$plugin->fields_rules_paths = 1;
// set the fields data
@ -10380,6 +10408,30 @@ class Get
$plugin->fieldsets_label[$unique]
= $this->setLang($form['label']);
}
// check for extra rule paths
if (isset($form['addrulepath'])
&& ComponentbuilderHelper::checkArray($form['addrulepath']))
{
foreach ($form['addrulepath'] as $add_rule_path)
{
if (ComponentbuilderHelper::checkString($add_rule_path['path']))
{
$plugin->add_rule_path[$unique][] = $add_rule_path['path'];
}
}
}
// check for extra field paths
if (isset($form['addfieldpath'])
&& ComponentbuilderHelper::checkArray($form['addfieldpath']))
{
foreach ($form['addfieldpath'] as $add_field_path)
{
if (ComponentbuilderHelper::checkString($add_field_path['path']))
{
$plugin->add_field_path[$unique][] = $add_field_path['path'];
}
}
}
// build the fields
$form['fields'] = array_map(
function ($field) use ($key, $unique) {

View File

@ -28572,31 +28572,57 @@ function vdm_dkim() {
&& $module->fieldsets_paths[$field_name . $fieldset]
== 2)
{
$xml .= PHP_EOL . $this->_t(1) . '<!--'
. $this->setLine(__LINE__) . ' default paths of '
. $fieldset . ' fieldset points to the module -->';
$xml .= PHP_EOL . $this->_t(1) . '<fieldset name="'
. $fieldset . '" label="' . $label . '"';
if ($module->target == 2)
{
$xml .= PHP_EOL . $this->_t(2)
. 'addrulepath="/administrator/modules/'
. $module->file_name
. '/rules"';
$xml .= PHP_EOL . $this->_t(2)
. 'addfieldpath="/administrator/modules/'
. $module->file_name
. '/fields"';
$module->add_rule_path[$field_name . $fieldset][] =
'/administrator/modules/'
. $module->file_name . '/rules';
$module->add_field_path[$field_name . $fieldset][] =
'/administrator/modules/'
. $module->file_name . '/fields';
}
else
{
$xml .= PHP_EOL . $this->_t(2)
. 'addrulepath="/modules/' . $module->file_name
. '/rules"';
$xml .= PHP_EOL . $this->_t(2)
. 'addfieldpath="/modules/' . $module->file_name
. '/fields"';
$module->add_rule_path[$field_name . $fieldset][] =
'/modules/' . $module->file_name
. '/rules';
$module->add_field_path[$field_name . $fieldset][] =
'/modules/' . $module->file_name
. '/fields';
}
}
// add path to module rules and custom fields
if (isset($module->add_rule_path[$field_name . $fieldset])
|| isset($module->add_field_path[$field_name . $fieldset]))
{
$xml .= PHP_EOL . $this->_t(1) . '<!--'
. $this->setLine(__LINE__) . ' default paths of '
. $fieldset . ' fieldset points to the module -->';
$xml .= PHP_EOL . $this->_t(1) . '<fieldset name="'
. $fieldset . '" label="' . $label . '"';
if (isset($module->add_rule_path[$field_name . $fieldset]))
{
foreach ($module->add_rule_path[$field_name . $fieldset] as $path)
{
$xml .= PHP_EOL . $this->_t(2)
. 'addrulepath="' . $path . '"';
}
}
if (isset($module->add_field_path[$field_name . $fieldset]))
{
foreach ($module->add_field_path[$field_name . $fieldset] as $path)
{
$xml .= PHP_EOL . $this->_t(2)
. 'addfieldpath="' . $path . '"';
}
}
$xml .= PHP_EOL . $this->_t(1) . '>';
}
else
@ -28931,26 +28957,51 @@ function vdm_dkim() {
$label = $plugin->fieldsets_label[$field_name
. $fieldset];
}
// add path to plugin rules and custom fields
if (isset($plugin->fieldsets_paths[$field_name . $fieldset])
&& $plugin->fieldsets_paths[$field_name . $fieldset]
== 2)
{
$plugin->add_rule_path[$field_name . $fieldset][] =
'/plugins/' . strtolower($plugin->group
) . '/' . strtolower($plugin->code_name)
. '/rules';
$plugin->add_field_path[$field_name . $fieldset][] =
'/plugins/' . strtolower($plugin->group
) . '/' . strtolower($plugin->code_name)
. '/fields';
}
// add path to plugin rules and custom fields
if (isset($plugin->add_rule_path[$field_name . $fieldset])
|| isset($plugin->add_field_path[$field_name . $fieldset]))
{
$xml .= PHP_EOL . $this->_t(1) . '<!--'
. $this->setLine(__LINE__) . ' default paths of '
. $fieldset . ' fieldset points to the plugin -->';
$xml .= PHP_EOL . $this->_t(1) . '<fieldset name="'
. $fieldset . '" label="' . $label . '"';
$xml .= PHP_EOL . $this->_t(2)
. 'addrulepath="/plugins/' . strtolower(
$plugin->group
) . '/' . strtolower($plugin->code_name)
. '/rules"';
$xml .= PHP_EOL . $this->_t(2)
. 'addfieldpath="/plugins/' . strtolower(
$plugin->group
) . '/' . strtolower($plugin->code_name)
. '/fields"';
if (isset($plugin->add_rule_path[$field_name . $fieldset]))
{
foreach ($plugin->add_rule_path[$field_name . $fieldset] as $path)
{
$xml .= PHP_EOL . $this->_t(2)
. 'addrulepath="' . $path . '"';
}
}
if (isset($plugin->add_field_path[$field_name . $fieldset]))
{
foreach ($plugin->add_field_path[$field_name . $fieldset] as $path)
{
$xml .= PHP_EOL . $this->_t(2)
. 'addfieldpath="' . $path . '"';
}
}
$xml .= PHP_EOL . $this->_t(1) . '>';
}
else

View File

@ -6237,7 +6237,11 @@ COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_N_ITEMS_UNFEATURED_1="%s Joomla Modu
COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_N_ITEMS_UNPUBLISHED="%s Joomla Modules Updates unpublished."
COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_N_ITEMS_UNPUBLISHED_1="%s Joomla Module Updates unpublished."
COM_COMPONENTBUILDER_JOOMLA_MODULE_ABSTRACT_CLASS="abstract class"
COM_COMPONENTBUILDER_JOOMLA_MODULE_ADDFIELDPATH_DESCRIPTION="Set extra field paths"
COM_COMPONENTBUILDER_JOOMLA_MODULE_ADDFIELDPATH_LABEL="Extra Field Paths"
COM_COMPONENTBUILDER_JOOMLA_MODULE_ADDREADME_LABEL="Add README"
COM_COMPONENTBUILDER_JOOMLA_MODULE_ADDRULEPATH_DESCRIPTION="Set extra rule paths"
COM_COMPONENTBUILDER_JOOMLA_MODULE_ADDRULEPATH_LABEL="Extra Rule Paths"
COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_CLASS_HELPER_DESCRIPTION="You can add a helper class to your module."
COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_CLASS_HELPER_HEADER_DESCRIPTION="You can add your own custom helper header script."
COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_CLASS_HELPER_HEADER_LABEL="Add Class Helper Header"
@ -6462,6 +6466,8 @@ COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_UPDATE_SERVER_NOTE_ZIP_LABEL="The ZIP Op
COM_COMPONENTBUILDER_JOOMLA_MODULE_NOT_REQUIRED="Not Required"
COM_COMPONENTBUILDER_JOOMLA_MODULE_ORDERING_LABEL="Ordering"
COM_COMPONENTBUILDER_JOOMLA_MODULE_OTHER="Other"
COM_COMPONENTBUILDER_JOOMLA_MODULE_PATH_LABEL="Path"
COM_COMPONENTBUILDER_JOOMLA_MODULE_PATH_MESSAGE="Error! Please add extra field path here."
COM_COMPONENTBUILDER_JOOMLA_MODULE_PERMISSION="Permissions"
COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_METHOD_UNINSTALL_DESCRIPTION="PHP script that should run during uninstall."
COM_COMPONENTBUILDER_JOOMLA_MODULE_PHP_METHOD_UNINSTALL_LABEL="PHP Method (uninstall)"
@ -6680,7 +6686,11 @@ COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_UNFEATURED="%s Joomla Plugin
COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_UNFEATURED_1="%s Joomla Plugin Updates unfeatured."
COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_UNPUBLISHED="%s Joomla Plugins Updates unpublished."
COM_COMPONENTBUILDER_JOOMLA_PLUGINS_UPDATES_N_ITEMS_UNPUBLISHED_1="%s Joomla Plugin Updates unpublished."
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADDFIELDPATH_DESCRIPTION="Set extra field paths"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADDFIELDPATH_LABEL="Extra Field Paths"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADDREADME_LABEL="Add README"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADDRULEPATH_DESCRIPTION="Set extra rule paths"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADDRULEPATH_LABEL="Extra Rule Paths"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_HEAD_DESCRIPTION="You can add your own custom header script, combined with the default header script that make the extended class work."
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_HEAD_LABEL="Add Custom Class Header"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADD_PHP_METHOD_UNINSTALL_LABEL="Add PHP Method (uninstall)"
@ -6935,6 +6945,8 @@ COM_COMPONENTBUILDER_JOOMLA_PLUGIN_NOTE_UPDATE_SERVER_NOTE_ZIP_LABEL="The ZIP Op
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_NOT_REQUIRED="Not Required"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ORDERING_LABEL="Ordering"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_OTHER="Other"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PATH_LABEL="Path"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PATH_MESSAGE="Error! Please add extra field path here."
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PERMISSION="Permissions"
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_METHOD_UNINSTALL_DESCRIPTION="PHP script that should run during uninstall."
COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PHP_METHOD_UNINSTALL_LABEL="PHP Method (uninstall)"

View File

@ -688,6 +688,60 @@
/>
</form>
</field>
<!-- Addrulepath Field. Type: Subform. (joomla) -->
<field
type="subform"
name="addrulepath"
label="COM_COMPONENTBUILDER_JOOMLA_MODULE_ADDRULEPATH_LABEL"
layout="joomla.form.field.subform.repeatable-table"
multiple="true"
buttons="add,remove,move"
description="COM_COMPONENTBUILDER_JOOMLA_MODULE_ADDRULEPATH_DESCRIPTION"
icon="list"
max="10"
nested_depth="1">
<form hidden="true" name="list_addrulepath_modal" repeat="true">
<!-- Path Field. Type: Text. (joomla) -->
<field
type="text"
name="path"
label="COM_COMPONENTBUILDER_JOOMLA_MODULE_PATH_LABEL"
size="50"
maxlength="150"
class="text_area"
filter="STRING"
message="COM_COMPONENTBUILDER_JOOMLA_MODULE_PATH_MESSAGE"
autocomplete="on"
/>
</form>
</field>
<!-- Addfieldpath Field. Type: Subform. (joomla) -->
<field
type="subform"
name="addfieldpath"
label="COM_COMPONENTBUILDER_JOOMLA_MODULE_ADDFIELDPATH_LABEL"
layout="joomla.form.field.subform.repeatable-table"
multiple="true"
buttons="add,remove,move"
description="COM_COMPONENTBUILDER_JOOMLA_MODULE_ADDFIELDPATH_DESCRIPTION"
icon="list"
max="10"
nested_depth="1">
<form hidden="true" name="list_addfieldpath_modal" repeat="true">
<!-- Path Field. Type: Text. (joomla) -->
<field
type="text"
name="path"
label="COM_COMPONENTBUILDER_JOOMLA_MODULE_PATH_LABEL"
size="50"
maxlength="150"
class="text_area"
filter="STRING"
message="COM_COMPONENTBUILDER_JOOMLA_MODULE_PATH_MESSAGE"
autocomplete="on"
/>
</form>
</field>
</form>
</field>
<!-- Readme Field. Type: Editor. (joomla) -->

View File

@ -567,6 +567,60 @@
/>
</form>
</field>
<!-- Addrulepath Field. Type: Subform. (joomla) -->
<field
type="subform"
name="addrulepath"
label="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADDRULEPATH_LABEL"
layout="joomla.form.field.subform.repeatable-table"
multiple="true"
buttons="add,remove,move"
description="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADDRULEPATH_DESCRIPTION"
icon="list"
max="10"
nested_depth="1">
<form hidden="true" name="list_addrulepath_modal" repeat="true">
<!-- Path Field. Type: Text. (joomla) -->
<field
type="text"
name="path"
label="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PATH_LABEL"
size="50"
maxlength="150"
class="text_area"
filter="STRING"
message="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PATH_MESSAGE"
autocomplete="on"
/>
</form>
</field>
<!-- Addfieldpath Field. Type: Subform. (joomla) -->
<field
type="subform"
name="addfieldpath"
label="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADDFIELDPATH_LABEL"
layout="joomla.form.field.subform.repeatable-table"
multiple="true"
buttons="add,remove,move"
description="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_ADDFIELDPATH_DESCRIPTION"
icon="list"
max="10"
nested_depth="1">
<form hidden="true" name="list_addfieldpath_modal" repeat="true">
<!-- Path Field. Type: Text. (joomla) -->
<field
type="text"
name="path"
label="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PATH_LABEL"
size="50"
maxlength="150"
class="text_area"
filter="STRING"
message="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_PATH_MESSAGE"
autocomplete="on"
/>
</form>
</field>
</form>
</field>
<!-- Php_method_uninstall Field. Type: Editor. (joomla) -->

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="4" method="upgrade">
<name>COM_COMPONENTBUILDER</name>
<creationDate>2nd February, 2022</creationDate>
<creationDate>4th February, 2022</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>