Hi,

Using Features or using Views UI, I am trying to stage one of my views. It have one of its displays which more link option is overriden to always show a more link with custom text. It works well on my dev environment but when deploying this view to my staging server, the more link is activated but its options are resetted to default values.

I attach you the export of this view.
This bug was found in 3.3 and today's dev version.

Regards.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Status: Active » Needs review
FileSize
657 bytes

I'm a bit confused about this issue ...

There are two options here: use_more_always and use_more_text. The second one works pretty fine, if you change it, it gets added to the export.

The first one, though is kind of special, it's logic is changed on saving/loading.
Technical "use_more_always" works as "use_more_not_always", as having it checked runs a count query. There are some historical reasons for that.

So if you have checked it, it will not be exported, but if you have not checked it, it will be exported as TRUE.
Here is the problem.

If you force to always export this this value, it should work as expected ...

Before committing this i require some feedback.

Btw. thanks for the flattr!

tim.plunkett’s picture

Weeeeird. Makes some kind of sense though.

tim.plunkett’s picture

FileSize
1.26 KB

Instead of hardcoding an odd hack, why not provide another export method (that might actually be useful in other ways).

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Awesome, it's so much better...

tim.plunkett’s picture

FileSize
1.54 KB

If you didn't commit already, here's a mention of it in option_definition.

DuaelFr’s picture

Status: Reviewed & tested by the community » Needs work
FileSize
20.11 KB

Thank you for your quickness but it do not solve the problem.

On my local environment I updated views to 3.x-dev, applied #5 patch and rebuilt the feature
Then on my staging server I updated and patched views before reverting the feature

The options are found in the feature

  $handler->display->display_options['defaults']['use_more'] = FALSE;
  $handler->display->display_options['use_more'] = TRUE;
  $handler->display->display_options['use_more_always'] = TRUE;
  $handler->display->display_options['use_more_text'] = 'toutes les actualités';

but "use_more_always" and "use_more_text" are not set during the importation.

DuaelFr’s picture

Hi guys !

I just made some tests on an other project.
I tried to use Features to stage it, the export code looks great but nothing happens on the staging server.
I tried to user export/import's views interface, same thing.

It is really painful to manually change each display using this feature.

You two are really good people who knows Views in depth so, please, give it a look.
When Views will go in core, you won't like to find bugs like this one, certainly easy to fix but needing a complete core release to be deployed...

I can help on anything else but Views is really too complicated for me ;)
In advance, thank you.

cobian.h’s picture

Tried patch #5 on fresh Drupal install with only using views, views_ui, ctools, views content panes (all latest dev)
.. still not working :(

rudiedirkx’s picture

The issue is not the export, it's the import. The export has the right data for each display:

  $handler->display->display_options['defaults']['use_more'] = FALSE;
  $handler->display->display_options['use_more'] = TRUE;
  $handler->display->display_options['use_more_text'] = 'Meer Oneworld';

yet the import ignores the use_more_text. (The use_more flag is imported correctly though.)

New export (of that wrongly imported view):

$handler->display->display_options['defaults']['use_more'] = FALSE;
$handler->display->display_options['use_more'] = TRUE;

Where the text at?

ericclaeren’s picture

Same problem, a view export or feature is not imported correctly.

DuaelFr’s picture

Priority: Normal » Major

I am willing to pay for this !
Feel free to contact me...

jojonaloha’s picture

Having same issue here, mainly with the use_more_text option. Haven't reviewed the code yet to see if I can help contribute to a patch, but some things I've noticed.

When I export the view using features, the export put the use_more_text option on that display (which I would expect since I clicked "Apply (this display)"), but when I revert the feature/view locally or on the staging server the text is "more" instead of my custom text. When I export the view using the Views UI the use_more_text is on the Master display, and reverting that view after copying the change to the feature works fine.

Here is a diff to illustrate what I mean:

   /* Display: Master */
   $handler = $view->new_display('default', 'Master', 'default');
+  $handler->display->display_options['use_more_text'] = 'All Movie Reviews';
   $handler->display->display_options['link_display'] = 'custom_url';
   $handler->display->display_options['access']['type'] = 'perm';
   $handler->display->display_options['cache']['type'] = 'none';
@@ -3932,7 +3933,6 @@ function my_feature_views_default_views() {
   $handler->display->display_options['title'] = 'Movie Reviews';
   $handler->display->display_options['defaults']['use_more'] = FALSE;
   $handler->display->display_options['use_more'] = TRUE;
-  $handler->display->display_options['use_more_text'] = 'All Movie Reviews';
   $handler->display->display_options['link_url'] = 'news/movie-reviews';
   $handler->display->display_options['allow']['use_pager'] = 'use_pager';
   $handler->display->display_options['allow']['items_per_page'] = 'items_per_page';
dawehner’s picture

Status: Needs work » Needs review
FileSize
2.02 KB

Just made a bit of a progress after some research:

  • The general problem is that if you have exported the options it is not marked as overridden.
  • The reason for that kind of behavior is that views itself had to be told that something is overridden, by setting the 'defaults']['foo' = FALSE key
  • By expanding some lines in defaultable_sections you can actually force to add this keys to the export.

This patch contains the changes from #5 for a better export of use_more_always and the changes in this comment.

DuaelFr’s picture

Ladies an gentlemen!
THIS IS SPARTA RTBC !!
Champagne!

dawehner’s picture

Thanks!

Just to mention you have to reexport your views to make this working.

DuaelFr’s picture

(detailed) Bug Driven Test :

- installed Views 3.x
- created a view with a display block using a more link and not using default
- exported in a feature
- deployed on a staging server
--> more link is not imported (bug confirmed)

- patched Views with #13
- exported the view again
- deployed on the staging server
--> more link is well imported ! Cheers !

Thank you again Daniel

dawehner’s picture

Version: 7.x-3.x-dev » 8.x-3.x-dev
Status: Needs review » Patch (to be ported)

It works for DualFR so lets get it in. Thanks for the testing!

Committed to 7.x-3.x, though this patch doesn't apply clean to 8.x-3.x

tim.plunkett’s picture

Status: Patch (to be ported) » Needs review
FileSize
2.11 KB

Ported.

aspilicious’s picture

Status: Needs review » Reviewed & tested by the community

same

dawehner’s picture

Status: Reviewed & tested by the community » Fixed

This is also in!

Status: Fixed » Closed (fixed)

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