Editors xtd #871

Closed
saman222 wants to merge 3 commits from editors_xtd into staging
saman222 commented 12 months ago (Migrated from github.com)
Owner
There is no content yet.
saman222 commented 12 months ago (Migrated from github.com)
Owner

please ignore this commite: c37dfc0
i wanted to only send this commite : d57f35f
But I made a small mistake in sending commit

please ignore this commite: [c37dfc0](https://github.com/vdm-io/Joomla-Component-Builder/pull/871/commits/c37dfc0b21abe194a30e626fc79dc059fe2d5c54) i wanted to only send this commite : [d57f35f](https://github.com/vdm-io/Joomla-Component-Builder/pull/871/commits/d57f35fc006ce1dc189bf5af30358e6cf2e8891c) But I made a small mistake in sending commit
Owner

Listen I am the worse lead developer ever... (I mean I am difficult to work with... find fault with everything) if you make a PR where I need to workout what your trying to do from a title and a bunch of commit messages then your never going to get my support.

There is just one developer in JCB at this time that can change many files and don't need to explain every change, and unfortunately that is me, since I am the owner and already proven that I can be trusted.

So other developers need to make every change a commit that is explanatory of the expected change.

Yes I can read the code, and it looks okay to me at first glance... but I don't have much time to research it, since then I can just as well done it my self. That means it is better to have more commits documenting every change and making it easy form me to see what your are doing. Then on opening a pull request there is a template:

Pull Request for Issue gh- .

### Summary of Changes

### Testing Instructions

### Expected result

### Actual result

### Documentation Changes Required

You must use these to explain in simple terms the overall idea of your changes, so that those who do not have advance knowledge of the core compiler would understand what your trying to do.

So please do us the favor and update the description of this PR with these details so that other developers like @ohrionmartin and @ohrionmartin or @ro-ot can easy understand and test this PR.

Listen I am the worse lead developer ever... (I mean I am difficult to work with... find fault with everything) if you make a PR where I need to workout what your trying to do from a title and a bunch of commit messages then your never going to get my support. There is just one developer in JCB at this time that can change many files and don't need to explain every change, and unfortunately that is me, since I am the owner and already proven that I can be trusted. So other developers need to make every change a commit that is explanatory of the expected change. Yes I can read the code, and it looks okay to me at first glance... but I don't have much time to research it, since then I can just as well done it my self. That means it is better to have more commits documenting every change and making it easy form me to see what your are doing. Then on opening a pull request there is a template: ``` Pull Request for Issue gh- . ### Summary of Changes ### Testing Instructions ### Expected result ### Actual result ### Documentation Changes Required ``` You must use these to explain in simple terms the overall idea of your changes, so that those who do not have advance knowledge of the core compiler would understand what your trying to do. So please do us the favor and update the description of this PR with these details so that other developers like @ohrionmartin and @ohrionmartin or @ro-ot can easy understand and test this PR.
Owner

@saman222 any feedback on my previous request?

@saman222 any feedback on my previous request?
saman222 commented 11 months ago (Migrated from github.com)
Owner

Hi @Llewellynvdm , I hope you are well.

To create a plugin from the editors-xtd group (add a button to the editor), I went to the jcb plugin section and went through the steps of creating this plugin. After compiling, installing and activating that plugin, I went to the Joomla article creation page to see the result. To see if the button I wanted was added to that page's editor or not, I got an error (syntax error, unexpected '-', expecting '{') which is actually a syntax error and may not be a direct JCB bug . After searching, I realized that the name of the main class of Joomla editors-xtd plugins should be "plgButtonPluginName" instead of "plgEditors-xtdPluginName"

Summary of Changes

In the setJoomlaPlugin function in the Get class (/public_html/administrator/components/com_componentbuilder/helpers/compiler/a_Get.php path), almost on line 10152, the name of the plugin class is created. I put the creation of the plugin class name in a function called createPluginClassName in the path (/administrator/components/com_componentbuilder/helpers/componentbuilder.php) which checks if the plugin group was editors-xtd to name the class as "plgButtonPluginName"

Testing Instructions

Making a plugin with the editors-xtd group

Expected result

Build a plugin with the editors-xtd group and the class name "plgButtonPluginName"

Actual result

Build a plugin with the editors-xtd group and the class name "plgEditors-xtdPluginName" and error

Hi @Llewellynvdm , I hope you are well. To create a plugin from the editors-xtd group (add a button to the editor), I went to the jcb plugin section and went through the steps of creating this plugin. After compiling, installing and activating that plugin, I went to the Joomla article creation page to see the result. To see if the button I wanted was added to that page's editor or not, I got an error (syntax error, unexpected '-', expecting '{') which is actually a syntax error and may not be a direct JCB bug . After searching, I realized that the name of the main class of Joomla editors-xtd plugins should be "plgButtonPluginName" instead of "plgEditors-xtdPluginName" ### Summary of Changes In the setJoomlaPlugin function in the Get class (/public_html/administrator/components/com_componentbuilder/helpers/compiler/a_Get.php path), almost on line 10152, the name of the plugin class is created. I put the creation of the plugin class name in a function called createPluginClassName in the path (/administrator/components/com_componentbuilder/helpers/componentbuilder.php) which checks if the plugin group was editors-xtd to name the class as "plgButtonPluginName" ### Testing Instructions Making a plugin with the editors-xtd group ### Expected result Build a plugin with the editors-xtd group and the class name "plgButtonPluginName" ### Actual result Build a plugin with the editors-xtd group and the class name "plgEditors-xtdPluginName" and error
Owner

Okay so I have been working on moving things to library classes, basically moving to J4 we need namespacing everywhere... so I am starting with the basics first, and just for JCB at this time, it will not yet effect other components build with JCB.

So I will manually add these Plugin naming method to its own utilities class and I should be pushing this up soon. So thanks @saman222 for the code I will use it... keep a lookout to the new way we are going... the place to watch is going to be in libraries folder.

Okay so I have been working on moving things to library classes, basically moving to J4 we need namespacing everywhere... so I am starting with the basics first, and just for JCB at this time, it will not yet effect other components build with JCB. So I will manually add these Plugin naming method to its own utilities class and I should be pushing this up soon. So thanks @saman222 for the code I will use it... keep a lookout to the new way we are going... the place to watch is going to be in libraries folder.
Owner

So here is the code I used... check the format of the braces and the order of the function variables.

I just refactored it a little more, this is how it will look like

/**
 * Making plugin folder name safe
 *
 * @input	string    $codeName   The name
 * @input	string    $group   The group name
 *
 * @returns string on success
 */
public static function safeFolderName($codeName, $group)
{
	// editors-xtd group plugins must have a class with plgButton<PluginName> structure
	if ($group === 'editors-xtd')
	{
		$group = 'Button';
	}

	return 'plg_' . strtolower($group) . '_' . strtolower(
		$codeName
	);
}

/**
 * Making plugin class name safe
 *
 * @input	string    $codeName   The name
 * @input	string    $group   The group name
 *
 * @returns string on success
 */
public static function safeClassName($codeName, $group)
{
	// editors-xtd group plugins must have a class with plgButton<PluginName> structure
	if ($group === 'editors-xtd')
	{
		$group = 'Button';
	}

	return 'Plg' . ucfirst($group) . ucfirst(
		$codeName
	);
}

/**
 * Making plugin install class name safe
 *
 * @input	string    $codeName   The name
 * @input	string    $group   The group name
 *
 * @returns string on success
 */
public static function safeInstallClassName($codeName, $group)
{
	// editors-xtd group plugins must have a class with plgButton<PluginName> structure
	if ($group === 'editors-xtd')
	{
		$group = 'Button';
	}

	return 'plg' . ucfirst($group) . ucfirst(
		$codeName
	) . 'InstallerScript';
}

/**
 * Making language prefix safe
 *
 * @input	string    $codeName   The name
 * @input	string    $group   The group name
 *
 * @returns string on success
 */
public static function safeLangPrefix($codeName, $group)
{
	// editors-xtd group plugins must have a class with plgButton<PluginName> structure
	if ($group === 'editors-xtd')
	{
		$group = 'Button';
	}

	return 'PLG_' . strtoupper($group) . strtoupper(
		$codeName
	);
}

I will close this PR now... @saman222 see you around in the next PR 👍

So here is the [code I used](https://github.com/vdm-io/Joomla-Component-Builder/blob/staging/libraries/jcb_powers/VDM.Joomla/src/Utilities/String/PluginHelper.php)... check the format of the braces and the order of the function variables. I just refactored it a little more, this is how it will look like ``` /** * Making plugin folder name safe * * @input string $codeName The name * @input string $group The group name * * @returns string on success */ public static function safeFolderName($codeName, $group) { // editors-xtd group plugins must have a class with plgButton<PluginName> structure if ($group === 'editors-xtd') { $group = 'Button'; } return 'plg_' . strtolower($group) . '_' . strtolower( $codeName ); } /** * Making plugin class name safe * * @input string $codeName The name * @input string $group The group name * * @returns string on success */ public static function safeClassName($codeName, $group) { // editors-xtd group plugins must have a class with plgButton<PluginName> structure if ($group === 'editors-xtd') { $group = 'Button'; } return 'Plg' . ucfirst($group) . ucfirst( $codeName ); } /** * Making plugin install class name safe * * @input string $codeName The name * @input string $group The group name * * @returns string on success */ public static function safeInstallClassName($codeName, $group) { // editors-xtd group plugins must have a class with plgButton<PluginName> structure if ($group === 'editors-xtd') { $group = 'Button'; } return 'plg' . ucfirst($group) . ucfirst( $codeName ) . 'InstallerScript'; } /** * Making language prefix safe * * @input string $codeName The name * @input string $group The group name * * @returns string on success */ public static function safeLangPrefix($codeName, $group) { // editors-xtd group plugins must have a class with plgButton<PluginName> structure if ($group === 'editors-xtd') { $group = 'Button'; } return 'PLG_' . strtoupper($group) . strtoupper( $codeName ); } ``` I will close this PR now... @saman222 see you around in the next PR :+1:
This pull request cannot be reopened because the branch was deleted.
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: joomla/Component-Builder#871
Loading…
There is no content yet.