In my Drupal 7 commerce website, I have my checkout page which will add my billing and shipping profiles. I need to just display my shipping address and billing address, instead of input fields. (Data fed from an ERP backend.)
So I've hidden al the input fields. Now I want to render the addresfield value and add it to my form just for display. But I seem to be unable to do so.
I have the following code in my form alter:
$handlers = array('address' => 'address');
$context = array('mode' => 'render');
$address_render_array = addressfield_generate($form['customer_profile_shipping']['customer_profile']['#value']->commerce_customer_address,
$handlers, $context);
dpm($address_render_array, 'render arr');
dpm(drupal_render($address_render_array), 'rendered');
However drupal_render() returns an empty string and I do not understand why. I've tried to X-debug, and I saw strangely enough that #access vars where FALSE, but I'm not finding out why.
After which I want to display it in my form
Something like
$form['my-address'] = array('#markup' => $renderedaddress);