function commerce_node_checkout_expire_field_node_relist_form::render in Commerce Node Checkout 7
Implements parent::render().
Overrides views_handler_field::render
File
- commerce_node_checkout_expire/
includes/ views/ handlers/ commerce_node_checkout_expire_field_node_relist_form.inc, line 47 - Contains the field handler for the node relist form.
Class
- commerce_node_checkout_expire_field_node_relist_form
- Views field handler for the node relist form.
Code
function render($values) {
// Build a mock node object so we can avoid loading
$node = new stdClass();
$node->nid = $values->nid;
$node->title = $values->node_title;
$node->type = $values->nodetype;
$node->uid = $values->nodeuid;
$node->status = $values->nodestatus;
// See if this node is already in the user's cart
if (commerce_node_checkout_expire_node_in_cart($node)) {
// See if we should provide a shopping cart link
if ($link_text = $this->options['cart_link_text']) {
return l(t($link_text), 'cart');
}
// Stop here
return;
}
// See if the user has access to relist this node
if (commerce_node_checkout_expire_relist_access($node)) {
// Get the form by appending the node ID so each form is technically
// a completely different form. If we didn't do this, the forms
// would collide since there can be multiple on the same page.
$form = drupal_get_form('commerce_node_checkout_expire_relist_form_' . $node->nid, $node, FALSE);
// Render the form
return drupal_render($form);
}
return NULL;
}