Hi! My team is setting up a site that uses much of the amazing features of Display Suite. However, in order to support a quirk in how our client wants certain pages to display on phones, we need our mobile theme to change the order of several fields.

In this particular case, we have Display Suite set up to render the "Main Content" region of News articles in this order:
1) Image
2) Date
3) Title
4) Body

On mobile, we'd like Main Content to render in this order:
1) Date
2) Title
3) Image
4) Body

Is this possible? I've been digging around, but I haven't found anything that lets a theme hook into whatever Display Suite uses to decide which order to render fields in.

Thanks!

Files: 
CommentFileSizeAuthor
#6 1737020-ds-region_alter.patch1.87 KBpfrenssen

Comments

swentel’s picture

Status:Active» Fixed

Sadly enough not in the 1st branch - there is an alter hook in the second branch that will allow you to alter the setup just before it gets rendered. That's coding however. I can't backport that change as that is an extreme api change.

Not that the changing that order also only will work with caching in case the urls are different (eg. m.example.com vs example.com)

coredumperror’s picture

OK, so to get this kind of functionality, we'd need to upgrade to Display Suite 2.0?

Fortunately, we are using different URLs for mobile, precisely because of the caching issue.

swentel’s picture

Yes, but watch out, the upgrade path is not guaranteed on the theming level as there are many changes in templates etc. You'll have to resave a lot of displays and probably change css as well.

coredumperror’s picture

Thanks for the heads up. We're too close to release to consider making the change now, but we may do so in a later phase. I'm sure we can implement our layout in an alternative way, for now.

Status:Fixed» Closed (fixed)

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

pfrenssen’s picture

Version:7.x-1.5» 7.x-1.x-dev
Category:support» feature
Status:Closed (fixed)» Needs review
StatusFileSize
new1.87 KB

I needed this functionality too in the 1.x branch. I have not looked at how it is done in 2.x so this implementation is probably very different. Anyway it works well for my use case (changing the layout structure on specific pages) and it does not have any impact on existing functionality - it is just an additional alter hook.

I'm setting this to Needs Review, but I understand the reason this has been rejected before, and I suppose that new functionality is not being introduced in 1.x any more now that 2.x is stable. If this is not desirable then feel free to close the issue again.

swentel’s picture

Status:Needs review» Fixed

Hmm, this is a complete different approach then the original patch which would break less and still gives the ability, so looks fine to me. committed and pushed, thanks!

Status:Fixed» Closed (fixed)

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