All Suggestions

  • 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

    Clean URLs

    Book element

  • Caution
  • If your server can work with Clean URLs, Drupal configures itself to use them during a normal install. If it doesn't though, you'll have to make these changes on the server and then make this configuration change manually.

  • Explanation

  • Drupal takes care of this itself, but we need a warning for when it doesn't.
  • Benjamin Melançon's picture

    Form item classes

    Tags

  • forms
  • Book element

  • Note
  • Drupal 7 much improves the classes added to the div surrounding form items (in Drupal 6 it was hard-coded to 'form-item'). The type of form element and the form element name are now added as form-item-type and form-item-name. You can see how Drupal does this (and see the theme function you would override to change this) at api.drupal.org/theme_form_element.

  • Explanation

  • This inability to control form element divs is a frustration from Drupal 6, mitigated in 7, and could go in a module building, form altering, or theming section.
  • Benjamin Melançon's picture

    Add a Resource content type

    Book element

  • How to
  • http://definitivedrupal.org/admin/structure/types/add
    Give it a name, Resource. The machine name is just fine as it is, resource. Give it a description, A reference page or other resource for the Definitive Guide to Drupal 7. Connects to a book chapter.

    Set the default publishing options to published and create new revision.

    There's no reason to have any menus available on Menu settings, we'll be making links to these resources from their respective chapters.

  • Explanation

  • Incomplete. Needs nodereference to book chapter, some clever theming.
  • Benjamin Melançon's picture

    Action links

    Book element

  • New
  • Action links are new to Drupal 7. An $action_links variable is added to page template. They're local tasks that perform actions, rather than take you to listing pages. Rather than being rendered as tabs by default, they are rendered as links directly below the help (if any) for that page.

    They are a new "interaction pattern" that is very cool. "If you're on the content overview page, there's a good chance you want to add new content."

    See chapter {ux} for more.

  • Explanation

  • This should go where we add a node/add/suggestion link to the suggestion page.
  • Benjamin Melançon's picture

    Make your own test.php file

    Book element

  • Tip
  • Chx tip via Chad Phillips (hunmonk) at DrupalCon Boston 2008 (updated to Drupal 7).

    Make your own test scripts.

    Require the first three lines of index.php, and you have a fully bootstrapped Drupal.

    Make a file called test.php or anything you like and keep that in the same folder as index.php.

    Here is an example that prints out all the configuration information available to Drupal:

  • Benjamin Melançon's picture

    Comment notify

    Book element

  • Module
  • Comment notify lets your site visitors – signed-in and anonymous – ask to receive e-mail notifications about subsequent comments while they are leaving a comment themselves.

    This module has been suggested to and used by Dries, and is being considered for inclusion in Drupal core. That's always a good sign.

    Download and install:

    Command line steps
    drush dl comment_notify
    drush en comment_notify

    Comment notify requires the core Token module, which, if it has not been enabled, we will be prompted to enable.

  • Benjamin Melançon's picture

    Global redirect

    Book element

  • Module
  • http://drupal.org/project/globalredirect

    drush dl globalredirect

    Global redirect makes sure that when people visit a page on your site, they see your latest beautiful alias, not the Drupalish internal path or your second-to-last alias.

    For instance, even if someone links to node/23 directly, they will be redirected to the aliased version, point/official-release-drupal-2-0

    (Go to the module's project page for a 7 step description.)

  • Explanation

  • TAMFT
  • Benjamin Melançon's picture

    Form element titles and the invisible #title_display property

    Book element

  • How to
  • Note: Forms are made to look how they are at two layers, the Forms API and the theme layer.

    [Words below are mostly Everett's verbatim]

    Drupal 7 provides a #title_display property that can be used with any form element that supports the #title property. The #title_display property tells the form system how to render #title

  • Explanation

  • In the intro to module development i guess...
  • Benjamin Melançon's picture

    Fewer modules is better

    Book element

  • Concept
  • The Drupal community likes to brag about the thousands of contributed modules, but there's a little secret that should be publicly and widely stated: If you install 1,000 modules on your site, your doing it so wrong you'll probably need a complete Drupalectomy.

  • Explanation

  • There's A Module For That introduction.
  • Benjamin Melançon's picture

    Read the Code

    Tags

  • learning
  • Book element

  • Concept
  • Look at the code.

    Read the tests.

    The community wrote the code because they love you. They wrote the documentation to prove it.

    It's all right to google first. It may be a good idea to pick a standard practice, code first or web search first.

  • Explanation

  • This is for the Participation chapter. Or...? Inspired by / adapted from http://railstips.org/blog/archives/2010/10/14/stop-googling/ @TODO incorporate more from http://www.skorks.com/2010/05/why-i-love-reading-other-peoples-code-and-you-should-too/
  • 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

    Don't bug IRC unless you are going to stick around

    Book element

  • Tip
  • It is best not to ask a question in IRC unless we know we can be in there for the next hour at least. For one, responses and help and working it out from various people may take that long. Even if the answer is two words of brilliance, our unknown savior with just the right knowledge may only check into IRC an hour or more after we post, and answer then. It's dispiriting to our would-be helpers and rude of us to no longer be in the room when they check in, and many people read the backscroll of their IRC sessions every once in a while, rather than monitor it constantly.

  • Benjamin Melançon's picture

    Add link to Performance page for easy access to clearing cache

    Book element

  • Tip
  • When something in Drupal does not seem right, the first step is to clear caches. The Clear cache button lives on the Performance page. In the absence of development-helping modules such as admin_menu or devel that can provide one-click access to clearing the cache, we can add the Performance page to our Shortcuts bar for easy-access to the cache-clearing button. This is a solution right in Drupal core slightly easier than memorizing the path admin/config/development/performance.

  • Benjamin Melançon's picture

    Getting Vim

    Book element

  • How to
  • Vim for windows can be installed as part of Cygwin or standalone, http://www.vim.org/download.php#pc. A graphical version for Mac is available, http://code.google.com/p/macvim/. For Linux, graphical vim (gvim) is available through our operating system's package manager, such as Ubuntu's Software Center.

  • Explanation

  • To be referenced from page 3ish of Intro to Module Development. Probably belongs in the Development Environment chapter.
  • Benjamin Melançon's picture

    Growing pains, but never seen a community so strong and so caring

    Tags

  • community
  • Book element

  • Quotation
  • I’ve seen companies second guess whether they should release code back to the community because something they’ve created had been used by a competing company or even on a competing product. I’ve seen companies contributing code that contained spyware which has caused uproars and splitting of loyalties within the community. I’ve seen developers lose their jobs because the corporation they worked for did not understand the typical Drupal developer’s need to give back to the community.

  • Explanation

  • This belongs somewhere. Not sure about the Preface, not sure about Contributing to the community, but somewhere. Maybe Participating in the community?

Pages