/** * Finishes construction given the parent form section and this form section's name * @param EE_Form_Section_Proper $parent_form_section * @param string $name * @throws EE_Error */ public function _construct_finalize($parent_form_section, $name) { if (!$this->_payment_method_type instanceof EE_PMT_Base) { throw new EE_Error(sprintf(__('Payment Method forms must have set their payment method type BEFORE calling _construct_finalize', 'event_espresso'))); } //set the name of this form based on the payment method type if (!$this->_name && !$name) { $name = str_replace(" ", "_", ucwords(str_replace("_", " ", $this->_payment_method_type->system_name()))) . "_Settings_Form"; } parent::_construct_finalize($parent_form_section, $name); }
/** * Creates a payment method of the specified type. Does not save it. * * @global WP_User $current_user * @param EE_PMT_Base $pm_type_obj * @return EE_Payment_Method * @throws \EE_Error */ public function create_payment_method_of_type($pm_type_obj) { global $current_user; $payment_method = EE_Payment_Method::new_instance(array('PMD_type' => $pm_type_obj->system_name(), 'PMD_name' => $pm_type_obj->pretty_name(), 'PMD_admin_name' => $pm_type_obj->pretty_name(), 'PMD_slug' => $pm_type_obj->system_name(), 'PMD_wp_user' => $current_user->ID, 'PMD_order' => EEM_Payment_Method::instance()->count(array(array('PMD_type' => array('!=', 'Admin_Only')))) * 10)); return $payment_method; }