User login

Drupal

Capturing Menu Block configuration in code with hook_menu_block_blocks()

<?php
/**
 * Implements hook_menu_block_blocks().
 */
function feature_about_menu_block_blocks() {

Adding non-menu things to primary links menu items with Drupal 7's page alter hook

The request was to stick search in a menu. I said "I bet that's easy with hook_page_alter()!"

Not quite.

The primary links menu is output directly by the theme, and so is one of the very very few things that occurs after hook_page_alter().

You can tell the theme to stop outputting it directly, and put it in a block that is displayed in a region, or you can add it to the page rendering array in code with hook_page_build().

Making DraggableViews work for Files (and any Entity) Not Just Nodes

If you make a Files view a draggable view, with an integer field and using the FieldAPI handler, everything looks great except for this error:

Undefined property stdClass::$nid in draggableviews_handler_fieldapi->get() draggableviews_handler_fieldapi.inc

and the fact that it doesn't work at all.

Theming with Display Suite and Preprocess Functions

Display Suite does not use node-*.tpl.php. This would is be by design. There are three ways i see to bring in custom elements.

Custom fields

Typical usage for custom elements would seem to be creating entire custom 'fields' (as opposed to small variables) which can then be placed by Display Suite-- as shown in the first part of this post:

A series of updates, ever lates Views dev, causes a Class 'views_handler_field_entity' not found fatal error

The update sequence below - even with a ridiculous amount of cache clears - cannot run over the new Views-3.x-dev code. (Error at bottom.) However i did confirm that registry_rebuild() in a bootstrapped test.php can restore the site at least.

The solution in this place is just to do a deployment, which is due anyway, before beginning on the Continuum branch - the first two updates, anyhow, run fine on the more stable release candidate 1 Views, and then when the code is updated the final update also runs fine. I don't like it but there's nothing blocking about this.

Media styles workaround (extremely fragmented notes)

Summary of What's Working

<?php
/**
 * Define additional view modes for Media formatting.
 */
function feature_media_configuration_entity_info_alter(&$entity_info) {
  // Based on RobW's code: http://drupal.org/node/1026790#comment-4667062
  // Media module only recognizes view modes with the prefix media_.
 
  // View mode for mobile slideshow images

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) {
Syndicate content