Experimental Project

This is a sandbox project, which contains experimental code for developer use only.

Summary

The 'Strongarm dump' module allows module variables to be exported into arrays and objects that can be used by the strongarm.module.

Features

  • Adds reset (revert) all strongarmed variables to admin/settings/strongarm.
  • Exports variables as hook_strongarm() object.
  • Exports variables as an associative array.
  • Exports variables as Features info file format

Tips

Below code is an example of how the strongarm dump module's exported $conf variables array can be used by a custom module to strongarm a site's variables.

This approach allows developers to create a 'read-able' view of all the strongarmed variables.

<?php
/**
* Implementation of hook_strongarm().
*/
function example_strongarm() {
 
$conf = array();
 
/* Site information (admin/settings/site-information) */
   
$conf += array(
     
'site_name' => 'Example website',
     
'site_mail' => 'webmaster@example.org,
      '
site_slogan' => '',
      '
site_mission' => '',
      '
site_footer' => '&copy;'. date('Y') .' Example website',
      '
anonymous' => 'Anonymous',
      '
site_frontpage' => 'node/1',
    );
  // Convert $conf variables array to strongarm objects.
  $strongarms = array();
  foreach ($conf as $name => $value) {
    $strongarm = new stdClass;
    $strongarm->api_version = 1;
    $strongarm->name = $name;
    $strongarm->value = $value;
    $strongarms[$name] = $strongarm;
  }
  return $strongarms;
}
?>

Requirements

  • Strongarm: Enforces variable values defined by modules that need settings set to operate properly.

Notes

  • The 'Strongarm dump' assumes that a module's configuration form's url is based on the module's name. In some case, the module's name and URL are not similar making it difficult to know if the form contains variable settings. There is some custom logic to address this issue.
  • Occasionally, to properly strongarm a module you might need to look at module's code to determine what is the exact variable name/value the module is looking for.

Project Information