Ubercart module, understanding drupal_get_form This is all taken from ubercart uc_attribute module.

So in hook_form I have this:

  $items['admin/store/products/attributes/%uc_attribute/edit'] = array(
    'title' =&gt; 'Edit attribute',
    'description' =&gt; 'Edit a product attribute.',
    'page callback' =&gt; 'drupal_get_form',
    'page arguments' =&gt; array('uc_attribute_form', 4),
    'access arguments' =&gt; array('administer attributes'),
    'file' =&gt; 'uc_attribute.admin.inc',
  );


As far as I understand this menu entry will call the function drupal_get_form that will call the function uc_attribute_form using %uc_attribute as a parameter.

Now if I go to the function definition:

function uc_attribute_form($form, &amp;$form_state, $attribute = NULL) {

  // If an attribute specified, add its ID as a hidden value.
  if (!empty($attribute)) {
    $form['aid'] = array('#type' =&gt; 'value', '#value' =&gt; $attribute-&gt;aid);
    drupal_set_title(t('Edit attribute: %name', array('%name' =&gt; $attribute-&gt;name)), PASS_THROUGH);
  }


It is clear that $attribute is not an integer when it is used by this fucntion. It actually is an attribute stdClass object probably loaded by uc_attribute_load(...).

My question is: What's happening behind drupal_get_form that at the end an integer (the attribute ID) coming from the URL, ends being a full attribute standard object.

I'm kind of learning / developing a module extension and tried to backtrace but definitely couldn't get to an answer.

Thanks!

Juan B.
Its not related to drupal_get_form, its completely separated events sequentially fired in Drupal. 

step 1 - First in menu: argument %something loaded via something_load and passed to page callback as parameters.

step 2 - Second in menu: page arguments will passed to function specified by page callback.

step 3- Third in drupal_get_form: get first argument uc_attribute_form as form ID and use it for build form and get second argument 4 from menu which loaded in step 1. 4 means fifth argument in path 0-admin/1-store/2-products/3-attributes/4-%uc_attribute/5-edit

EDIT:
read more about hook_menu


  Registered paths may also contain special "auto-loader" wildcard
  components in the form of '%mymodule_abc', where the '%' part means
  that this path component is a wildcard, and the 'mymodule_abc' part
  defines the prefix for a load function, which here would be named
  mymodule_abc_load().