Gotcha

Building Dynamic Views -- Need Relationship before Contectual Filder

Book element

  • Gotcha
  • On page 71 there is a section, "Define What Type of Content You Want to Display"

    It says to "Select User from the Filter select box and select the User:Name filter from the list" This option is not available until you define a relationship first relating (& requiring) an author relationship to the content.

  • Jinjyaa's picture

    Views Exporter MIA

    Book element

  • Gotcha
  • Reading Chap 3, I was very excited to try out this Views Exporter... But it didn't install, with Views. I may have an odd installation (I started out with the Drupal Commerce Kickstart, before I acquired this book), but I tried downloading the Views module and installing it again. No dice. There are only two modules under Modules | Views - Views and Views UI, no Views Exporter.

    Any ideas?

  • Problem adding User:Name to view filter

    Tags

  • Views
  • Book element

  • Gotcha
  • In the example in chapter 3 on page 71, creating a view of articles by a specific author, it is said to add a filter for User: Name. I was not given this option until I added a relationship to Content: Author. Did I miss that part, is this a recent development, or is it wrong in the book?

  • Explanation

  • Unless this is unique to my experience, this fix might save some headaches for others.
  • Benjamin Melançon's picture

    To see others' unpublished posts, "Bypass content access...

    Book element

  • Gotcha
  • "Bypass content access control" really means let users in a role with that permission view unpublished content (and edit and delete any content, unfortunately). Administer content does not grant this power to see unpublished content nor to edit and delete any content. In Drupal 7 this permission seems to do little more than what the separate "Access the content overview" page does.

  • Explanation

  • Ran into this gotcha after the book was published, unfortunately. Needs to be featured decently on the configurator chapters' pages.
  • Benjamin Melançon's picture

    Renderable arrays versus strings

    Tags

  • Render API
  • Book element

  • Gotcha
  • Drupal 7 would like you to provide all content meant for display to the user as renderable arrays (which allows changes from other parts of Drupal and potentially smart caching). It does, however, accept a plain string, and outputs that directly, and indeed Drupal core often does this.

    To mix simple strings with proper render arrays, simply use '#markup' => $raw_html; for your string

    (thanks to davereid and chx in IRC for pointing this out)

  • Explanation

  • module dev chapter
  • Benjamin Melançon's picture

    Internal link paths

    Book element

  • Gotcha
  • When making a link in HTML, you want to start it with a / to denote that the path is relative to the root of the site. This way, a link to the contact page at /contact works whether we are on the home page or on a deeply/nested/page.

    When putting an internal link for a menu item or anywhere else in Drupal, however, we leave off the starting slash and it is provided for us.

  • Benjamin Melançon's picture

    If declaring a custom region or feature in a theme, all defaults...

    Tags

  • unfinished
  • Book element

  • Gotcha
  • If a theme uses only default regions or feature settings, it does not need to define them in its .info file. If even one additional region is used, it must define all regions, the default ones it wants to keep and the new ones. The same holds for features. This is true for subthemes, also: If our parent theme uses only the default regions, and so doesn't define any, and so our copy of its .info file doesn't define any, we'll lose all the default regions the moment we define a region ourselves.

  • Explanation

  • #drupal-themes 18:33 rfay: Aren't a theme's regions always supposed to be in the .info file? Why does garland not have them? 18:36 stephthegeek: rfay, if it only has the default regions (header, footer, left, right), it doesn't need to declare them 18:36 rfay: stephthegeek, thanks. The only problem is when you add one to a subtheme :-) 18:37 rfay: Then it all blows sky-high 18:37 stephthegeek: rfay, yeah you need to list them all then 18:37 stephthegeek: you can't just add to it 18:37 stephthegeek: theme settings are the same way 18:37 rfay: stephthegeek, but theme settings are always listed in the parent's .info, true? So you can just copy them. 18:38 stephthegeek: rfay, no, i think they're the same way.. 18:38 stephthegeek: if you have the usual (primary, secondary, logo, etc) defaults you don't have to declare them 18:38 stephthegeek: just if you want to have one less or custom ones :) 18:38 rfay: stephthegeek, thanks for the warning :-)
  • Benjamin Melançon's picture

    If a style that is incompatible with a row style is applied, that...

    Book element

  • Gotcha
  • If we have a view using Row style: Fields for its Default display and Page display (for instance), and using the Style: Table with that, and we want to create a Page display with teasers instead, we find that the Row style setting is gone. We need to override the Style: Table first, and then Row style becomes visible and configurable again, and we can override it, and change it to Node. Now we can finally choose to show teasers.

  • Subscribe to Gotcha