User login

How to

Information on how to do something... anything.

Using Views DataSource and Feeds to pull content from one site to another... with multiple images

Disclaimer: This is a should-be-deprecated approach, both Views DataSource and Feeds can be replaced with better options, such as Services or RestWS to Rules and Rules XPath Parser. But this approach basically works now.

On the source site.

Making Views Datasource Output multiple values for an image

drush dl image_url_formatter
drush -y en image_url_formatter

Configure the View to use it for the desired image field ("Image URL" instead of "Image").

/admin/structure/views/view/yourview_xml/edit

Have menu local tasks (view, edit, etc. tabs) show menu item description as tooltip

Most menu items in Drupal 7 show a link tool-tip, or title, but local tasks (the tabs you are most used to seeing as the edit link tab on full node pages sadly do not follow this sensible pattern.

Until Drupal core is fixed so that menu item "description" is applied to title attribute of menu tab links", here is a fix for Drupal 7. Change this to your custom theme's name (replace 'example') and drop into your theme's template.php file:

Return user to current page: How to link to a form from a Drupal menu

Press login / press account links for anonymous and logged in users, respectively. Subtly added to a bottom menu. Via code in order to allow for the redirect back to the page you were on after login or editing.

There is surely a way, or should be a way, that does not involve hook_page_alter(), but hey, this works.

Create vocabulary and taxonomy terms in an installation profile

The first part is provided by the default installation profile:

Settings for sets of sites: Putting Drush configuration into your project repository

Inherit local-only options with 'parent'

Parent is not working across files. Filed support request: http://drupal.org/node/1262230

In an aliases file that lives with your project, so for our SDL project, sdl.aliases.drushrc.php, put in all settings that are true no matter who is using Drush and from where. This is the settings for an externally hosted development collaboration site.

Change the text of a tab, such as 'View', for one node type

<?php
/**
 * Implements hook_menu_alter().
 *
 * Use a title callback to replace the text shown on nodes' "View" tab.
 */
function example_menu_alter(&$items) {

How to create a Feature without the initial download through the UI

If you hate downloading and unzipping the initial feature you create as much as i do, because you haven't bothered with that foolishness since Drush, this post is for you.

This is the minimal information needed (from my experimentation) for Features to recognize your module as a Features module. Then you can add variables and other features through the UI (or Drush), and drush fu feature_example to update your module code (where feature_example is the name of your feature) and fu stands for features-update.

In feature_example.info:

Preprocess from a module: removing the content author from Drupal 7 search results

All, not just most, but all the content on a particular site was set to be posted without showing the by-line or submitted by text. Given this requirement, it makes no sense to have search results show the user that submitted the content, every time. This can be themed away in search-result.tpl.php or it can be removed with a pre-process function as shown below.

You can do this from a module or a theme, where 'example' is the system name of that module or theme:

Enhance your prompt with git information

Git provides a series of enhancements for the bash prompt. It can display the current branch when inside a working copy. Here's an example from my machine:
{syntaxhighlighter brush: bash; gutter: false}
stefan@debian:~/Documents/Projects/Drupal/test(master *)$
{/syntaxhighlighter}
It shows the branch name and indicates by an asterisk that I have uncommitted changes.

Syndicate content