public function pressButton($name)
 {
     $form_state = $this->getFormState();
     $order = $form_state['order'];
     $response = parent::pressButton($name, array(), $form_state['order']);
     return $this->getResponse($response);
 }
 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 pressPaymentOption($name)
 {
     $checkout_pages = commerce_checkout_pages();
     $checkout_page = $checkout_pages[$this->page_id];
     $order = commerce_order_load($this->order_id);
     $response = parent::pressButton($name, array('ajax' => true), $order, $checkout_page);
     return $this->getResponse($response);
 }
 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);
 }
Example #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);
 }
 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);
 }
 /**
  * This function is used for submit vocabulary form
  * @param NULL
  * @return $form_state if success else error message 
  */
 public function submit()
 {
     $this->fillOpValues(t('Save'));
     //$this->fillValues(, array('op' => t('Save')));
     $output = parent::submit($this->fillValues);
     if (is_array($output)) {
         // There was an error.
         return $output;
     } else {
         $form_state = $this->getFormState();
         return $form_state['values'];
     }
 }
 /**
  * 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;
 }
 /**
  * Returns an empty field value.
  *
  * @param Form $formObject
  *   Form object.
  * @param $field_name
  *   Field name.
  *
  * @return array
  *   An empty field value array.
  */
 public static function getEmptyValue(Form $formObject, $field_name)
 {
     list($field, $instance, $num) = $formObject->getFieldDetails($field_name);
     $display_summary = $instance['settings']['display_summary'];
     $output = array('value' => '');
     if ($display_summary) {
         $output['summary'] = '';
     }
     return $output;
 }
Example #12
0
 /**
  * Default constructor.
  */
 function __construct()
 {
     parent::__construct('user_login');
 }
Example #13
0
 /**
  * Returns an empty field value.
  *
  * @param Form $formObject
  *   Form object.
  * @param $field_name
  *   Field name.
  *
  * @return array
  *   An empty field value array.
  */
 public static function getEmptyValue(Form $formObject, $field_name)
 {
     list($field, $instance, $num) = $formObject->getFieldDetails($field_name);
     $text_processing = $instance['settings']['text_processing'];
     $output = array('value' => '');
     if ($text_processing) {
         $output['format'] = 'plain_text';
     }
     return $output;
 }
Example #14
0
 /**
  * Returns an empty field value.
  *
  * @param Form $formObject
  *   Form object.
  * @param $field_name
  *   Field name.
  *
  * @return array
  *   An empty field value array.
  */
 public static function getEmptyValue(Form $formObject, $field_name)
 {
     list($field, $instance, $num) = $formObject->getFieldDetails($field_name);
     $show_title = $instance['settings']['title'];
     $output = array('url' => '', 'attributes' => array());
     if ($show_title != 'none') {
         $output['title'] = '';
     }
     return $output;
 }
Example #15
0
 public static function hasFieldAccess(Form $formObject, $field_name)
 {
     if (is_string($field_name)) {
         $access_function = "has" . Utils::makeTitleCase($field_name) . "Access";
         $access = $formObject->{$access_function}();
     } else {
         $access = $formObject->hasFieldAccess($field_name);
     }
     return $access;
 }
 public function __construct($card_data)
 {
     parent::__construct('commerce_stripe_cardonfile_create_form', array(), $card_data);
 }
 public function __construct($product)
 {
     $this->includeFile('inc', 'commerce_product', 'includes/commerce_product.forms');
     parent::__construct('commerce_product_product_form', $product);
 }