+ All Categories
Home > Technology > The Drupal Strongarm Module - Tips and Tricks.

The Drupal Strongarm Module - Tips and Tricks.

Date post: 12-Dec-2014
Category:
Upload: cgmonroe
View: 2,943 times
Download: 6 times
Share this document with a friend
Description:
A presentation on the strongarm module which allows you to access many modules that have not been made features friendly.
Popular Tags:
15
Advanced Strongarm Some tricks and tips on using the Strongarm Features enhancement module
Transcript
Page 1: The Drupal Strongarm Module - Tips and Tricks.

Advanced Strongarm

Some tricks and tips on using the Strongarm

Features enhancement module

Page 2: The Drupal Strongarm Module - Tips and Tricks.

Strongarm

The Strongarm module allows Drupal

Persistent Variables to be exported

and imported via Features modules.

Page 3: The Drupal Strongarm Module - Tips and Tricks.

Drupal Persistent Variables

• Set by variable_set(name, value)• Retrieved by variable_get(name,

def)• Values stored in the Variables table• Used by most modules for simple

settings• Modules use their own Name Space

Prefix (e.g ant = Automatic Node Title)

Page 4: The Drupal Strongarm Module - Tips and Tricks.

A Case Study Need:

A Feature for User profiles based on Content Profile nodes types.

Requirements:

- Two Content Profile node types: Contact Info (profile) and About Me (network_profile)

- Pathauto module settings to automatically alias them under the /people URL- All users can create and edit their own profile info

Tools:

Two Drupal sites (source / test )SQL Query ToolDevel module (variable editor)(optional) Editor for source code

Page 5: The Drupal Strongarm Module - Tips and Tricks.

Expected OutcomeTwo Content Types with same setting:

- Fields as defined- Workflow Default options set to publish but not front page- Comment settings the same- Content Profile option checked- Attachment settings

Pathauto Settings

- Settings in URL Aliases -> Automated Alias Settings -> Node Paths match.

Authenticated User Role

- Has permissions to “create profile content” and “create networking_profile content.

Page 6: The Drupal Strongarm Module - Tips and Tricks.

Features only

Create a New Feature:

- In Edit Component -> Content types: node, add the two content types

- In Edit Components -> Permissions, select the two permissions

- In Edit Components -> Roles: user_role, select “authenticated user”

Outcome:

- Node types and CCK fields get created- Permissions set in role- but the node type settings are not set. E.g. workflow, comments,

attachments, content profile use, and the like. Also, there are no path alias setting.

Page 7: The Drupal Strongarm Module - Tips and Tricks.

Features with Strongarm on Automatic

Create a New Feature:

- In Edit Component -> Content types: node, add the two content types

- In Edit Components -> Permissions, select the two permissions

- In Edit Components -> Roles: user_role, select “authenticated user”

Outcome:

- Node types and CCK fields get created- Permissions set in role- Standard nodes type settings are set (E.g. workflow, comments,

attachments)- But content profile use is not set. Also, there are no path alias setting.

Page 8: The Drupal Strongarm Module - Tips and Tricks.

Where’s Wald..the Node Type Setting

Finding Node Type Related Settings

Basic assumption: Persistent variable names will contain node_type name

Find related persistent variables using either:

• (Preferred) An SQL Browser Tool to query your site’s DB using the query

Select * from Variables where name like ‘%<node_type>%’

e.g. Select * from Variables where name like ‘%networking_profile%’

• Alternatively, use the Devel Variable Editor page and search thru the listings

Page 9: The Drupal Strongarm Module - Tips and Tricks.

Where’s Wald.. the NT Setting

Green: Auto added by StrongarmRed: Need to be manually added

Page 10: The Drupal Strongarm Module - Tips and Tricks.

Where’s Wald..the Node Type Setting

Notes:

• Repeat for other content type

• Note the “name spaces” for other variables found. These are other modules you might want to add as defaults to your feature as well.

• Look at the values for indications of where it is set/what it’s used for.

• Search the source code for the variable_set instances to validate use (or just keep a good test site db backup and test it).

Page 11: The Drupal Strongarm Module - Tips and Tricks.

Features with Strongarm and Manual Settings

Create a New Feature:

- In Edit Component -> Content types: node, add the two content types

- In Edit Components -> Permissions, select the two permissions

- In Edit Components -> Roles: user_role, select “authenticated user”

- In Edit Components -> Strongarm: variable, add variables found above.

Outcome:

- Node types and CCK fields get created- Permissions set in role- Standard nodes type settings are set (E.g. workflow, comments,

attachments)- Content profile use is set. - Path auto alias is set

Page 12: The Drupal Strongarm Module - Tips and Tricks.

Where’s Wald..the Module Setting

Finding Module Settings

Basic assumption: Persistent variable names will start with module name or module specific prefix.

Find related persistent variables using either:

• (Preferred) An SQL Browser Tool to query your site’s DB using the query

Select * from Variables where name like ‘<module_name>%’

e.g. Select * from Variables where name like ‘realname%’

• Alternatively, use the Devel Variable Editor page and search thru the listings

Page 13: The Drupal Strongarm Module - Tips and Tricks.

Where’s Wald..the Module Setting

Notes:

• Modules may use their own DB tables to store settings. Strongarm will not work with these.

• Setting may be a DB record id reference or other complicated structure and will not work.

• The variable name is often the same name as the admin form field that sets it.

• Look at the “postfix” and values for indications of where it is set/what it’s used for.

• Search the source code for the variable_set instances to validate use (or just keep a good test site db backup and test it).

Page 14: The Drupal Strongarm Module - Tips and Tricks.

Conclusion

Strongarm allows for many non-Feature

enabled module settings to be captured in

a Feature Module

Page 15: The Drupal Strongarm Module - Tips and Tricks.

Questions?


Recommended