forked from joomla/Component-Builder
Added a new global helper method getFieldObject. Update the compiler area to make use of this new method.
This commit is contained in:
parent
e36b84f301
commit
df65ca3456
@ -125,11 +125,11 @@ Watch the [proposed development workflow](https://vdm.bz/proposed-development-wo
|
|||||||
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||||
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
|
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
|
||||||
+ *First Build*: 30th April, 2015
|
+ *First Build*: 30th April, 2015
|
||||||
+ *Last Build*: 30th July, 2018
|
+ *Last Build*: 31st July, 2018
|
||||||
+ *Version*: 2.8.5
|
+ *Version*: 2.8.5
|
||||||
+ *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved.
|
+ *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved.
|
||||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
+ *Line count*: **186360**
|
+ *Line count*: **186347**
|
||||||
+ *Field count*: **1059**
|
+ *Field count*: **1059**
|
||||||
+ *File count*: **1239**
|
+ *File count*: **1239**
|
||||||
+ *Folder count*: **197**
|
+ *Folder count*: **197**
|
||||||
|
@ -125,11 +125,11 @@ Watch the [proposed development workflow](https://vdm.bz/proposed-development-wo
|
|||||||
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
|
||||||
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
|
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
|
||||||
+ *First Build*: 30th April, 2015
|
+ *First Build*: 30th April, 2015
|
||||||
+ *Last Build*: 30th July, 2018
|
+ *Last Build*: 31st July, 2018
|
||||||
+ *Version*: 2.8.5
|
+ *Version*: 2.8.5
|
||||||
+ *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved.
|
+ *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved.
|
||||||
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
+ *Line count*: **186360**
|
+ *Line count*: **186347**
|
||||||
+ *Field count*: **1059**
|
+ *Field count*: **1059**
|
||||||
+ *File count*: **1239**
|
+ *File count*: **1239**
|
||||||
+ *Folder count*: **197**
|
+ *Folder count*: **197**
|
||||||
|
@ -753,6 +753,46 @@ abstract class ###Component###Helper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the field object
|
||||||
|
*
|
||||||
|
* @param array $attributes The array of attributes
|
||||||
|
* @param string $default The default of the field
|
||||||
|
* @param array $options The options to apply to the XML element
|
||||||
|
*
|
||||||
|
* @return object
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function getFieldObject($attributes, $default = '', $options = null)
|
||||||
|
{
|
||||||
|
// make sure we have a type
|
||||||
|
if (isset($attributes['type']))
|
||||||
|
{
|
||||||
|
// make sure the form helper class is loaded
|
||||||
|
if (!method_exists('JFormHelper', 'loadFieldType'))
|
||||||
|
{
|
||||||
|
jimport('joomla.form.form');
|
||||||
|
}
|
||||||
|
// get field type
|
||||||
|
$field = JFormHelper::loadFieldType($attributes['type'],true);
|
||||||
|
// start field xml
|
||||||
|
$XML = new SimpleXMLElement('<field/>');
|
||||||
|
// load the attributes
|
||||||
|
self::xmlAddAttributes($XML, $attributes);
|
||||||
|
// check if we have options
|
||||||
|
if (self::checkArray($options))
|
||||||
|
{
|
||||||
|
// load the options
|
||||||
|
self::xmlAddOptions($XML, $options);
|
||||||
|
}
|
||||||
|
// setup the field
|
||||||
|
$field->setup($XML, $default);
|
||||||
|
// return the field object
|
||||||
|
return $field;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render Bool Button
|
* Render Bool Button
|
||||||
*
|
*
|
||||||
@ -771,8 +811,6 @@ abstract class ###Component###Helper
|
|||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
// check if there is additional button class
|
// check if there is additional button class
|
||||||
$additional = isset($args[1]) ? (string) $args[1] : ''; // not used at this time
|
$additional = isset($args[1]) ? (string) $args[1] : ''; // not used at this time
|
||||||
// start the xml
|
|
||||||
$buttonXML = new SimpleXMLElement('<field/>');
|
|
||||||
// button attributes
|
// button attributes
|
||||||
$buttonAttributes = array(
|
$buttonAttributes = array(
|
||||||
'type' => 'radio',
|
'type' => 'radio',
|
||||||
@ -781,22 +819,12 @@ abstract class ###Component###Helper
|
|||||||
'class' => 'btn-group',
|
'class' => 'btn-group',
|
||||||
'filter' => 'INT',
|
'filter' => 'INT',
|
||||||
'default' => isset($args[2]) ? (int) $args[2] : 0);
|
'default' => isset($args[2]) ? (int) $args[2] : 0);
|
||||||
// load the haskey attributes
|
|
||||||
self::xmlAddAttributes($buttonXML, $buttonAttributes);
|
|
||||||
// set the button options
|
// set the button options
|
||||||
$buttonOptions = array(
|
$buttonOptions = array(
|
||||||
'1' => isset($args[3]) ? self::htmlEscape($args[3]) : 'JYES',
|
'1' => isset($args[3]) ? self::htmlEscape($args[3]) : 'JYES',
|
||||||
'0' => isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO');
|
'0' => isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO');
|
||||||
// load the button options
|
// return the input
|
||||||
self::xmlAddOptions($buttonXML, $buttonOptions);
|
return self::getFieldObject($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input;
|
||||||
|
|
||||||
// get the radio element
|
|
||||||
$button = JFormHelper::loadFieldType('radio');
|
|
||||||
|
|
||||||
// run
|
|
||||||
$button->setup($buttonXML, $buttonAttributes['default']);
|
|
||||||
|
|
||||||
return $button->input;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -399,10 +399,50 @@ abstract class ###Component###Helper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the field object
|
||||||
|
*
|
||||||
|
* @param array $attributes The array of attributes
|
||||||
|
* @param string $default The default of the field
|
||||||
|
* @param array $options The options to apply to the XML element
|
||||||
|
*
|
||||||
|
* @return object
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function getFieldObject($attributes, $default = '', $options = null)
|
||||||
|
{
|
||||||
|
// make sure we have a type
|
||||||
|
if (isset($attributes['type']))
|
||||||
|
{
|
||||||
|
// make sure the form helper class is loaded
|
||||||
|
if (!method_exists('JFormHelper', 'loadFieldType'))
|
||||||
|
{
|
||||||
|
jimport('joomla.form.form');
|
||||||
|
}
|
||||||
|
// get field type
|
||||||
|
$field = JFormHelper::loadFieldType($attributes['type'],true);
|
||||||
|
// start field xml
|
||||||
|
$XML = new SimpleXMLElement('<field/>');
|
||||||
|
// load the attributes
|
||||||
|
self::xmlAddAttributes($XML, $attributes);
|
||||||
|
// check if we have options
|
||||||
|
if (self::checkArray($options))
|
||||||
|
{
|
||||||
|
// load the options
|
||||||
|
self::xmlAddOptions($XML, $options);
|
||||||
|
}
|
||||||
|
// setup the field
|
||||||
|
$field->setup($XML, $default);
|
||||||
|
// return the field object
|
||||||
|
return $field;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render Bool Button
|
* Render Bool Button
|
||||||
*
|
*
|
||||||
* @param array $args All the args for the button
|
* @param array $args All the args for the button
|
||||||
* 0) name
|
* 0) name
|
||||||
* 1) additional (options class) // not used at this time
|
* 1) additional (options class) // not used at this time
|
||||||
* 2) default
|
* 2) default
|
||||||
@ -417,8 +457,6 @@ abstract class ###Component###Helper
|
|||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
// check if there is additional button class
|
// check if there is additional button class
|
||||||
$additional = isset($args[1]) ? (string) $args[1] : ''; // not used at this time
|
$additional = isset($args[1]) ? (string) $args[1] : ''; // not used at this time
|
||||||
// start the xml
|
|
||||||
$buttonXML = new SimpleXMLElement('<field/>');
|
|
||||||
// button attributes
|
// button attributes
|
||||||
$buttonAttributes = array(
|
$buttonAttributes = array(
|
||||||
'type' => 'radio',
|
'type' => 'radio',
|
||||||
@ -427,22 +465,12 @@ abstract class ###Component###Helper
|
|||||||
'class' => 'btn-group',
|
'class' => 'btn-group',
|
||||||
'filter' => 'INT',
|
'filter' => 'INT',
|
||||||
'default' => isset($args[2]) ? (int) $args[2] : 0);
|
'default' => isset($args[2]) ? (int) $args[2] : 0);
|
||||||
// load the haskey attributes
|
|
||||||
self::xmlAddAttributes($buttonXML, $buttonAttributes);
|
|
||||||
// set the button options
|
// set the button options
|
||||||
$buttonOptions = array(
|
$buttonOptions = array(
|
||||||
'1' => isset($args[3]) ? self::htmlEscape($args[3]) : 'JYES',
|
'1' => isset($args[3]) ? self::htmlEscape($args[3]) : 'JYES',
|
||||||
'0' => isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO');
|
'0' => isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO');
|
||||||
// load the button options
|
// return the input
|
||||||
self::xmlAddOptions($buttonXML, $buttonOptions);
|
return self::getFieldObject($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input;
|
||||||
|
|
||||||
// get the radio element
|
|
||||||
$button = JFormHelper::loadFieldType('radio');
|
|
||||||
|
|
||||||
// run
|
|
||||||
$button->setup($buttonXML, $buttonAttributes['default']);
|
|
||||||
|
|
||||||
return $button->input;
|
|
||||||
}###HELPER_UIKIT### ###HELPER_CREATEUSER###
|
}###HELPER_UIKIT### ###HELPER_CREATEUSER###
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4731,6 +4731,46 @@ abstract class ComponentbuilderHelper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the field object
|
||||||
|
*
|
||||||
|
* @param array $attributes The array of attributes
|
||||||
|
* @param string $default The default of the field
|
||||||
|
* @param array $options The options to apply to the XML element
|
||||||
|
*
|
||||||
|
* @return object
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function getFieldObject($attributes, $default = '', $options = null)
|
||||||
|
{
|
||||||
|
// make sure we have a type
|
||||||
|
if (isset($attributes['type']))
|
||||||
|
{
|
||||||
|
// make sure the form helper class is loaded
|
||||||
|
if (!method_exists('JFormHelper', 'loadFieldType'))
|
||||||
|
{
|
||||||
|
jimport('joomla.form.form');
|
||||||
|
}
|
||||||
|
// get field type
|
||||||
|
$field = JFormHelper::loadFieldType($attributes['type'],true);
|
||||||
|
// start field xml
|
||||||
|
$XML = new SimpleXMLElement('<field/>');
|
||||||
|
// load the attributes
|
||||||
|
self::xmlAddAttributes($XML, $attributes);
|
||||||
|
// check if we have options
|
||||||
|
if (self::checkArray($options))
|
||||||
|
{
|
||||||
|
// load the options
|
||||||
|
self::xmlAddOptions($XML, $options);
|
||||||
|
}
|
||||||
|
// setup the field
|
||||||
|
$field->setup($XML, $default);
|
||||||
|
// return the field object
|
||||||
|
return $field;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render Bool Button
|
* Render Bool Button
|
||||||
*
|
*
|
||||||
@ -4749,8 +4789,6 @@ abstract class ComponentbuilderHelper
|
|||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
// check if there is additional button class
|
// check if there is additional button class
|
||||||
$additional = isset($args[1]) ? (string) $args[1] : ''; // not used at this time
|
$additional = isset($args[1]) ? (string) $args[1] : ''; // not used at this time
|
||||||
// start the xml
|
|
||||||
$buttonXML = new SimpleXMLElement('<field/>');
|
|
||||||
// button attributes
|
// button attributes
|
||||||
$buttonAttributes = array(
|
$buttonAttributes = array(
|
||||||
'type' => 'radio',
|
'type' => 'radio',
|
||||||
@ -4759,22 +4797,12 @@ abstract class ComponentbuilderHelper
|
|||||||
'class' => 'btn-group',
|
'class' => 'btn-group',
|
||||||
'filter' => 'INT',
|
'filter' => 'INT',
|
||||||
'default' => isset($args[2]) ? (int) $args[2] : 0);
|
'default' => isset($args[2]) ? (int) $args[2] : 0);
|
||||||
// load the haskey attributes
|
|
||||||
self::xmlAddAttributes($buttonXML, $buttonAttributes);
|
|
||||||
// set the button options
|
// set the button options
|
||||||
$buttonOptions = array(
|
$buttonOptions = array(
|
||||||
'1' => isset($args[3]) ? self::htmlEscape($args[3]) : 'JYES',
|
'1' => isset($args[3]) ? self::htmlEscape($args[3]) : 'JYES',
|
||||||
'0' => isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO');
|
'0' => isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO');
|
||||||
// load the button options
|
// return the input
|
||||||
self::xmlAddOptions($buttonXML, $buttonOptions);
|
return self::getFieldObject($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input;
|
||||||
|
|
||||||
// get the radio element
|
|
||||||
$button = JFormHelper::loadFieldType('radio');
|
|
||||||
|
|
||||||
// run
|
|
||||||
$button->setup($buttonXML, $buttonAttributes['default']);
|
|
||||||
|
|
||||||
return $button->input;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -64,168 +64,99 @@ class ComponentbuilderViewCompiler extends JViewLegacy
|
|||||||
|
|
||||||
public function setForm()
|
public function setForm()
|
||||||
{
|
{
|
||||||
if(ComponentbuilderHelper::checkArray($this->Components)){
|
if(ComponentbuilderHelper::checkArray($this->Components))
|
||||||
jimport('joomla.form.form');
|
{
|
||||||
|
|
||||||
// start the form
|
// start the form
|
||||||
$form = array();
|
$form = array();
|
||||||
|
|
||||||
// get the sales radio field
|
|
||||||
$sales = JFormHelper::loadFieldType('radio',true);
|
|
||||||
// start sales xml
|
|
||||||
$salesXML = new SimpleXMLElement('<field/>');
|
|
||||||
// sales attributes
|
// sales attributes
|
||||||
$salesAttributes = array(
|
$attributes = array(
|
||||||
'type' => 'radio',
|
'type' => 'radio',
|
||||||
'name' => 'backup',
|
'name' => 'backup',
|
||||||
'label' => 'COM_COMPONENTBUILDER_ADD_TO_BACKUP_FOLDER_AMP_SALES_SERVER_SMALLIF_SETSMALL',
|
'label' => 'COM_COMPONENTBUILDER_ADD_TO_BACKUP_FOLDER_AMP_SALES_SERVER_SMALLIF_SETSMALL',
|
||||||
'class' => 'btn-group btn-group-yesno',
|
'class' => 'btn-group btn-group-yesno',
|
||||||
'description' => 'COM_COMPONENTBUILDER_SHOULD_THE_ZIPPED_PACKAGE_OF_THE_COMPONENT_BE_MOVED_TO_THE_LOCAL_BACKUP_AND_REMOTE_SALES_SERVER_THIS_IS_ONLY_APPLICABLE_IF_THIS_COMPONENT_HAS_THOSE_VALUES_SET',
|
'description' => 'COM_COMPONENTBUILDER_SHOULD_THE_ZIPPED_PACKAGE_OF_THE_COMPONENT_BE_MOVED_TO_THE_LOCAL_BACKUP_AND_REMOTE_SALES_SERVER_THIS_IS_ONLY_APPLICABLE_IF_THIS_COMPONENT_HAS_THOSE_VALUES_SET',
|
||||||
'default' => '0');
|
'default' => '0');
|
||||||
// load the sales attributes
|
|
||||||
ComponentbuilderHelper::xmlAddAttributes($salesXML, $salesAttributes);
|
|
||||||
// set the sales options
|
// set the sales options
|
||||||
$salesOptions = array(
|
$options = array(
|
||||||
'1' => 'COM_COMPONENTBUILDER_YES',
|
'1' => 'COM_COMPONENTBUILDER_YES',
|
||||||
'0' => 'COM_COMPONENTBUILDER_NO');
|
'0' => 'COM_COMPONENTBUILDER_NO');
|
||||||
// load the sales options
|
|
||||||
ComponentbuilderHelper::xmlAddOptions($salesXML, $salesOptions);
|
|
||||||
// setup the sales radio field
|
|
||||||
$sales->setup($salesXML,0);
|
|
||||||
// add to form
|
// add to form
|
||||||
$form[] = $sales;
|
$form[] = ComponentbuilderHelper::getFieldObject($attributes, 0, $options);
|
||||||
|
|
||||||
// get the repository radio field
|
|
||||||
$repository = JFormHelper::loadFieldType('radio',true);
|
|
||||||
// start repository xml
|
|
||||||
$repositoryXML = new SimpleXMLElement('<field/>');
|
|
||||||
// repository attributes
|
// repository attributes
|
||||||
$repositoryAttributes = array(
|
$attributes = array(
|
||||||
'type' => 'radio',
|
'type' => 'radio',
|
||||||
'name' => 'repository',
|
'name' => 'repository',
|
||||||
'label' => 'COM_COMPONENTBUILDER_ADD_TO_REPOSITORY_FOLDER',
|
'label' => 'COM_COMPONENTBUILDER_ADD_TO_REPOSITORY_FOLDER',
|
||||||
'class' => 'btn-group btn-group-yesno',
|
'class' => 'btn-group btn-group-yesno',
|
||||||
'description' => 'COM_COMPONENTBUILDER_SHOULD_THE_COMPONENT_BE_MOVED_TO_YOUR_LOCAL_REPOSITORY_FOLDER',
|
'description' => 'COM_COMPONENTBUILDER_SHOULD_THE_COMPONENT_BE_MOVED_TO_YOUR_LOCAL_REPOSITORY_FOLDER',
|
||||||
'default' => '1');
|
'default' => '1');
|
||||||
// load the repository attributes
|
|
||||||
ComponentbuilderHelper::xmlAddAttributes($repositoryXML, $repositoryAttributes);
|
|
||||||
// start the repository options
|
// start the repository options
|
||||||
$repositoryOptions = array(
|
$options = array(
|
||||||
'1' => 'COM_COMPONENTBUILDER_YES',
|
'1' => 'COM_COMPONENTBUILDER_YES',
|
||||||
'0' => 'COM_COMPONENTBUILDER_NO');
|
'0' => 'COM_COMPONENTBUILDER_NO');
|
||||||
// load the repository options
|
|
||||||
ComponentbuilderHelper::xmlAddOptions($repositoryXML, $repositoryOptions);
|
|
||||||
// setup the repository radio field
|
|
||||||
$repository->setup($repositoryXML,1);
|
|
||||||
// add to form
|
// add to form
|
||||||
$form[] = $repository;
|
$form[] = ComponentbuilderHelper::getFieldObject($attributes, 1, $options);
|
||||||
|
|
||||||
// get the placeholders radio field
|
|
||||||
$placeholders = JFormHelper::loadFieldType('radio',true);
|
|
||||||
// start placeholders xml
|
|
||||||
$placeholdersXML = new SimpleXMLElement('<field/>');
|
|
||||||
// placeholders attributes
|
// placeholders attributes
|
||||||
$placeholdersAttributes = array(
|
$attributes = array(
|
||||||
'type' => 'radio',
|
'type' => 'radio',
|
||||||
'name' => 'placeholders',
|
'name' => 'placeholders',
|
||||||
'label' => 'COM_COMPONENTBUILDER_ADD_CUSTOM_CODE_PLACEHOLDERS',
|
'label' => 'COM_COMPONENTBUILDER_ADD_CUSTOM_CODE_PLACEHOLDERS',
|
||||||
'class' => 'btn-group btn-group-yesno',
|
'class' => 'btn-group btn-group-yesno',
|
||||||
'description' => 'COM_COMPONENTBUILDER_SHOULD_JCB_INSERT_THE_CUSTOM_CODE_PLACEHOLDERS_THIS_IS_ONLY_APPLICABLE_IF_THIS_COMPONENT_HAS_CUSTOM_CODE',
|
'description' => 'COM_COMPONENTBUILDER_SHOULD_JCB_INSERT_THE_CUSTOM_CODE_PLACEHOLDERS_THIS_IS_ONLY_APPLICABLE_IF_THIS_COMPONENT_HAS_CUSTOM_CODE',
|
||||||
'default' => '2');
|
'default' => '2');
|
||||||
// load the placeholders attributes
|
|
||||||
ComponentbuilderHelper::xmlAddAttributes($placeholdersXML, $placeholdersAttributes);
|
|
||||||
// start the placeholders options
|
// start the placeholders options
|
||||||
$placeholdersOptions = array(
|
$options = array(
|
||||||
'2' => 'COM_COMPONENTBUILDER_GLOBAL',
|
'2' => 'COM_COMPONENTBUILDER_GLOBAL',
|
||||||
'1' => 'COM_COMPONENTBUILDER_YES',
|
'1' => 'COM_COMPONENTBUILDER_YES',
|
||||||
'0' => 'COM_COMPONENTBUILDER_NO');
|
'0' => 'COM_COMPONENTBUILDER_NO');
|
||||||
// load the placeholders options
|
|
||||||
ComponentbuilderHelper::xmlAddOptions($placeholdersXML, $placeholdersOptions);
|
|
||||||
// setup the placeholders radio field
|
|
||||||
$placeholders->setup($placeholdersXML,2);
|
|
||||||
// add to form
|
// add to form
|
||||||
$form[] = $placeholders;
|
$form[] = ComponentbuilderHelper::getFieldObject($attributes, 2, $options);
|
||||||
|
|
||||||
// get the debuglinenr radio field
|
|
||||||
$debuglinenr = JFormHelper::loadFieldType('radio',true);
|
|
||||||
// start debuglinenr xml
|
|
||||||
$debuglinenrXML = new SimpleXMLElement('<field/>');
|
|
||||||
// debuglinenr attributes
|
// debuglinenr attributes
|
||||||
$debuglinenrAttributes = array(
|
$attributes = array(
|
||||||
'type' => 'radio',
|
'type' => 'radio',
|
||||||
'name' => 'debuglinenr',
|
'name' => 'debuglinenr',
|
||||||
'label' => 'COM_COMPONENTBUILDER_DEBUG_LINE_NUMBERS',
|
'label' => 'COM_COMPONENTBUILDER_DEBUG_LINE_NUMBERS',
|
||||||
'class' => 'btn-group btn-group-yesno',
|
'class' => 'btn-group btn-group-yesno',
|
||||||
'description' => 'COM_COMPONENTBUILDER_ADD_CORRESPONDING_LINE_NUMBERS_TO_THE_DYNAMIC_COMMENTS_SO_TO_SEE_WHERE_IN_THE_COMPILER_THE_LINES_OF_CODE_WAS_BUILD_THIS_WILL_HELP_IF_YOU_NEED_TO_GET_MORE_TECHNICAL_WITH_AN_ISSUE_ON_GITHUB_OR_EVEN_FOR_YOUR_OWN_DEBUGGING',
|
'description' => 'COM_COMPONENTBUILDER_ADD_CORRESPONDING_LINE_NUMBERS_TO_THE_DYNAMIC_COMMENTS_SO_TO_SEE_WHERE_IN_THE_COMPILER_THE_LINES_OF_CODE_WAS_BUILD_THIS_WILL_HELP_IF_YOU_NEED_TO_GET_MORE_TECHNICAL_WITH_AN_ISSUE_ON_GITHUB_OR_EVEN_FOR_YOUR_OWN_DEBUGGING',
|
||||||
'default' => '2');
|
'default' => '2');
|
||||||
// load the debuglinenr attributes
|
$options = array(
|
||||||
ComponentbuilderHelper::xmlAddAttributes($debuglinenrXML, $debuglinenrAttributes);
|
|
||||||
// start the debuglinenr options
|
|
||||||
$debuglinenrOptions = array(
|
|
||||||
'2' => 'COM_COMPONENTBUILDER_GLOBAL',
|
'2' => 'COM_COMPONENTBUILDER_GLOBAL',
|
||||||
'1' => 'COM_COMPONENTBUILDER_YES',
|
'1' => 'COM_COMPONENTBUILDER_YES',
|
||||||
'0' => 'COM_COMPONENTBUILDER_NO');
|
'0' => 'COM_COMPONENTBUILDER_NO');
|
||||||
// load the debuglinenr options
|
|
||||||
ComponentbuilderHelper::xmlAddOptions($debuglinenrXML, $debuglinenrOptions);
|
|
||||||
// setup the debuglinenr radio field
|
|
||||||
$debuglinenr->setup($debuglinenrXML,2);
|
|
||||||
// add to form
|
// add to form
|
||||||
$form[] = $debuglinenr;
|
$form[] = ComponentbuilderHelper::getFieldObject($attributes, 2, $options);
|
||||||
|
|
||||||
// get the minify radio field
|
|
||||||
$minify = JFormHelper::loadFieldType('radio',true);
|
|
||||||
// start minify xml
|
|
||||||
$minifyXML = new SimpleXMLElement('<field/>');
|
|
||||||
// minify attributes
|
// minify attributes
|
||||||
$minifyAttributes = array(
|
$attributes = array(
|
||||||
'type' => 'radio',
|
'type' => 'radio',
|
||||||
'name' => 'minify',
|
'name' => 'minify',
|
||||||
'label' => 'COM_COMPONENTBUILDER_MINIFY_JAVASCRIPT',
|
'label' => 'COM_COMPONENTBUILDER_MINIFY_JAVASCRIPT',
|
||||||
'class' => 'btn-group btn-group-yesno',
|
'class' => 'btn-group btn-group-yesno',
|
||||||
'description' => 'COM_COMPONENTBUILDER_SHOULD_THE_JAVASCRIPT_BE_MINIFIED_IN_THE_COMPONENT',
|
'description' => 'COM_COMPONENTBUILDER_SHOULD_THE_JAVASCRIPT_BE_MINIFIED_IN_THE_COMPONENT',
|
||||||
'default' => '2');
|
'default' => '2');
|
||||||
// load the minify attributes
|
$options = array(
|
||||||
ComponentbuilderHelper::xmlAddAttributes($minifyXML, $minifyAttributes);
|
|
||||||
// start the minify options
|
|
||||||
$minifyOptions = array(
|
|
||||||
'2' => 'COM_COMPONENTBUILDER_GLOBAL',
|
'2' => 'COM_COMPONENTBUILDER_GLOBAL',
|
||||||
'1' => 'COM_COMPONENTBUILDER_YES',
|
'1' => 'COM_COMPONENTBUILDER_YES',
|
||||||
'0' => 'COM_COMPONENTBUILDER_NO');
|
'0' => 'COM_COMPONENTBUILDER_NO');
|
||||||
// load the minify options
|
|
||||||
ComponentbuilderHelper::xmlAddOptions($minifyXML, $minifyOptions);
|
|
||||||
// setup the minify radio field
|
|
||||||
$minify->setup($minifyXML,2);
|
|
||||||
// add to form
|
// add to form
|
||||||
$form[] = $minify;
|
$form[] = ComponentbuilderHelper::getFieldObject($attributes, 2, $options);
|
||||||
|
|
||||||
// get the component list field
|
|
||||||
$component = JFormHelper::loadFieldType('list',true);
|
|
||||||
// start component xml
|
|
||||||
$componentXML = new SimpleXMLElement('<field/>');
|
|
||||||
// component attributes
|
// component attributes
|
||||||
$componentAttributes = array(
|
$attributes = array(
|
||||||
'type' => 'list',
|
'type' => 'list',
|
||||||
'name' => 'component',
|
'name' => 'component',
|
||||||
'label' => 'COM_COMPONENTBUILDER_COMPONENTS',
|
'label' => 'COM_COMPONENTBUILDER_COMPONENTS',
|
||||||
'class' => 'list_class',
|
'class' => 'list_class',
|
||||||
'description' => 'COM_COMPONENTBUILDER_SELECT_THE_COMPONENT_TO_COMPILE',
|
'description' => 'COM_COMPONENTBUILDER_SELECT_THE_COMPONENT_TO_COMPILE',
|
||||||
'required' => 'true');
|
'required' => 'true');
|
||||||
// load the component attributes
|
|
||||||
ComponentbuilderHelper::xmlAddAttributes($componentXML, $componentAttributes);
|
|
||||||
// start the component options
|
// start the component options
|
||||||
$componentOptions = array();
|
$options = array();
|
||||||
$componentOptions[''] = 'COM_COMPONENTBUILDER__SELECT_COMPONENT_';
|
$options[''] = 'COM_COMPONENTBUILDER__SELECT_COMPONENT_';
|
||||||
// load component options from array
|
// load component options from array
|
||||||
foreach($this->Components as $componet)
|
foreach($this->Components as $componet)
|
||||||
{
|
{
|
||||||
$componentOptions[(int) $componet->id] = $this->escape($componet->name);
|
$options[(int) $componet->id] = $this->escape($componet->name);
|
||||||
}
|
}
|
||||||
// load the component options
|
|
||||||
ComponentbuilderHelper::xmlAddOptions($componentXML, $componentOptions);
|
|
||||||
// setup the component radio field
|
|
||||||
$component->setup($componentXML,'');
|
|
||||||
// add to form
|
// add to form
|
||||||
$form[] = $component;
|
$form[] = ComponentbuilderHelper::getFieldObject($attributes, '', $options);
|
||||||
|
|
||||||
// return the form array
|
// return the form array
|
||||||
return $form;
|
return $form;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<extension type="component" version="3.2" method="upgrade">
|
<extension type="component" version="3.2" method="upgrade">
|
||||||
<name>COM_COMPONENTBUILDER</name>
|
<name>COM_COMPONENTBUILDER</name>
|
||||||
<creationDate>30th July, 2018</creationDate>
|
<creationDate>31st July, 2018</creationDate>
|
||||||
<author>Llewellyn van der Merwe</author>
|
<author>Llewellyn van der Merwe</author>
|
||||||
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
|
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
|
||||||
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>
|
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>
|
||||||
|
@ -4017,10 +4017,50 @@ abstract class ComponentbuilderHelper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the field object
|
||||||
|
*
|
||||||
|
* @param array $attributes The array of attributes
|
||||||
|
* @param string $default The default of the field
|
||||||
|
* @param array $options The options to apply to the XML element
|
||||||
|
*
|
||||||
|
* @return object
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static function getFieldObject($attributes, $default = '', $options = null)
|
||||||
|
{
|
||||||
|
// make sure we have a type
|
||||||
|
if (isset($attributes['type']))
|
||||||
|
{
|
||||||
|
// make sure the form helper class is loaded
|
||||||
|
if (!method_exists('JFormHelper', 'loadFieldType'))
|
||||||
|
{
|
||||||
|
jimport('joomla.form.form');
|
||||||
|
}
|
||||||
|
// get field type
|
||||||
|
$field = JFormHelper::loadFieldType($attributes['type'],true);
|
||||||
|
// start field xml
|
||||||
|
$XML = new SimpleXMLElement('<field/>');
|
||||||
|
// load the attributes
|
||||||
|
self::xmlAddAttributes($XML, $attributes);
|
||||||
|
// check if we have options
|
||||||
|
if (self::checkArray($options))
|
||||||
|
{
|
||||||
|
// load the options
|
||||||
|
self::xmlAddOptions($XML, $options);
|
||||||
|
}
|
||||||
|
// setup the field
|
||||||
|
$field->setup($XML, $default);
|
||||||
|
// return the field object
|
||||||
|
return $field;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render Bool Button
|
* Render Bool Button
|
||||||
*
|
*
|
||||||
* @param array $args All the args for the button
|
* @param array $args All the args for the button
|
||||||
* 0) name
|
* 0) name
|
||||||
* 1) additional (options class) // not used at this time
|
* 1) additional (options class) // not used at this time
|
||||||
* 2) default
|
* 2) default
|
||||||
@ -4035,8 +4075,6 @@ abstract class ComponentbuilderHelper
|
|||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
// check if there is additional button class
|
// check if there is additional button class
|
||||||
$additional = isset($args[1]) ? (string) $args[1] : ''; // not used at this time
|
$additional = isset($args[1]) ? (string) $args[1] : ''; // not used at this time
|
||||||
// start the xml
|
|
||||||
$buttonXML = new SimpleXMLElement('<field/>');
|
|
||||||
// button attributes
|
// button attributes
|
||||||
$buttonAttributes = array(
|
$buttonAttributes = array(
|
||||||
'type' => 'radio',
|
'type' => 'radio',
|
||||||
@ -4045,22 +4083,12 @@ abstract class ComponentbuilderHelper
|
|||||||
'class' => 'btn-group',
|
'class' => 'btn-group',
|
||||||
'filter' => 'INT',
|
'filter' => 'INT',
|
||||||
'default' => isset($args[2]) ? (int) $args[2] : 0);
|
'default' => isset($args[2]) ? (int) $args[2] : 0);
|
||||||
// load the haskey attributes
|
|
||||||
self::xmlAddAttributes($buttonXML, $buttonAttributes);
|
|
||||||
// set the button options
|
// set the button options
|
||||||
$buttonOptions = array(
|
$buttonOptions = array(
|
||||||
'1' => isset($args[3]) ? self::htmlEscape($args[3]) : 'JYES',
|
'1' => isset($args[3]) ? self::htmlEscape($args[3]) : 'JYES',
|
||||||
'0' => isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO');
|
'0' => isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO');
|
||||||
// load the button options
|
// return the input
|
||||||
self::xmlAddOptions($buttonXML, $buttonOptions);
|
return self::getFieldObject($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input;
|
||||||
|
|
||||||
// get the radio element
|
|
||||||
$button = JFormHelper::loadFieldType('radio');
|
|
||||||
|
|
||||||
// run
|
|
||||||
$button->setup($buttonXML, $buttonAttributes['default']);
|
|
||||||
|
|
||||||
return $button->input;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user