Problem/Motivation

The relationship between filters and formats is unclear and would be helped by linking to the relevant administrative page.

Proposed resolution

Clearly document the relationship between filters and formats and improve usability by linking to the relevant administrative page from the permissions screen.

Remaining tasks

Contributor tasks needed
Task Novice task? Contributor instructions Complete?
Reroll the patch if it no longer applies. Instructions
Manually test the patch Novice Instructions

Steps to reproduce the issue

  • Visit the permissions screen
  • See that the description is missing for the "administer filters" item

Original report by @amontero

To hopefully document the relationship between filters and formats and also improving usability a bit by linking to the relevant administrative page.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jthorson’s picture

Issue tags: +Novice

Tagging 'novice' for review and manual testing.

trogels’s picture

Status: Needs review » Reviewed & tested by the community

The patch applies, follows the coding standards and implements the t() function as it's supposed to

yoroy’s picture

Status: Reviewed & tested by the community » Needs work

The link is a good idea. Lets try to write this in a way that doesn't almost literally repeat the label. Something like this maybe:

Define how text is handled by combining filters into [link]text formats[/link]

amontero’s picture

Status: Needs work » Needs review
FileSize
944 bytes

Me too likes it better that way. Rerolling.
Looks good in my system, please review.

botris’s picture

Status: Needs review » Reviewed & tested by the community

Tested and confirming it works

yoroy’s picture

Nice, thanks all.

amontero’s picture

I would be thankful if someone may help with similar issue: #1365234: Add description to "access content overview" permission.
We're stuck with the help text phrase there. @yoroy: your usability skills can be very helpful at ths point, since you nailed it here.
TIA.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x. Thanks!

amontero’s picture

Version: 8.x-dev » 7.x-dev
Status: Fixed » Needs review
Issue tags: +Needs backport to D7
FileSize
903 bytes

Reroll against 7.x

jthorson’s picture

Status: Needs review » Reviewed & tested by the community

Applies and does what it says. RTBC.

jthorson’s picture

Status: Reviewed & tested by the community » Needs work

On second thought, let's make it read the same as D8 ...

jthorson’s picture

Status: Needs work » Needs review
FileSize
592 bytes
amontero’s picture

Status: Needs review » Reviewed & tested by the community

Ops. Thanks, jthorson. I rerolled the wrong patch :S
Patch applies and works as expected.

jthorson’s picture

Note to committer: Commit credit goes to Amontero (& possibly Yoroy for the wording suggestions).

amontero’s picture

@jthorson: I do not agree. I don't know about core maintainers practices, but IMO correcting that mistake is obviously worth crediting, too ;)
As a side note, that brought back to my mind an awesome Drupal Dev Days Barcelona 2012 speech by @webchick that I could not find recorded. I mean the part about "issue queue process in cartoon form". Definitely, one of the funniest sessions I've attended.

David_Rothstein’s picture

Status: Reviewed & tested by the community » Needs review

I don't mean to nitpick, but if we're going to add a new string to Drupal 7 I only want to do it once and not change it later, so here's the nitpick...

  1. Is this description accurate enough? The permission lets you do more than just combine filters into text formats; you can also grant roles access to use them. Would adding something like "and granting permission to use them" at the end be a good idea, or too much?
  2. The description does not check access before linking to admin/config/content/formats. This is pretty minor, but it's inconsistent given that all the other permissions defined in filter_permission() do that.

I also find this issue ironic given the history in #620446: Rewrite permission titles and descriptions - there used to be a description here before, but it was unceremoniously removed before Drupal 7 was released. One step forward, one step back, one step forward again, or something like that :)

In any case, this certainly makes sense to me, and it should be fine to add to Drupal 7. Per http://drupal.org/node/1527558 we should ideally do it early in a release cycle, but we're still probably far enough from the next Drupal 7 point release that it's OK to do now if we do it soon.

cachee’s picture

