Active
Project:
Patterns
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
5 Mar 2009 at 21:03 UTC
Updated:
17 Mar 2010 at 06:33 UTC
Jump to comment: Most recent file
Hi, folks.
I was hoping you might be able to provide an example of configuring views in a pattern. What I've got so far adds a view, but doesn't configure any displays for it. I'm sure there's something simple I'm missing. Here's what I've got so far (an attempt to configure the default display):
<view>
<details>
<name>myview</name>
<description>A view for my nodes</description>
<base_table>node</base_table>
</details>
<display>
<title>My View</title>
<sorts>
<timestamp>
<order>DESC</order>
<granularity>second</granularity>
<id>created</id>
<table>node</table>
<field>created</field>
</timestamp>
</sorts>
</display>
</view>
Thanks!
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | views_ui.inc_.txt | 2.89 KB | dman |
Comments
Comment #1
vaish commentedUnfortunately, it may not be that simple :)
This is some basic example. It will create a page display and assign it a path. Sarva is working on filling in the blanks. You may expect more details soon.
Comment #2
ntt commentedsubscribing
Comment #3
michaek commentedThanks so much, Vaish. I'll let you know how it works for us!
Comment #4
sheena_d commentedsubscribing.
Comment #5
wayout commentedHi,
I am using the following example to create my first View Pattern, however I cannot figure out how to insert Fields into the view, can you help me out?
I'm have tried something like this:
Example View:
Comment #6
luckysmack commentedhave you considered the ability to be able to use a views export text? this way you can just make a view, export it, and paste the resulting code into the pattern.
Comment #7
ChrisBryant commented@bigmack, we have considered and written code so that direct views exports can be pasted into Patterns. Vaish or Sarva will have to review and comment on the current state of that in the code.
If it's not in the the current release it should be pretty easy to add back in.
Comment #8
luckysmack commentedAwesome, slighly off topic but related: is there similar functionality for export text from cck fields, imagecache presets, panels, and so on? Well I can see panels might take quite a bit loger to be supported but curious if its something on the egenda in the future. Are there any docs stating what export code from various modules are supported?
Comment #9
dman commentedHere's a component I use to do this. Placed under /patterns/components/views_ui.inc
I can then define an 'action' like so:
(I use php, not XML or YAML for my patterns - because they contain logic)
and
205-views_newsletters.view.incis a direct views export defintion dump.The same action can be invoked via XML or YAML by just making up something with tag='views_import'
Alternatively, you can just paste the raw view code directly into the view='' space. I don't because unescaping code is a bore.
Comment #10
vaish commentedComponent for importing views export dump has just been committed. Thanks to dman for inspiration to keep it as a separate inc file as well as for adding "filename" option.
@dman: you may be interested to check out views import component I committed and compare it to yours from #9. I'll be happy to answer your questions if you have any.
Comment #11
dman commentedUsing the CRUD or PHP objects/structures that other modules - panels, views - use is definately a win compared to spending so much effort to emulate it in a new language!
Plus it's 4x more likely that you'll be able to upgrade between versions!
Laziness is a virtue!
I'll have a look at the latest version next time I'm rolling some patterns. The ones we've been using are pretty stable right now, so don't wanna break them. But if you are looking at panels ... this works there too!
Comment #12
vaish commentedThat's absolutely true but such objects/structures are not always available. Also how do you use view import code to update existing view - for example changing the number of items per page, adding a new field or filter or changing sort criteria?
That was a reason why our original intention was to implement components for full Drupal core and as many modules as possible. However, those components proved to be very difficult to maintain so we are shifting our focus more towards native module's exportable structures and "form" action wherever such structures are not available.
Yes, panels support is on my todo list but I'm not sure when I'll get to it.