Wrote a small feature for the patterns module and wanted to see if others thought it would be useful.

http://www.youtube.com/watch?v=PJb2U6Ya0IQ

basic idea of feature is to facilitate generating simple patterns that emulate configuration of existing site. I have 2 in mind. One that generates the pattern for your current roles and permissions. You select which roles and which module's permissions and if you want the overwrite option and the pattern xml is generated. This is the one I coded and is in the video.

I'd also like to do a similar one where you pick a module and it generates the xml for the associated variables, such as you might get with the query

select concat( '',value,'')
from variable where name like 'user%' OR name like 'date%' order by name

w/o the serialization encoding.

Seems like pattern generation could be done a number of ways including drush, macro
recorder, etc. I think this approach is good when you are trying to emulate an existing site.

let me know if you think these 2 features would be a useful addition to the module and I'll code both, clean the code up to Drupal standards and submit a patch.

the current code is

  $items['admin/build/patterns/generate'] = array(
    'title' => 'Generate',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('patterns_generate_rolesandperm'),
    'access arguments' => array('administer patterns'),
    'type' => MENU_LOCAL_TASK,
    'file' => 'patterns.generate.inc',
  );
  
  $items['admin/build/patterns/generate/rolesandperms'] = array(
    'title' => 'Roles and Perms',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -5,
    'file' => 'patterns.generate.inc',
  );

in the patterns.module file and the attached file patterns.generate.inc

CommentFileSizeAuthor
#1 patterns.generate.inc_.txt5.88 KBjohnbarclay

Comments

johnbarclay’s picture

StatusFileSize
new5.88 KB

first video link is bad. use:

http://www.youtube.com/watch?v=8B9rGOM5pGY

ChrisBryant’s picture

Status: Active » Closed (duplicate)

Thanks again johnbarclay, this rocks! I assume the patch in #514234: Patch for Generating Variable, Role, and Perm Patterns from existing site. is the most up-to-date and so it's safe to mark this as a duplicate of the other issue. If not, let me know.

I definitely agree that both features are useful and integration with Drush, etc would be lovely as well. :-)