Assigned: Unassigned » cachee
Status: Needs review » Reviewed & tested by the community

The following test steps were performed:

1. access the permission page via admin/people/permissions#module-filter
2. Viewed the message to be updated.
Message before patch
3. Applied the patch
4. Viewed the message after the update.
Message after patch
5. Message is now the same as in D8
6. Patch worked as expected

cachee’s picture

Assigned: cachee » Unassigned
David_Rothstein’s picture

Status: Reviewed & tested by the community » Needs review

I still want to have a discussion about #17 before committing this to Drupal 7.... (Because I don't want to introduce a new string and then have to change it again later, breaking translations in the process.)

I'm aiming to get a core bug fix release out during the next release window (November 7), in which case at this point it's probably too late to commit new translatable strings intended for that release... However, we can definitely aim to get it committed right after that (so it goes into the following release).

David_Rothstein’s picture

Version: 7.x-dev » 8.x-dev

And I guess if we are going to discuss possible changes to this, it should be against Drupal 8 for starters.

amontero’s picture

Addressing David's comments in #17:

Is this description accurate enough? The permission lets you do more than just combine filters into text formats; you can also grant roles access to use them. Would adding something like "and granting permission to use them" at the end be a good idea, or too much?

Not needed IMO, it's verbose enough. Unless UX people says it is not :)

The description does not check access before linking to admin/config/content/formats. This is pretty minor, but it's inconsistent given that all the other permissions defined in filter_permission() do that.

Patch fixes it.

dawehner’s picture

Are you actually sure that you

+++ b/core/modules/filter/filter.moduleundefined
@@ -369,9 +369,10 @@ function filter_admin_format_title($format) {
 function filter_permission() {
+  $perm_text = user_access('administer filters') ? '<a href="@url">text formats</a>' : 'text formats';

It feels wrong to check access in an info hook,
as this maybe could cause issues in the future.

amontero’s picture

AFAIK, there is no problem here. I'm doing the access check the same than it's done a few lines below in the same function.

dawehner’s picture

Yeah sure, it does totally work because user_access never calls hook_permission but I just said it feels wrong,
as this for example would block hook_permission to be cached.

Other places in which there are links in permissions:

  • node_permission: no access check
  • system_permission: no access check
  • user_permission: no access check
Wim Leers’s picture

Issue summary: View changes
Status: Needs review » Needs work
Issue tags: +php-novice

Totally agreed with #25. Please reroll without the access check.

yoroy’s picture

As for the first question in #17, I don't think we need to add the part about assigning text formats to roles. The usability gain is in facilitating that discovery by providing a link to the relevant configuration page, we don't have to explain that up front.

davidsheart02’s picture

Issue summary: View changes
dandaman’s picture

I tried applying the #22 patch and then removing the access check. But then it's functionally the same as current Drupal 8.x-dev, is it not?

The rerolled version would be:

  $perm_text = user_access('administer filters') ? '<a href="@url">text formats</a>' : 'text formats';
  $perms['administer filters'] = array(
    'title' => t('Administer text formats and filters'),
    'description' => t('Define how text is handled by combining filters into ' . $perm_text . '.', array(
      '@url' => url('admin/config/content/formats'),
    )),
    'restrict access' => TRUE,
  );

While the module's current code is:

  $perms['administer filters'] = array(
    'title' => t('Administer text formats and filters'),
    'description' => t('Define how text is handled by combining filters into <a href="@url">text formats</a>.', array(
      '@url' => url('admin/config/content/formats'),
    )),
    'restrict access' => TRUE,
  );

It's definitely possible that I am misunderstanding what is desired to be done here.

David_Rothstein’s picture

If we're not changing the text then I think it's OK to put this back to Drupal 7. But the discussion of doing the permission checks should be split to a different issue (it's now inconsistent in multiple ways in Drupal 8).

For Drupal 7 we should definitely do the user_access() check to be consistent with the rest of the function, especially since we don't have the luxury of continually breaking these translations whenever we change our mind :)

-    'description' => t('Define how text is handled by combining filters into <a href="@url">text formats</a>.', array(
+    'description' => t('Define how text is handled by combining filters into ' . $perm_text . '.', array(

This is wrong though - we can't concatenate strings with variables like that or it won't be properly translatable. We should probably just have two different strings (one with the link and one without).

jackbravo’s picture

Ok. I created #2283717 to address the inconsistency in using user_access in hook_permission functions.

Moving this issue then to the backport to Drupal 7. There were already some patches for drupal 7 in the queue, maybe they still apply.

jackbravo’s picture

dcam’s picture

Status: Needs work » Reviewed & tested by the community

I'm not sure why the issue is stuck at Needs Work when #12 passed its last retest.

It's a minor change which is nearly identical to what went into D8. It looks good to me. The new text is appearing on the permissions page. It's RTBC from me.

Status: Reviewed & tested by the community » Needs work
dcam’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
592 bytes

I'm re-uploading #12. I am not the author and this should not be attributed to me. The issue won't stay RTBC because #22 gets re-tested when the status is set.

Status: Reviewed & tested by the community » Needs work
dcam’s picture

Status: Needs work » Needs review
dcam’s picture

Status: Needs review » Reviewed & tested by the community

Unrelated test failure. Still RTBC.

yoroy’s picture

And still a worthy little text tweak. RTBC indeed.

Status: Reviewed & tested by the community » Needs work

Status: Needs work » Needs review
dcam’s picture

Status: Needs review » Reviewed & tested by the community

...More random test failures.

Status: Reviewed & tested by the community » Needs work

jackbravo’s picture

Status: Needs review » Reviewed & tested by the community

This was already RTBC

David_Rothstein’s picture

Status: Reviewed & tested by the community » Needs work

This is still inconsistent with the user_access() check used elsewhere in the same function - see discussion above.

David_Rothstein’s picture

In other words, something like this?

David_Rothstein’s picture

With slightly better code style this time...

jackbravo’s picture

But didn't we just removed those checks in Drupal 8?

Should we removed them also from Drupal 7? Open another issue for that? Or just stick with what's already there?

David_Rothstein’s picture

Backporting #2283717: Remove user_access function calls on hook_permission functions to Drupal 7 is definitely a possibility (I will change the status of that issue).

That issue came to a resolution a fair amount faster than I thought it would, so doing one thing here and another thing there does seem a little backwards/conflicting now... however, there's still a good chance there will be a Drupal 7 point release in between the two, so I think we should keep the Filter module permissions self-consistent in the meantime (hence my patch). If the other issue winds up getting in also, it will have to undo a bit of what we do here, but not that big of a deal; better that we always have the code in a state that behaves consistently whenever we release it.

amontero’s picture

Status: Needs review » Postponed

Postponing until closure of above mentioned issue, hopefully soon, since it's reviewed OK.

David_Rothstein’s picture

Status: Postponed » Needs work

I just committed #2283717: Remove user_access function calls on hook_permission functions, so I guess that means this one goes back to... "Needs work"?

jackbravo’s picture

Status: Needs review » Needs work

Hi rpayanm

As discussed in #2283717: Remove user_access function calls on hook_permission functions, we shouldn't use user_access on hook_permission, so, to be consistent, you should remove that check from the patch and just link to the admin page.

joshi.rohit100’s picture

Status: Needs work » Needs review
FileSize
578 bytes
1.68 KB

Updated as per #54

jackbravo’s picture

Status: Needs review » Reviewed & tested by the community

Seems good =).

David_Rothstein’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: +7.37 release notes

Committed to 7.x - thanks!

  • David_Rothstein committed e091df1 on 7.x
    Issue #1684930 by amontero, David_Rothstein, joshi.rohit100, jthorson,...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.