Opened 4 years ago

Closed 4 years ago

#10421 closed enhancement (wontfix)

Unique ID on installed plugins

Reported by: williamsba1 Owned by:
Priority: normal Milestone:
Component: Plugins Version:
Severity: normal Keywords: has-patch
Cc:

Description

Currently all plugins listed on the Installed Plugins SubPanel have an active or inactive class. Would be nice for each to also have a unique ID, which could be generated from the plugin name

example: <tr class="active" id="akismet">

This would allow custom designs on individual plugins listed.

Attachments (1)

plugins.diff (612 bytes) - added by williamsba1 4 years ago.
added to $class variable to include plugin name to class

Download all attachments as: .zip

Change History (13)

suggesting we use a class instead:

class='$class' id='{$plugin_data['Name']}'

should be:

class='$class plugin-{$plugin_data['Name']}'

Or better yet, something that passes through sanitize_classname(). But definitely a class, not an ID. We can't know if/when we'll have plugins listed twice on the same screen.

  • Milestone changed from Unassigned to 2.9
  • Keywords has-patch added

I updated the patch file to include the plugin name in the class as your example shows.

  • Keywords needs-patch added; has-patch removed

there's a slight typo:

<tr class='$class plugin-{$plugin_data['Name']}' second> 

should at least be:

<tr class='$class plugin-{$plugin_data['Name']} second'> 

and probably:

<tr class='$class " . sanitize_html_class('plugin-' . $plugin_data['Name'], '') . " second'> 

or even this a bit further up:

$class .= ' ' . sanitize_html_class('plugin-' . $plugin_data['Name'], '');

added to $class variable to include plugin name to class

  • Keywords has-patch added; needs-patch removed

updated patch to add to $class variable to include plugin name

Cool. So, quick question... Is this behavior the behavior we're wanting (now you're seeing why I so preferred the class to the ID):

	<tr class='inactive plugin-Akismet'>
...	</tr>
	<tr class='inactive plugin-Akismet second'>
...	</tr>

To me, it makes sense, based on your stated goals, i.e. style a particular plugin in the admin area.

This works perfect for the intended goal. Just needed a way to style individual plugins listed and this update accomplishes just that!

The last patch looks good but why is this needed? A plugin would be able to add the required css only while active or perhaps one plugin could highlight another? Or plugins can be hidden with js or css? Not sure if that's a good idea.

comment:10 follow-up: ↓ 12   williamsba14 years ago

I'm not sure how you would style individual plugins listed without some sort of unique identifier in either the class or by adding an ID?

I, too, would not want a plugin to mess with the "Plugin List"! This is just not good, because it will confuse people and it will encourage more and more plugin authors to do the same, which will result in a very "colorful" Plugin List...

But, if you really need it, you could do it with jQuery, so no need for a CSS ID.
Have a look at the find ":contains()" selector.
You could add a class to your plugin's row with something like this:

$("tr:contains('Plugin Name')").addClass('special-plugin-row');

comment:12 in reply to: ↑ 10   azaozz4 years ago

  • Milestone 2.9 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Replying to williamsba1:

I'm not sure how you would style individual plugins listed without some sort of..

It's not how, it's why would you want to do this.

Note: See TracTickets for help on using tickets.