Hi, I'm creating a module that will have an admin/config/services/vision page which lists organisation names in a database table. These organisation names will change frequently, so I won't know their names until after the module is written. What would be the simplest way to create admin/config/services/vision/organisation-name. I can only think of using a query, i.e. admin/config/services/organisation?o=Drupal

Or would the following work?

foreach($organisationsArray as $orgName) {
  $items['admin/config/services/vision/' . $orgName] = array(
    'title' => $orgName,
    'page callback' => 'orgreg_orgconfig',
    'page arguments' => $orgName,
  );
}

Coming to think of it, that sounds reasonable, is this the common method?

Many thanks.

Comments

justageek’s picture

  $items['admin/config/services/vision/%'] = array(
    'title' => $orgName,
    'page callback' => 'orgreg_orgconfig',
    'page arguments' => array(1),
  );

This will pass the organization name as the first argument to your function, so navigating to admin/config/services/vision/my-org will pass 'my-org' to your callback function.

carlnewton’s picture

Oh! This sounds like it's going to save me some time! Many thanks :)