public function __construct($order_id)
 {
     $args = func_get_args();
     array_shift($args);
     $page_id = array_shift($args);
     $order = commerce_order_load($order_id);
     if (!$order) {
         $this->setErrors("Order {$order_id} does not exist.");
         $this->setInitialized(FALSE);
         return;
     }
     $checkout_page = NULL;
     drupal_static_reset();
     $checkout_pages = commerce_checkout_pages();
     if (is_null($page_id)) {
         $checkout_page = reset($checkout_pages);
     } elseif (!empty($checkout_pages[$page_id])) {
         $checkout_page = $checkout_pages[$page_id];
     }
     if (is_null($checkout_page)) {
         $this->setErrors("Checkout page not defined correctly.");
         $this->setInitialized(FALSE);
     }
     $this->includeFile('inc', 'commerce_checkout', 'includes/commerce_checkout.pages');
     parent::__construct('commerce_checkout_form_' . $checkout_page['page_id'], $order, $checkout_page);
     $this->page_id = $checkout_page['page_id'];
     $this->order_id = $order_id;
 }
 public function __construct($order)
 {
     $args = func_get_args();
     array_shift($args);
     $this->order = $order;
     $this->includeFile('inc', 'commerce_payment', 'includes/commerce_payment.forms');
     parent::__construct('commerce_payment_order_transaction_add_form', $order);
 }
 public function __construct($order_id)
 {
     $this->order = commerce_order_load($order_id);
     $transaction_array = commerce_payment_transaction_load_multiple(array(), array('order_id' => $order_id));
     $this->transaction = end($transaction_array);
     $this->includeFile('inc', 'commerce_stripe', 'includes/commerce_stripe.admin');
     parent::__construct('commerce_stripe_capture_form', $this->order, $this->transaction);
 }
 public function __construct($cid)
 {
     $this->comment = comment_load($cid);
     if ($this->comment) {
         $this->includeFile('inc', 'comment', 'comment.admin');
         parent::__construct('comment_confirm_delete', $this->comment);
     }
 }
 public function __construct($nid)
 {
     $this->node = node_load($nid);
     if ($this->node) {
         $this->includeFile('inc', 'node', 'node.pages');
         parent::__construct('node_delete_confirm', $this->node);
     }
     $this->setInitialized(TRUE);
 }
Ejemplo n.º 6
0
 /**
  * Default UserRegisterForm constructor. If you need to disable modules such as captcha, recaptcha, honeypot, mollom, etc., do it here.
  */
 function __construct($user)
 {
     // Captcha and Honeypot must be disabled for form submission
     //module_disable(array('captcha', 'recaptcha', 'honeypot', 'mollom'), TRUE);
     //cache_clear_all();
     parent::__construct('user_pass');
     // $this->userObject = $user;
     // $this->setEntityObject($userObject);
 }
 /**
  * Default constructor.
  *
  * @param mixed $uid_or_account
  *   User id or the account object.
  */
 function __construct($uid_or_account)
 {
     $this->account = NULL;
     if (!empty($uid_or_account) && is_numeric($uid_or_account)) {
         $this->account = user_load($uid_or_account);
     } elseif (is_object($uid_or_account)) {
         $this->account = $uid_or_account;
     }
     $this->includeFile('inc', 'user', 'user.pages');
     parent::__construct('user_cancel_confirm_form', $this->account);
     $this->setInitialized(TRUE);
 }
Ejemplo n.º 8
0
 public function __construct($order_id = NULL)
 {
     if (is_null($order_id)) {
         global $user;
         $order = commerce_cart_order_load($user->uid);
     } else {
         $order = commerce_order_load($order_id);
     }
     $this->order_id = $order->order_id;
     $view = $this->getCartView();
     $output = '';
     parent::__construct(views_form_id($view), $view, $output);
 }
 /**
  * Constructor for the Add to cart form. Provide $nid as the id of the
  * product display node. Other optional arguments are product reference field
  * name, view mode of the product display node and language of the product
  * display node. If optional arguments are not provided, their default values
  * are assumed, which are "field_product", "default" and "en" respectively.
  *
  * @param int $nid
  *   Product display node id.
  */
 public function __construct($nid)
 {
     $args = func_get_args();
     array_shift($args);
     $field_name = array_shift($args);
     $view_mode = array_shift($args);
     $language = array_shift($args);
     if (is_null($field_name)) {
         $field_name = 'field_product';
     }
     if (is_null($view_mode)) {
         $view_mode = 'default';
     }
     if (is_null($language)) {
         $language = 'en';
     }
     $node = node_load($nid);
     $instance = field_info_instance('node', $field_name, $node->type);
     $display = field_get_display($instance, $view_mode, $node);
     $settings = array_merge(field_info_formatter_settings($display['type']), $display['settings']);
     $field_product = field_get_items('node', $node, $field_name);
     $product_id = $field_product[0]['product_id'];
     $products = commerce_product_load_multiple(array($product_id));
     $type = !empty($settings['line_item_type']) ? $settings['line_item_type'] : 'product';
     $line_item = commerce_product_line_item_new(commerce_product_reference_default_product($products), $settings['default_quantity'], 0, array(), $type);
     $line_item->data['context']['product_ids'] = array_keys($products);
     $line_item->data['context']['add_to_cart_combine'] = !empty($settings['combine']);
     $line_item->data['context']['show_single_product_attributes'] = !empty($settings['show_single_product_attributes']);
     $cart_context = array('entity_type' => 'node', 'entity_id' => $nid, 'display' => 'default', 'language' => $language);
     $cart_context['class_prefix'] = $cart_context['entity_type'] . '-' . $nid;
     $cart_context['view_mode'] = $cart_context['entity_type'] . '_' . $view_mode;
     $entity_uri = entity_uri($cart_context['entity_type'], $node);
     $arguments = array('form_id' => commerce_cart_add_to_cart_form_id(array($product_id)), 'line_item' => $line_item, 'show_quantity' => $settings['show_quantity']);
     // Add the display path and referencing entity data to the line item.
     if (!empty($entity_uri['path'])) {
         $arguments['line_item']->data['context']['display_path'] = $entity_uri['path'];
     }
     $arguments['line_item']->data['context']['entity'] = array('entity_type' => $cart_context['entity_type'], 'entity_id' => $cart_context['entity_id'], 'product_reference_field_name' => $field_name);
     // Update the product_ids variable to point to the entity data if we're
     // referencing multiple products.
     if (count($arguments['line_item']->data['context']['product_ids']) > 1) {
         $arguments['line_item']->data['context']['product_ids'] = 'entity';
     }
     parent::__construct($arguments['form_id'], $arguments['line_item'], $arguments['show_quantity'], $cart_context);
     $this->cart_context = $cart_context;
     $this->arguments = $arguments;
 }
Ejemplo n.º 10
0
 /**
  * Default constructor.
  */
 function __construct()
 {
     parent::__construct('user_login');
 }
Ejemplo n.º 11
0
 public function __construct($card_data)
 {
     parent::__construct('commerce_stripe_cardonfile_create_form', array(), $card_data);
 }
Ejemplo n.º 12
0
 public function __construct($product)
 {
     $this->includeFile('inc', 'commerce_product', 'includes/commerce_product.forms');
     parent::__construct('commerce_product_product_form', $product);
 }
 public function __construct()
 {
     parent::__construct('taxonomy_form_vocabulary');
 }