University of Oregon

Updating select lists in bulk – w/ jquery, drupal

So I wrote this script 1 year and 1/2 ago about bulk label operations (Drupal 7 CCK – Creating ‘Label Bulk Operations’). Well the updateLabels() function from that code came in handy today.
I needed to update dozens of CCK formats from various defaults to editable. If you’ve used editable fields you know it can come in handy but if you have a lot of fields you’ll be in a carpel tunnel conundrum if you try to change then all.
So I pulled up the updateLabels() function opened the Firebug console and set all the various defaults to editable. And then back again. (more…)

Drupal: update Book's "Add child page" links to include all allowed book types

I’ve revisited adding child book pages and the convenient links that reside on the would-be parent page, originally addressed here: Drupal: Add links to other book types.

Now I’m looking at book_allowed_types to get a list of types that can be used as well as the user’s permissions to add those node types.

Last month I couldn’t get the code to work as an override from the template file so the code lives in a block that’s positioned below the content.
It’s accessible to admins and set to show up on every page except:



Drupal Custom content type: Links

We’ve created a custom content type: Links. It loads the link for non-admin users when the page is loaded using drupal_goto($field_link_url[0][‘value’]). Note we use $field_link_url[0][‘value’] instead of $field_link_url[0][‘safe’], that’s to keep ampersands un-encoded.
Here’s the node-links.tpl.php file: (more…)

Drupal: Add links to other book types

NOTE: there is a follow up to this post here: Drupal: update Book’s “Add child page” links to include all allowed book types

I created some custom content types that can act as pages in a drupal book but I didn’t have the convenience of the “Add child page” links at the bottom of the page.
My efforts to override the book.modules hook_link didn’t work so I created a block that contains my links. The block is only visible to admin roles and it uses php to check for permissions and verify the current nodes’ content type before proceeding.
I also added an h2 title that’s displayed after the permissions check out.