is_gravityforms_supported() ) { return; } add_action( 'init', array( $this, 'init_hooks' ) ); } /** * Add the hooks via the WordPress init action. */ public function init_hooks() { add_filter( 'gform_tooltips', array( $this, 'add_tooltips' ) ); add_action( 'gform_field_standard_settings', array( $this, 'field_settings' ) ); add_action( 'gform_field_appearance_settings', array( $this, 'field_appearance_settings' ) ); add_action( 'gform_entry_detail', array( 'Gravity_Flow_Field_Discussion', 'delete_discussion_item_script' ) ); add_action( 'wp_ajax_rg_delete_file', array( 'RGForms', 'delete_file' ) ); add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'RGForms', 'delete_file' ) ); add_action( 'wp_ajax_gravityflow_delete_discussion_item', array( 'Gravity_Flow_Field_Discussion', 'ajax_delete_discussion_item' ) ); } /** * Adds the Workflow Fields group to the form editor. * * @param array $field_groups The properties for the field groups. * * @return array */ public static function maybe_add_workflow_field_group( $field_groups ) { foreach ( $field_groups as $field_group ) { if ( $field_group['name'] == 'workflow_fields' ) { return $field_groups; } } $field_groups[] = array( 'name' => 'workflow_fields', 'label' => __( 'Workflow Fields', 'gravityflow' ), 'fields' => array() ); return $field_groups; } /** * Add the tooltips for the workflow fields group and any custom field settings. * * @param array $tooltips An associative array where the key is the tooltip name and the value is the tooltip. * * @return array */ public function add_tooltips( $tooltips ) { $tooltips['form_workflow_fields'] = '
' . __( 'Workflow Fields', 'gravityflow' ) . '
' . __( 'Workflow Fields add advanced workflow functionality to your forms.', 'gravityflow' ); $tooltips['gravityflow_discussion_timestamp_format'] = '
' . __( 'Custom Timestamp Format', 'gravityflow' ) . '
' . sprintf( __( 'If you would like to override the default format used when displaying the comment timestamps, enter your %scustom format%s here.', 'gravityflow' ), '', '' ); return $tooltips; } /** * Add the assignees and role settings to the general tab. * * @param int $position The setting position. */ public function field_settings( $position ) { if ( $position == 20 ) { // After Description setting. $this->setting_assignees(); $this->setting_role(); } } /** * Output the markup for the gravityflow_setting_assignees setting to the field general tab in the form editor. */ public function setting_assignees() { ?>
  • setting_role_select(); ?>
  • '', 'label' => esc_html__( 'Include users from all roles', 'gravityflow' ) ) ); $role_field = array( 'name' => 'gravityflow_users_role_filter', 'choices' => array_merge( $choices, Gravity_Flow_Common::get_roles_as_choices( false ) ), 'onchange' => "SetFieldProperty('gravityflowUsersRoleFilter',this.value);", ); $html = gravity_flow()->settings_select( $role_field, false ); echo str_replace( sprintf( 'name="_gaddon_setting_%s"', esc_attr( $role_field['name'] ) ), '', $html ); } /** * Add the discussion fields custom timestamp format to the appearance tab. * * @param int $position The setting position. */ public function field_appearance_settings( $position ) { if ( $position == 0 ) { ?>
  • roles ); } else { $value = $user->get( $property ); } } } return self::maybe_format_user_variable( $value, $url_encode, $esc_html ); } /** * Filters the value of invalid or special characters before output. * * @since 1.5.1-dev * * @param string|int $value The user ID or property to be filtered. * @param bool $url_encode Indicates if the urlencode function should be applied. * @param bool $esc_html Indicates if the esc_html function should be applied. * * @return string */ public static function maybe_format_user_variable( $value, $url_encode, $esc_html ) { if ( $url_encode ) { $value = urlencode( $value ); } if ( $esc_html ) { $value = esc_html( $value ); } return $value; } } new Gravity_Flow_Fields();