Reputation: 660
I have my module called mymodule.
In mymodule.module I have:
function mymodule_menu() {
$items['mymodule/ship/%node'] = array(
'title' => t('Shipment details'),
'page callback' => '_mymodule_addr',
'page arguments' => array(2),
'access callback' => TRUE,
'type' => MENU_VISIBLE_IN_BREADCRUMB,
'weight' => 0,
);
return $items;
}
I want to render the addressfield widget inside the page. Then I want to read form values. Can you help me?
Upvotes: 4
Views: 3055
Reputation: 495
What about using the Field API:
Within your callback function use:
$node = node_load($parameter);
$my_field_value = '<front>';
$my_field_items = field_get_items('node', $node, 'field_my_field');
if ($my_field_items) {
$my_field_first_item = reset($my_field_items);
$my_field_value = $my_field_first_item['value'];
}
return l($my_field_value, 'Link name');
Have a look at: Drupal Field API and find the right function for you.
Also at: Drupal Examples are some useful examples that you might use.
As least, don't forget that you can use a custom .tpl file in your theme where you put custom markup to your field.
Upvotes: 1