Component Builder (v.5.1.1-alpha2)
+ Component Builder (v.5.1.1-alpha3)
The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time.
diff --git a/componentbuilder_update_server.xml b/componentbuilder_update_server.xml
index 667253e5b..9e29123fe 100644
--- a/componentbuilder_update_server.xml
+++ b/componentbuilder_update_server.xml
@@ -134,7 +134,7 @@
5.1.1-alpha
https://dev.vdm.io
- https://github.com/vdm-io/pkg-component-builder/archive/refs/tags/v5.1.1-alpha1.zip
+ https://github.com/vdm-io/pkg-component-builder/archive/refs/tags/v5.1.1-alpha3.zip
alpha
@@ -149,10 +149,10 @@
pkg_component_builder
package
site
- 5.1.1-alpha2
+ 5.1.1-alpha3
https://dev.vdm.io
- https://github.com/vdm-io/pkg-component-builder/archive/refs/tags/v5.1.1-alpha2.zip
+ https://github.com/vdm-io/pkg-component-builder/archive/refs/tags/v5.1.1-alpha3.zip
alpha
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Component/Structuremultiple.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Component/Structuremultiple.php
index e2c97785d..7acb97ee4 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Component/Structuremultiple.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Component/Structuremultiple.php
@@ -12,7 +12,6 @@
namespace VDM\Joomla\Componentbuilder\Compiler\Component;
-use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
use VDM\Joomla\Componentbuilder\Compiler\Config;
use VDM\Joomla\Componentbuilder\Compiler\Registry;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Component\SettingsInterface as Settings;
@@ -88,30 +87,29 @@ final class Structuremultiple
protected Structure $structure;
/**
- * Constructor
+ * Constructor.
*
- * @param Config|null $config The compiler config object.
- * @param Registry|null $registry The compiler registry object.
- * @param Settings|null $settings The compiler component Joomla version settings object.
- * @param Component|null $component The component class.
- * @param Createdate|null $createdate The compiler model to get create date class.
- * @param Modifieddate|null $modifieddate The compiler model to get modified date class.
- * @param Structure|null $structure The compiler structure to build dynamic folder and files class.
+ * @param Config $config The Config Class.
+ * @param Registry $registry The Registry Class.
+ * @param Settings $settings The SettingsInterface Class.
+ * @param Component $component The Component Class.
+ * @param Createdate $createdate The Createdate Class.
+ * @param Modifieddate $modifieddate The Modifieddate Class.
+ * @param Structure $structure The Structure Class.
*
* @since 3.2.0
*/
- public function __construct(?Config $config = null, ?Registry $registry = null,
- ?Settings $settings = null, ?Component $component = null,
- ?Createdate $createdate = null, ?Modifieddate $modifieddate = null,
- ?Structure $structure = null)
+ public function __construct(Config $config, Registry $registry, Settings $settings,
+ Component $component, Createdate $createdate,
+ Modifieddate $modifieddate, Structure $structure)
{
- $this->config = $config ?: Compiler::_('Config');
- $this->registry = $registry ?: Compiler::_('Registry');
- $this->settings = $settings ?: Compiler::_('Component.Settings');
- $this->component = $component ?: Compiler::_('Component');
- $this->createdate = $createdate ?: Compiler::_('Model.Createdate');
- $this->modifieddate = $modifieddate ?: Compiler::_('Model.Modifieddate');
- $this->structure = $structure ?: Compiler::_('Utilities.Structure');
+ $this->config = $config;
+ $this->registry = $registry;
+ $this->settings = $settings;
+ $this->component = $component;
+ $this->createdate = $createdate;
+ $this->modifieddate = $modifieddate;
+ $this->structure = $structure;
}
/**
@@ -274,6 +272,25 @@ final class Structuremultiple
return true;
}
+ /**
+ * Check if the view has an Modal
+ *
+ * @param array $view
+ *
+ * @return int
+ * @since 5.1.1
+ */
+ private function hasModal(array $view): int
+ {
+ // only for Joomla 5 and above
+ if ($this->config->get('joomla_version', 3) > 4)
+ {
+ return 1;
+ }
+
+ return 0;
+ }
+
/**
* Check if the view has an API
*
@@ -336,12 +353,19 @@ final class Structuremultiple
*/
private function buildAdminView(array $view, array $config)
{
+ $addModal = $this->hasModal($view);
+
// build the admin edit view
if ($view['settings']->name_single != 'null')
{
$target = ['admin' => $view['settings']->name_single];
$this->structure->build($target, 'single', false, $config);
+ if ($addModal)
+ {
+ $this->structure->build($target, 'single_modal', false, $config);
+ }
+
// build the site edit view (of this admin view)
if (isset($view['edit_create_site_view'])
&& is_numeric($view['edit_create_site_view'])
@@ -350,6 +374,11 @@ final class Structuremultiple
// setup the front site edit-view files
$target = ['site' => $view['settings']->name_single];
$this->structure->build($target, 'edit', false, $config);
+
+ if ($addModal)
+ {
+ $this->structure->build($target, 'edit_modal', false, $config);
+ }
}
}
@@ -358,6 +387,11 @@ final class Structuremultiple
{
$target = ['admin' => $view['settings']->name_list];
$this->structure->build($target, 'list', false, $config);
+
+ if ($addModal)
+ {
+ $this->structure->build($target, 'list_modal', false, $config);
+ }
}
}
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Field/Attributes.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Field/Attributes.php
index 936634b82..e71650e29 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Field/Attributes.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Field/Attributes.php
@@ -551,6 +551,11 @@ final class Attributes
return $this->removeRequired();
}
+ if ($name === 'sql_title_key' && 'ModalSelect' === $this->typeName)
+ {
+ return $this->getSqlTitleKey();
+ }
+
if ($this->viewType == 2 && in_array($name, ['readonly', 'disabled']))
{
return $this->setReadonly($name);
@@ -967,7 +972,7 @@ final class Attributes
{
// load the text key
$this->attributes['custom']['text']
- = StringHelper::safe(
+ = FieldHelper::safe(
GetHelper::between(
$this->settings->xml, 'value_field="', '"'
)
@@ -986,7 +991,7 @@ final class Attributes
{
// load the id key
$this->attributes['custom']['id']
- = StringHelper::safe(
+ = FieldHelper::safe(
GetHelper::between(
$this->settings->xml, 'key_field="', '"'
)
@@ -1045,6 +1050,30 @@ final class Attributes
return 'false';
}
+ /**
+ * get sql title key value
+ * and set the [data-key-name] if the key is not an [id]
+ *
+ * @return string|null
+ * @since 5.1.1
+ */
+ private function getSqlTitleKey(): ?string
+ {
+ // load the id key
+ $key = FieldHelper::safe(
+ GetHelper::between(
+ $this->settings->xml, 'sql_title_key="', '"'
+ )
+ );
+
+ if ($key !== 'id')
+ {
+ $this->attributes['data-key-name'] = $key;
+ }
+
+ return $key;
+ }
+
/**
* set the readonly switch
*
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Field/ModalSelect.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Field/ModalSelect.php
index b1bef028a..b07b147d3 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Field/ModalSelect.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Field/ModalSelect.php
@@ -112,6 +112,7 @@ final class ModalSelect
}
$sql_title_key = $fieldAttributes['sql_title_key'] ?? 'id';
+ $sql_title_column = $fieldAttributes['sql_title_column'] ?? 'id';
// if one field is not id, we add an override to the ModalSelectField as a FIX
if (!$this->addedFix && $sql_title_key !== 'id')
@@ -130,6 +131,15 @@ final class ModalSelect
$this->addedFix = true;
}
+ // make sure we have the target view code name
+ $view ??= 'error';
+
+ // add the Title Key for the Modal
+ $this->contentmulti->set($view . '|SQL_TITLE_KEY', $sql_title_key);
+
+ // add the Title Column for the Modal
+ $this->contentmulti->set($view . '|SQL_TITLE_COLUMN', $sql_title_column);
+
return [
'modal_select' => true,
'urlSelect' => $fieldAttributes['urlSelect'] ?? '',
@@ -138,9 +148,9 @@ final class ModalSelect
'iconSelect' => $fieldAttributes['iconSelect'] ?? '',
'table' => $field_target_table,
'id' => $sql_title_key,
- 'text' => $fieldAttributes['sql_title_column'] ?? '',
+ 'text' => $sql_title_column,
'component' => $component ?? 'error',
- 'view' => $view ?? 'error',
+ 'view' => $view,
'views' => $views ?? 'error',
'button' => false,
'extends' => ''
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Infusion.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Infusion.php
index ae7b75480..56a9eb187 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Infusion.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/Helper/Infusion.php
@@ -420,6 +420,15 @@ class Infusion extends Interpretation
'jcb_ce_onBeforeBuildAdminEditViewContent', [&$view, &$nameSingleCode, &$nameListCode]
);
+ // Here we set defaults
+ // The real values are set in ModalSelect(4fc020dc-3137-478d-8d42-0571a75b77b5)
+
+ // add the Title Key for the Modal
+ CFactory::_('Compiler.Builder.Content.Multi')->set($nameSingleCode . '|SQL_TITLE_KEY', 'id');
+
+ // add the Title Column for the Modal
+ CFactory::_('Compiler.Builder.Content.Multi')->set($nameSingleCode . '|SQL_TITLE_COLUMN', 'name');
+
// FIELDSETS <<>>
CFactory::_('Compiler.Builder.Content.Multi')->set($nameSingleCode . '|FIELDSETS',
CFactory::_('Compiler.Creator.Fieldset')->get(
diff --git a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaFour/Header.php b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaFour/Header.php
index 239adff9c..0122573a4 100644
--- a/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaFour/Header.php
+++ b/libraries/vendor_jcb/VDM.Joomla/src/Componentbuilder/Compiler/JoomlaFour/Header.php
@@ -200,7 +200,7 @@ final class Header implements HeaderInterface
$headers = $this->getHeaders($context);
// add to all except the helper classes
- if ('admin.helper' !== $context && 'site.helper' !== $context)
+ if ('admin.helper' !== $context && 'site.helper' !== $context && 'plugin.extension.header' !== $context && 'plugin.provider.header' !== $context)
{
$target = 'Administrator';
if ($this->config->get('build_target', 'admin') === 'site')