User tests: Successful: Unsuccessful:
With the plugins in the editors-xtd folder you need to prefix the main class names with plgButton
, like plgButtonFoobar
However if you also use an installer script, the prefix should be plgEditorsXtd
, like plgEditorsXtdFoobarInstallerScript
.
This is confusing and makes no sense.
This PR makes it possible to use plgEditorsXtd
as a prefix to the main plugin class.
So you can use plgEditorsXtdFoobar
and plgEditorsXtdFoobarInstallerScript
I'd rather deprecate the use of plgButton
completely...
Just rename the class name in, for instance, /plugins/editors-xtd/readmore/readmore.php
from PlgButtonReadmore
to PlgEditorsXtdReadmore
.
Before this patch it will not show the Read More button any more. After this patch it will.
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
Just a query: I see core extensions using prefix Plg
(so uppercased first letter), however, the code checks for plg
.
Should first letters in class names be upper- or lowercase?
as well.
Just a query: I see core extensions using prefix Plg (so uppercased first letter), however, the code checks for plg.
Should first letters in class names be upper- or lowercase?
Coding Standards (http://joomla.github.io/coding-standards/?coding-standards/chapters/php.md) says for classes:
Class names should always begin with an uppercase letter and be written in CamelCase even if using traditionally uppercase acronyms (such as XML, HTML).
For PHP itself it doesn't matter as class names aren't case sensitive.
Yeah, I know it doesn't matter for php itself.
But following those coding standards, should we be changing the code that checks for classnames to reflect this?
So do this instead:
$className = 'PlgEditorsXtd' . $plugin->name;
if (!class_exists($className))
{
$className = 'PlgButton' . $plugin->name;
}
Or is that not worth fussing about?
(this would require 'fixes' in a lot of core files!)
For consistency it would make sense, but it's probably not worth the effort.
And outside of the scope of this PR anyway ;)
It really only starts to matter if you're using the autoloader because of
how it splits paths on camel case. Since extensions mostly aren't
autoloaded, it doesn't really matter right now. But down the line, I think
the code should match the expected naming convention (plgbuttonarticle !==
PlgButtonArticle)
On Saturday, July 18, 2015, Peter van Westen notifications@github.com
wrote:
Just a query: I see core extensions using prefix Plg (so uppercased first
letter), however, the code checks for plg.
Should first letters in class names be upper- or lowercase?—
Reply to this email directly or view it on GitHub
#7461 (comment).
Ok, changed :)
Milestone |
Added: |
Category | ⇒ | Libraries |
Easy | No | ⇒ | Yes |
Can this go to RTC? Has 2 successful tests...
Status | Pending | ⇒ | Ready to Commit |
Labels |
Added:
?
|
I think this a B/C break. Anybody else using their own editors-xtd buttons would need to update their code as well or not?
@infograf768 Thanks, you are correct, I missed that.
Thanks all, merged into 3.5-dev with commit 39db3c
Status | Ready to Commit | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-10-17 09:24:11 |
Closed_By | ⇒ | roland-d |
Labels |
Removed:
?
|
Looks good to me, consistency is always nice.
On Saturday, July 18, 2015, Peter van Westen notifications@github.com
wrote: