Problem/Motivation
The exposed filter on the Custom block library page (/admin/structure/block/block-content) has 'Apply' text. Similar pages (/admin/content, /admin/content/files, /admin/people) use 'Filter' for the same function.
Proposed resolution
Modify all views to use 'Filter' as a default text for the exposed filter button to get a uniform naming throughout core. Also update the default for new Views to 'Filter'.
Remaining tasks
- Make a patch
- Create of modify tests
User interface changes
Change of button text to improve UX.
API changes
none
Data model changes
none
Note: We don't touch any existing view to reduce any kind of risk.
Comments
Comment #2
cilefen commentedComment #3
larowlanThis won't change installed sites. Can we live with that?
Comment #5
dawehnerI think we should not touch existing sites, maybe besides the core views like
/admin/content?Comment #6
ifrikI would prefer a more generic solution than renaming individual the label for the button in individual views, and change the label of that button in general.
Whenever a user adds one or several exposed filter to a view, the fields are displayed with their labels and a general button "Apply" which basically stands short for "Apply this filter" - but nobody does it say that the fields above it are filter options.
It gets even more confusing when there are other buttons or fields around it, such as primary actions or bulk operations. (As on the Custom Block Library page, bur for example also at the admin page for the Media module.)
So, can we just _by default_ label the button that is placed with exposed filter "Filter"? That would solve the issue both for views provided by core, as well as for any other view build by a user or provided by a module.
Comment #7
gábor hojtsyViewsExposedForm.php also has:
I think the rationale behind 'Apply' is that changing the filters may in fact result in a bigger result set and therefore not "filter" the results you are seeing but expand them (if more restrictive filters were applied earlier). So 'Apply' makes more sense in a general way. However it causes problems when there is also operations, which are also 'Applied' as in:
So sounds like using 'Filter' generally is better given the typical combination with bulk operations being confusing otherwise.
I agree it would be nice to apply (see what I did there :) this change to the default settings for exposed filters.
Comment #8
ifrikFollowing a short discussion on IRC:
There can be indeed cases where the "exposed filter" actually expands the results, or where - technically speaking - the user does not filter the results any further, but replaces one filter with another (for example switching from only published to only unpublished content).
In general language use, even this "un-filtering" or switching filters would work with "filter" as a label, and it would more clearly distinguish the function of this button from the bulk operations button (Apply/Apply to selected items).
In the rarer cases where "Filter" is not be appropriate, it's still possible to change the label.
Comment #9
yesct commentedComment #10
dawehnerI am all in favour of changing the default value of this to be "Filter" instead of "Apply". For other existing views out there though I would argue, that we should just change it for the examples in the admin UI for ourself, so
/admin/content/admin/people...So:
\Drupal\views\Plugin\views\exposed_form\ExposedFormPluginBase::defineOptions\Drupal\views\Form\ViewsExposedForm::buildFormComment #11
michaellenahan commentedHello everyone, I've had a go at doing a patch for this.
Comment #13
larowlanThanks @michaellenahan - nice work.
Should we instead be checking
=== 'Apply'?Should we be using t() here (I have no idea)?
This just needs corresponding changes in the
Drupal\views\Tests\Plugin\ExposedFormTesttest class.Comment #14
dawehnerNote: This should be a post_update function, see
views.post_update.php, see https://www.drupal.org/node/2563673I agree with lendude, we should just change the value, when the default wasn't changed, actually, its a tough decision, due to sites with translations. This is a user facing string, maybe it would be better to not change it at all, but rather let just new sites get it.
Comment #15
michaellenahan commentedThanks for your reviews, @larowlan and @dawehner.
I forgot about the test class, I've made the changes there now.
OK, I have left out the update function now.
Although, can I ask what the implications of changing "Apply" to "Filter" on a translated site would actually be? On a French site the buttons will say "Filtrer" so that should be fine.
Ahh. I wonder if this is what the problem is: in cases where someone has already *manually* translated the string "Apply" on their own site, they will get "Filter" (or their language version of "Filter"), and their manual string translation work will be blown away.
Comment #16
gábor hojtsyAre we not changing existing views anymore? Are all of them using the new wording so we only need to update the PHP generating new views?
Comment #17
dawehner@Gábor Hojtsy
My thought process is written in #14. Any opinion about it?
Comment #18
gábor hojtsy@dawehner: if it is in views yml files too then new sites will not get it either since the patch does not change those. New sites will only get it for new views (much as old sites will get it for new views too). Is this what you are referring to?
Comment #19
dawehnerRight, but let's be clear, these strings, on sites with translations for example, could suddenly appear in english.
Comment #20
michaellenahan commentedComment #21
gábor hojtsy@dawehner:
Ok maybe I was not clear. I meant the prior version of the patch which also changed shipped default views. Changing those should not change existing site views. It would change their translatability a bit (given #2428045: Comparing active storage to install storage is problematic, install storage may change anytime) but we cannot do much about that.
Comment #22
dawehnerRight, so you argue to change the views located in
node/optional<code> like <code>views.view.content.ymlfor example?Comment #23
gábor hojtsy@daweher: yes, if we don't change those default views then new sites will not get the improvement for their installed views, only for their admin-created views.
Comment #24
dawehnerAnd well, I don't have much a problem with that. If we want, we could write an update path for just those views in the admin area. Keep in mind that there might be a lot of views on the actual site out there, which better don't be touched, IMHO.
Comment #26
michaellenahan commentedHi, I want to be sure that I'm on the right track here.
We need a patch which changes all the views.view.*.yml files in core, changing exposed_form.options.submit_button from Apply to Filter.
Is that correct? This patch does that (77 changes, including the test yml files.)
In addition, the patch changes the wording from "Apply" to "Filter" in:
core/modules/views/src/Form/ViewsExposedForm.php
core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginBase.php
core/modules/views/src/Tests/Plugin/ExposedFormTest.php
To make it easier to review, I have attached these small changes as exposed_filter_button-2561115-26.patch-non-yml-file-changes.txt
What I haven't done in this patch is any update path. I'm not sure how to only include those files which are in the admin area. What we have so far is this:
EDIT - changed to post_update as per #14
Comment #27
michaellenahan commentedComment #28
michaellenahan commentedComment #30
michaellenahan commentedDon't know why I am getting a test failure. Locally it works fine. I've attached output from my local pc.
Comment #31
michaellenahan commentedComment #33
michaellenahan commentedWorked out why the test is failing. Facepalm. There was a further test method in the class where I forgot to change "Apply" to "Filter".
Comment #34
michaellenahan commentedComment #35
michaellenahan commentedThis patch is #33 plus the upgrade path (see interdiff for the upgrade path alone).
For the upgrade path, I have targeted core views which have a path beginning with 'admin/'.
On the current codebase, the only view that was changed in this upgrade was 'views.view.block_content'.
Comment #36
ifrikComment #37
dawehnerThat seems to be an okay condition to deal with. Note: We could strpos($path, 'admin/') == 0, IMHO easier to read.
We could move this view->save() one level up, so we just save views once, when there are multiple displays.
Comment #38
ifrikThis patch works as intended: For new custom views, the button for exposed filters is labeled "Filter", and the existing button on the Custom block library page is also renamed to "Filter".
Dawehner, should this issue be set to "Needs work", or can it be RTBCed?
Comment #39
ifrikComment #40
dawehnerYeah adapting the second point would be great!
Comment #41
lendudeOk so lets add the feedback from #37. Added some comments to the update function.
Comment #42
dawehnerThank you @lendude
Comment #43
xjmI think "Filter" is okay as a new default, but I'm not sure if we should include the upgrade path. As a general principle, sites own their configuration. The site owner could specifically want the text to be "Apply".
I pinged @alexpott for a second opinion.
Comment #44
xjmComment #45
cilefen commentedThe #41 patch is more ambitious than what is described in the issue summary. Can we get an update please?
Comment #46
dawehnerPersonally I'd like to move this discussion into a follow up and decide that there and provide an potential update path there. Personally I don't care much about those existing sites. IMHO the site owners would have fixed it already, if they cared.
Comment #47
alexpott@dawehner, @xjm. Yep the upgrade debate is secondary. I don't think we should be changing existing sites here - let's file a followup for that.
Comment #48
amit.drupal commentedI am Trying to review patch #41 but i am not able to display any changes after apply patch.
Comment #49
dawehner@amit.drupal
Did you executed update.php? Did you reinstalled Drupal form scratch?
Comment #50
amit.drupal commented@dawehner
Step For Review Patch
1 - Installed Drupal form scratch
2 - Take screenshot pages [/admin/structure/block/block-content, /admin/content, /admin/content/files, /admin/people ) .
3 - Apply Patch #41
4 - Run update.php and clean cache
5 - Again test all listed pages.
But there is no change .
Comment #51
lendudeHere is the patch without the update path.
@dawehner has opened the follow up #2831017: Potential update path for changing exposed filter button text to 'Filter'
I updated the issue summary as requested by @cilefen to indicate we are updating more then just one label on one View.
Comment #52
lomasr commentedHi,
I applied the patch. It worked cleanly. Since its without update path, I cleared the cache, but can't see the text change. Please let me know if I am missing any step.
Comment #53
lendude@lomasr without the update path, this will only take effect for new Views. Existing Views will need to be updated manually.
Comment #54
lomasr commented@Lendude, Thanks I will test with new Views.
Comment #55
lomasr commentedHi ,
I created a new Views , but still I can't see the text change.
Thanks
Comment #56
dawehnerI updated the issue summary to make this clear ...
Comment #57
lendude@lomasr Apply patch, clear cache, create new View. Works for me.....
Comment #58
lomasr commentedHi, Thanks it worked for me too. Previously I created new page in an existing View. Now I have created a new View . Sorry about the confusion.
Thanks
Comment #59
oriol_e9gGo with this!
Comment #61
lendudeunrelated fail
Comment #62
alexpottThere are some missing (maybe new) test views. Uploading a patch just to ensure fixing them does not break tests.
Comment #63
xjmComment #65
xjmComment #66
alexpottCommitted ce7cf17 and pushed to 8.3.x. Thanks!
Comment #69
ifrikWe overlooked that the button is not only used for exposed filters, but also for exposed sort criteria. They are both in the same form, so it looks like we've created a new UI problem.

That's why the original "Apply" made sense as the default option: it works for both.
Comment #70
yoroy commentedWe should roll back this change then. The label mismatch this patch introduced for exposed filters outweighs the win of more consistent labelling for the "filter" use case.
Comment #71
gábor hojtsyLet's get committer attention on this.
Comment #72
alexpottThis will need a patch because I'm pretty sure patches have gone in since using the word "Filter" in a test to click on a button. I'm sure because I broke HEAD because of this.
Comment #73
alexpottHere's a patch that does the revert - let's see of something fails.
Comment #75
alexpottYep I knew we would have a fail :) yay for breaking HEAD before.
Comment #76
catchPutting this in the RTBC queue, but need to wait for tests to run.
Comment #79
catchCommitted/pushed to 8.4.x and cherry-picked to 8.3.x. Thanks!
I'm going to mark this as 'fixed', because we fixed the regression. We could try to change 'apply' to something else, but that should probably happen in a new issue linking back to this one.
Comment #80
ifrikThanks a lot.