setLabel( 'Gravity Forms' ); $installed = false; if ( is_plugin_active( 'gravityforms/gravityforms.php' ) ) { $installed = true; } $this->addHook( APEX_TOOLBOX_HOOK_ACTION, 'init', 'setupHooks', Array( 'label' => 'Add Bootstrap classes & columns' . ( ! $installed ? ' (GRAVITY FORMS NOT INSTALLED)' : '' ), 'description' => 'Add Bootstrap classes to input fields to provide a more constant styling experience as well as a column divider - requires extra CSS for columns' ) ); $this->addHook( APEX_TOOLBOX_HOOK_ACTION, 'init', 'confirmationScroll', Array( 'label' => 'Confirmation Scrolling' . ( ! $installed ? ' (GRAVITY FORMS NOT INSTALLED)' : '' ), 'description' => 'When a fixed header is in use the confirmation message gets lost behind it. This hook will ensure it is scrolled in to view.' ) ); } /** * When a fixed header is in use the confirmation message gets lost behind it. This hook will ensure it is scrolled in to view. * * @param array $args Any arguments passed to the callback * * @author Nigel Wells * @return void; */ public function confirmationScroll( $args = Array() ) { // Create hooks depending on where we are at if ( is_admin() ) { // Create settings $this->Toolbox->addSetting( Array( 'name' => 'gf_header_selector', 'label' => 'Header DOM Selector', 'type' => 'string', 'value' => $this->Toolbox->getOption( 'gf_header_selector' ), 'description' => 'Enter a selector from the DOM where the height of the header can be calculated from' ), $this->getLabel() ); $this->Toolbox->addSetting( Array( 'name' => 'gf_header_padding', 'label' => 'Padding After Header', 'type' => 'string', 'value' => ( $this->Toolbox->getOption( 'gf_header_padding' ) ? $this->Toolbox->getOption( 'gf_header_padding' ) : 20 ), 'description' => 'How much padding to be added (in pixels) after the header' ), $this->getLabel() ); $this->Toolbox->addSetting( Array( 'name' => 'gf_scroll_speed', 'label' => 'Scroll speed', 'type' => 'string', 'value' => ( $this->Toolbox->getOption( 'gf_scroll_speed' ) ? $this->Toolbox->getOption( 'gf_scroll_speed' ) : 250 ), 'description' => 'How fast (milliseconds) to scroll the confirmation message in to view' ), $this->getLabel() ); $this->Toolbox->addSetting( Array( 'name' => 'gf_breakpoint_ignore', 'label' => 'Breakpoint Ignore', 'type' => 'string', 'value' => ( $this->Toolbox->getOption( 'gf_breakpoint_ignore' ) ? $this->Toolbox->getOption( 'gf_breakpoint_ignore' ) : 0 ), 'description' => 'If the fixed header gets disabled on smaller screens then you can disable it but entering the device breakpoint width' ), $this->getLabel() ); } else { add_action( 'wp_footer', function () { ?> Toolbox->includeFile( 'gravity_forms.php' ); GF_Fields::register( new GF_Field_Column() ); GF_Fields::register( new GF_Field_Submit() ); add_action( 'gform_field_standard_settings', function ( $placement, $form_id ) { if ( $placement == 0 ) { echo '
  • Column breaks should be placed between fields to split form into separate columns. You do not need to place any column breaks at the beginning or end of the form, only in the middle.
  • '; echo '
  • Used to place the submit button anywhere in the form rather than just in the footer. Requires the footer icon being hidden via CSS.
  • '; } }, 10, 2 ); add_filter( 'gform_field_container', function ( $field_container, $field, $form, $css_class, $style, $field_content ) { if ( IS_ADMIN ) { return $field_container; } if ( $field['type'] == 'column' ) { $column_index = 2; foreach ( $form['fields'] as $form_field ) { if ( $form_field['id'] == $field['id'] ) { break; } if ( $form_field['type'] == 'column' ) { $column_index ++; } } return '