/* * * Creates a Gravity Forms custom field type for UTM parameters and URL info * */ if ( ! class_exists( 'GFForms' ) ) { return; } class UTM_Parameters_Field extends GF_Field_Hidden { public $type = 'utm_parameters'; // # FORM EDITOR & FIELD MARKUP ------------------------------------------------------------------------------------- /** * Return the field title, for use in the form editor. * * @return string */ public function get_form_editor_field_title() { return esc_attr__( 'UTM Parameters', 'utmparameters' ); } /** * Assign the UTM Parameters button to the Advanced Fields group. * * @return array */ public function get_form_editor_button() { return array( 'group' => 'advanced_fields', 'text' => $this->get_form_editor_field_title() ); } /** * Return the settings which should be available on the field in the form editor. * * @return array */ function get_form_editor_field_settings() { return array( 'prepopulate_field_setting', 'label_setting', 'default_input_values_setting', ); } /** * Returns the scripts to be included for this field type in the form editor. * * @return string */ public function get_form_editor_inline_script_on_page_render() { // set the default field label $script = 'function SetDefaultValues_utm_parameters(field) {' . "field.label = '{$this->get_form_editor_field_title()}';" . "field.inputs = [new Input(field.id + 0.1, 'initial_landing_page'),new Input(field.id + 0.2, 'referrer'),new Input(field.id + 0.3, 'last_referrer'),new Input(field.id + 0.4, 'utm_campaign'),new Input(field.id + 0.5, 'utm_content'),new Input(field.id + 0.6, 'utm_term'),new Input(field.id + 0.7, 'utm_source'),new Input(field.id + 0.8, 'utm_medium'),new Input(field.id + 0.9, 'visits')];" . '}'; return $script; } /** * Returns the field inner markup. * * @param array $form The Form Object currently being processed. * @param string|array $value The field value. From default/dynamic population, $_POST, or a resumed incomplete submission. * @param null|array $entry Null or the Entry Object currently being edited. * * @return string */ public function get_field_input( $form, $value = '', $entry = null ) { $is_entry_detail = $this->is_entry_detail(); $is_form_editor = $this->is_form_editor(); $is_admin = $is_entry_detail || $is_form_editor; $form_id = absint( $form['id'] ); $id = $this->id; $field_id = $is_entry_detail || $is_form_editor || $form_id == 0 ? "input_$id" : 'input_' . $form_id . "_$id"; $class_suffix = $is_entry_detail ? '_admin' : ''; $disabled_text = $is_form_editor ? 'disabled="disabled"' : ''; $field_type = $is_admin ? 'text' : 'hidden'; $i = 1; $markup = ''; foreach ( $this->inputs as $input ) { $input_markup = sprintf( '', $field_type, $id, $i, esc_attr( $input['label'] ), $field_id, esc_attr( rgar( $value, strval( $input['id'] ) ) ), $disabled_text ); $i ++; $markup .= $is_admin ? "{$input_markup}" : $input_markup; } return sprintf( "
%s
", $markup ); } /** * Format the entry value for display on the entry detail page and for the {all_fields} merge tag. * * @param string|array $value The field value. * @param string $currency The entry currency code. * @param bool|false $use_text When processing choice based fields should the choice text be returned instead of the value. * @param string $format The format requested for the location the merge is being used. Possible values: html, text or url. * @param string $media The location where the value will be displayed. Possible values: screen or email. * * @return string */ public function get_value_entry_detail( $value, $currency = '', $use_text = false, $format = 'html', $media = 'screen' ) { $markup = ''; return $markup; } } GF_Fields::register( new UTM_Parameters_Field() ); ?> 5810-25 – Piranha Metal Fabrication Equipment by MegaFab

5810-25

Showing 1–20 of 364 results