README.txt 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. Using Views Boxes
  2. --------------------------------------
  3. I. Basic use:
  4. --------------------------------------
  5. * Enter a couple of article nodes (just set the titles for now).
  6. * Make sure you have Views UI enabled and then create a new view
  7. (called list_articles) with a block display that returns the titles
  8. of your published articles.
  9. * Go back to your test page and reclick 'Configure Layout'.
  10. * Select Boxes in the editor's dropdown, and then drag and drop
  11. 'Add custom view box' into a region.
  12. * You'll be prompted to set the box's description (which is used
  13. for admin UI purposes) and its title (which is actually rendered
  14. and shown to end users). Set the title to <none> and the description
  15. to 'Views Box - Articles' and then click Continue.
  16. * The 'View' dropdown shown then allows you to pick the block display
  17. you want this box instance to use. For now, we just have list_articles
  18. which doesn't have any exposed or contextual filters, so we can go
  19. ahead and save our settings.
  20. * You'll now see your list of articles.
  21. II. Exposed and contextual filters:
  22. --------------------------------------
  23. Views Boxes ships with some filters that are particularly useful for
  24. allowing extra levels of control over your view while still storing
  25. the configuration data in the box itself. We're going to cover the ability
  26. to curate this list_articles so that we can manually sort the article nodes
  27. through the box. For this, we're going to install the Views Arguments Extras
  28. module as it provides some filters that we'll need.
  29. * Go edit the list_articles view.
  30. * Add a contextual filter and select 'Content: Nid'. Before you save it,
  31. scroll down and open up the 'More' options.
  32. * The administrative title can be used for two purposes: displaying what it
  33. is that we'll be selecting (Article nodes) to the admin when using the box,
  34. and to limit the autocomplete fields we'll have to specific entities and
  35. bundles. By default the autocomplete field will display all nodes, but if
  36. we want to restrict it to articles, we'd enter:
  37. Article nodes [node] {bundles:article} here
  38. [ENTITY_TYPE] will tell the autocomplete which entity type to look up
  39. {bundles:COMMASEPERATEDLISTOFBUNDLES} will limit the auto complete by bundle
  40. * Check the 'Allow multiple values' option and save your changes.
  41. * Add a sort criteria and select 'Arguments: Multi-item Argument Order'.
  42. This insures that we're actually sorting using the nodes we'll be selecting
  43. through the contextual filter in the box. Make sure that this sort criteria
  44. comes before the existing 'Content: Post date' and it's set to
  45. 'sort descending'. Save your changes to the view and go back to your page
  46. node with the list_articles view block.
  47. * Edit the box by clicking the gear icon that appears when you hover over it
  48. and then selecting 'Edit Box'. Notice that you don't necessarily need to be
  49. in Context Editor mode to edit existing boxes.
  50. * You'll notice that you now get 'Article Nodes' under settings for the box,
  51. which allows you to pick article nodes using the autocomplete fields and to
  52. order them as you'd like. Once you're done with this, save the changes and
  53. you'll get your manually reordered list.
  54. * You can reuse the same box instance or another page if you want to keep the
  55. same ordered list, but you can also create a new custom view box that reuses
  56. the same view display but with a different selection of nodes. This allows
  57. for a pretty powerful way to make views configurable through the box interface
  58. while still keeping the benefits of reusing the same displays (templates
  59. for examples). Other filters can be exposed too and used through the box
  60. interface, and having a view box filter on a specific taxonomy term can be
  61. achieved in a similar manner.
  62. Documentation written by tirdadc - http://drupal.org/user/383630