-
-
Notifications
You must be signed in to change notification settings - Fork 16
feat pagebuilder module position from DB #46
Conversation
Thank you for your contribution @bees4ever , but if I see correctly the list is showing all existent positions from other templates, also from backend template. And that is not what we want to achieve. The idea of the page builder is to create a new template and also new module positions. Maybe is a combination of select list (but only with frontend positions) and an input field could be a solution. |
Hello @bees4ever thank you for your suggestion. In general I like the idea where your PR is going, but I also think it's not there where it should be, because we have to solve some "bigger" challenges. The reason for the input field was (and still is) that one never knows how many and which positions he/she wants to add. In Joomla! it's possible to add new positions on the fly (typing in the position name and press [enter]). So everyone can define their own field. As @drmenzelit mentioned, your field lists all positions from all templates, but we only need (perhaps) a predefined list for the builder itself (position-1 to position-20) and a way to add manually new positions. The same combination field you added, but limited to the page builder. On the other hand we still need a solution for the position selector in the module itself. There we should not only list the page builder default positions (position-1 to position-20) but also the manually added. Perhaps you can extend your PR with a solution for this? |
Hi @bembelimen, roland-d explained me what you mean with the second point, I will start with this issue. A draft of the "input & selection" feature is committed. |
} | ||
|
||
return $customPosNames; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public static function getPageBuilderPositions($clientId)
{
$customPosNames = [];
$db = Factory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('params'))
->from($db->quoteName('#__template_styles'))
->where($db->quoteName('client_id') . ' = ' . (int) $clientId);
$list = $db->setQuery($query)->loadObjectList();
foreach ($list as $param)
{
$paramsConf = json_decode($param->params, true);
if ($paramsConf != null && isset($paramsConf["grid"]))
{
$paramsGridConf = json_decode($paramsConf["grid"], true);
array_walk_recursive($paramsGridConf, function ($value, $key) use (&$customPosNames) {
if ($key == "position_name")
{
$customPosNames[] = [
"value" => $value,
"text" => $value,
"disable" => false
];
}
});
}
}
return $customPosNames;
}
"qrcode-generator": "^1.4.3", | ||
"roboto-fontface": "^0.10.0", | ||
"sass": "^1.23.0-module.beta.1", | ||
"sass-loader": "^8.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure, that this new dependencies are needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 52 - 54 is indeed needed, because of the Vue JS Component I wrote to diesplay the module list in the page builder
}, | ||
"yallist": { | ||
"version": "3.0.3", | ||
"bundled": true, | ||
"dev": true | ||
"dev": true, | ||
"optional": true | ||
} | ||
} | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not commit this file if there are no changes.
performance: { | ||
hints: false | ||
}, | ||
devtool: 'eval-source-map', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need this new dependencies?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is is also needed, because of the same reason
@@ -183,6 +183,8 @@ public function positions($clientId, $state = 1, $selectedPosition = '') | |||
$customGroupText = Text::_('COM_MODULES_CUSTOM_POSITION'); | |||
$editPositions = true; | |||
$customPositions = ModulesHelper::getPositions($clientId, $editPositions); | |||
$pagebuilderPositions = ModulesHelper::getPageBuilderPositions(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$pagebuilderPositions = ModulesHelper::getPageBuilderPositions($clientId);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, great
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I can see, we need the package.json / webpack changes, to compile the Vue JS Components correctly.
performance: { | ||
hints: false | ||
}, | ||
devtool: 'eval-source-map', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is is also needed, because of the same reason
@@ -183,6 +183,8 @@ public function positions($clientId, $state = 1, $selectedPosition = '') | |||
$customGroupText = Text::_('COM_MODULES_CUSTOM_POSITION'); | |||
$editPositions = true; | |||
$customPositions = ModulesHelper::getPositions($clientId, $editPositions); | |||
$pagebuilderPositions = ModulesHelper::getPageBuilderPositions(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, great
Signed-off-by: Roland Dalmulder <[email protected]>
Signed-off-by: Roland Dalmulder <[email protected]>
Closing this in favor of #72 |
Summary of Changes
Load a list of exiting module position for the pagebuilder.
Testing Instructions
apodis
template stylePage Builder
Add
buttonModule Positions
Expected result
There should be a option list with module positions.
Actual result
There is an input field.
Documentation Changes Required
Not that I know.