Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

feat pagebuilder module position from DB #46

Closed

Conversation

bees4ever
Copy link
Contributor

Summary of Changes

Load a list of exiting module position for the pagebuilder.

Testing Instructions

  1. Open the apodis template style
  2. Switch to tab Page Builder
  3. Click on the below Add button Bildschirmfoto 2019-09-05 um 16 12 03
  4. Switch to Module Positions

Expected result

There should be a option list with module positions.

Bildschirmfoto 2019-09-05 um 16 13 54

Actual result

There is an input field.

Documentation Changes Required

Not that I know.

@drmenzelit
Copy link
Contributor

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.

@bembelimen
Copy link
Contributor

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?

@bees4ever
Copy link
Contributor Author

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;
}
Copy link
Contributor

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",
Copy link
Contributor

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?

Copy link
Contributor Author

@bees4ever bees4ever Sep 6, 2019

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
}
}
},
Copy link
Contributor

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',
Copy link
Contributor

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?

Copy link
Contributor Author

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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$pagebuilderPositions = ModulesHelper::getPageBuilderPositions($clientId);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, great

Copy link
Contributor Author

@bees4ever bees4ever left a 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',
Copy link
Contributor Author

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();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, great

roland-d added a commit that referenced this pull request Feb 9, 2020
Signed-off-by: Roland Dalmulder <[email protected]>
roland-d added a commit that referenced this pull request Feb 9, 2020
@roland-d
Copy link
Contributor

roland-d commented Feb 9, 2020

Closing this in favor of #72

@roland-d roland-d closed this Feb 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants