'Wiaas Delivery Process Id', 'is_numeric' => true, 'update_entry_meta_callback' => array( __CLASS__, 'update_entry_delivery_process_id' ), 'is_default_column' => false, // this column will be displayed by default on the entry list 'filter' => array( 'operators' => array( 'is' ), ), ); $entry_meta[ 'wiaas_delivery_order_id' ] = array( 'label' => 'Wiaas Delivery Process Order Id', 'is_numeric' => true, 'update_entry_meta_callback' => null, 'is_default_column' => false, // this column will be displayed by default on the entry list 'filter' => array( 'operators' => array( 'is' ), ), ); $entry_meta[ 'wiaas_delivery_step_name' ] = array( 'label' => 'Wiaas Delivery Step name', 'is_numeric' => false, 'update_entry_meta_callback' => null, 'is_default_column' => false, // this column will be displayed by default on the entry list 'filter' => array( 'operators' => array( 'is' ), ), ); return $entry_meta; } public static function update_entry_delivery_process_id($key, $entry, $form) { if ( isset( $_REQUEST['wiaas_delivery_process_id'] ) ) { return absint( $_REQUEST['wiaas_delivery_process_id'] ); } if ( isset( $entry[ $key ] ) ) { return $entry[ $key ]; } return ''; } public function scripts() { $plugin_url = untrailingslashit( plugins_url( '/', WIAAS_FILE ) ); $scripts = array( array( 'handle' => 'wiaas_form_editor_js', 'src' => $plugin_url . '/assets/js/wiaas-form-editor.js', 'enqueue' => array( array( 'admin_page' => array('form_editor'), ), ), ) ); return array_merge( parent::scripts(), $scripts ); } /** * Add settings menu for form delivery process * * @param $tabs * @param $form_id * * @return array */ public function add_form_settings_menu( $tabs, $form_id ) { $tabs[] = array( 'name' => $this->_slug, 'label' => esc_html__( 'Delivery Settings', 'wiaas' ), 'query' => array( 'fid' => null ) ); return $tabs; } /** * Add settings field for delivery process settings menu * * @param $form * * @return array */ public function form_settings_fields($form) { return array( array( 'title' => esc_html__( 'Delivery Process', 'wiaas' ), 'fields' => array( array( 'name' => 'delivery_process', 'label' => esc_html__( 'Delivery Form Type', 'wiaas' ), 'type' => 'delivery_process', ) ) ) ); } public function settings_delivery_process() { $this->settings_select(array( 'name' => 'delivery_form_type', 'choices' => array( array( 'value' => 'process', 'label' => 'Process Form' ), array( 'value' => 'action', 'label' => 'Action Form' ), ), 'after_select' => '
Choose if this form will be used as process form or action form.
' . 'Process form defines order delivery process workflow.
' . 'Action form defines custom order data that is collected from delivery process participants.
' )); ?>Choose action code for action form.
' )); $this->settings_checkbox_and_select(array( 'checkbox' => array( 'label' => esc_html__( 'Automatic', 'wiaas' ), 'name' => 'automatic_action_entries_enabled', 'default_value' => '0', ), 'select' => array( 'name' => 'automatic_action_entries_type', 'choices' => array( array( 'value' => 'single', 'label' => esc_html__( 'Single entry', 'wiaas' ), ), array( 'value' => 'bundle', 'label' => esc_html__( 'Entry per bundle', 'wiaas' ), ) ), 'after_select' => 'Automatic entries can be created once per order or per every bundle in order.
' . 'Automatic entry will not be created if any required field cannot be populated.
', ) )); return; } $countries = Wiaas_Countries::get_available_countries(); $countries_choices = array(); foreach ($countries as $country) { $countries_choices[] = array( 'value' => $country['code'] , 'label' => $country['name'] ); } $this->settings_select(array( 'name' => 'delivery_country', 'choices' => $countries_choices, 'after_select' => 'Choose country for which this process is defined.
' )); } }