body,.et_pb_column_1_2 .et_quote_content blockquote cite,.et_pb_column_1_2 .et_link_content a.et_link_main_url,.et_pb_column_1_3 .et_quote_content blockquote cite,.et_pb_column_3_8 .et_quote_content blockquote cite,.et_pb_column_1_4 .et_quote_content blockquote cite,.et_pb_blog_grid .et_quote_content blockquote cite,.et_pb_column_1_3 .et_link_content a.et_link_main_url,.et_pb_column_3_8 .et_link_content a.et_link_main_url,.et_pb_column_1_4 .et_link_content a.et_link_main_url,.et_pb_blog_grid .et_link_content a.et_link_main_url,body .et_pb_bg_layout_light .et_pb_post p,body .et_pb_bg_layout_dark .et_pb_post p{font-size:16px}.et_pb_slide_content,.et_pb_best_value{font-size:18px}#et_search_icon:hover,.mobile_menu_bar:before,.mobile_menu_bar:after,.et_toggle_slide_menu:after,.et-social-icon a:hover,.et_pb_sum,.et_pb_pricing li a,.et_pb_pricing_table_button,.et_overlay:before,.entry-summary p.price ins,.et_pb_member_social_links a:hover,.et_pb_widget li a:hover,.et_pb_filterable_portfolio .et_pb_portfolio_filters li a.active,.et_pb_filterable_portfolio .et_pb_portofolio_pagination ul li a.active,.et_pb_gallery .et_pb_gallery_pagination ul li a.active,.wp-pagenavi span.current,.wp-pagenavi a:hover,.nav-single a,.tagged_as a,.posted_in a{color:#741012}.et_pb_contact_submit,.et_password_protected_form .et_submit_button,.et_pb_bg_layout_light .et_pb_newsletter_button,.comment-reply-link,.form-submit .et_pb_button,.et_pb_bg_layout_light .et_pb_promo_button,.et_pb_bg_layout_light .et_pb_more_button,.et_pb_contact p input[type="checkbox"]:checked+label i:before,.et_pb_bg_layout_light.et_pb_module.et_pb_button{color:#741012}.footer-widget h4{color:#741012}.et-search-form,.nav li ul,.et_mobile_menu,.footer-widget li:before,.et_pb_pricing li:before,blockquote{border-color:#741012}.et_pb_counter_amount,.et_pb_featured_table .et_pb_pricing_heading,.et_quote_content,.et_link_content,.et_audio_content,.et_pb_post_slider.et_pb_bg_layout_dark,.et_slide_in_menu_container,.et_pb_contact p input[type="radio"]:checked+label i:before{background-color:#741012}a{color:#4f0202}#main-header,#main-header .nav li ul,.et-search-form,#main-header .et_mobile_menu{background-color:#741012}.et_secondary_nav_enabled #page-container #top-header{background-color:#741012!important}#et-secondary-nav li ul{background-color:#741012}.et_header_style_centered .mobile_nav .select_page,.et_header_style_split .mobile_nav .select_page,.et_nav_text_color_light #top-menu>li>a,.et_nav_text_color_dark #top-menu>li>a,#top-menu a,.et_mobile_menu li a,.et_nav_text_color_light .et_mobile_menu li a,.et_nav_text_color_dark .et_mobile_menu li a,#et_search_icon:before,.et_search_form_container input,span.et_close_search_field:after,#et-top-navigation .et-cart-info{color:#ffffff}.et_search_form_container input::-moz-placeholder{color:#ffffff}.et_search_form_container input::-webkit-input-placeholder{color:#ffffff}.et_search_form_container input:-ms-input-placeholder{color:#ffffff}#top-header,#top-header a,#et-secondary-nav li li a,#top-header .et-social-icon a:before{letter-spacing:-1px}#top-menu li a{font-size:20px}body.et_vertical_nav .container.et_search_form_container .et-search-form input{font-size:20px!important}#top-menu li a,.et_search_form_container input{font-weight:bold;font-style:normal;text-transform:none;text-decoration:none}.et_search_form_container input::-moz-placeholder{font-weight:bold;font-style:normal;text-transform:none;text-decoration:none}.et_search_form_container input::-webkit-input-placeholder{font-weight:bold;font-style:normal;text-transform:none;text-decoration:none}.et_search_form_container input:-ms-input-placeholder{font-weight:bold;font-style:normal;text-transform:none;text-decoration:none}#top-menu li.current-menu-ancestor>a,#top-menu li.current-menu-item>a,#top-menu li.current_page_item>a{color:#ffd700}#main-footer{background-color:#212121}#main-footer .footer-widget h4,#main-footer .widget_block h1,#main-footer .widget_block h2,#main-footer .widget_block h3,#main-footer .widget_block h4,#main-footer .widget_block h5,#main-footer .widget_block h6{color:#741012}.footer-widget li:before{border-color:#741012}#footer-widgets .footer-widget li:before{top:10.6px}#et-footer-nav .bottom-nav li.current-menu-item a{color:#741012}#footer-bottom{background-color:#741012}#footer-info,#footer-info a{color:#ffffff}#footer-bottom .et-social-icon a{color:#ffffff}body .et_pb_button{background-color:rgba(116,16,18,0)}body.et_pb_button_helper_class .et_pb_button,body.et_pb_button_helper_class .et_pb_module.et_pb_button{color:#ffffff}body .et_pb_button:after{content:'$';font-size:20px}h1,h2,h3,h4,h5,h6,.et_quote_content blockquote p,.et_pb_slide_description .et_pb_slide_title{font-weight:bold;font-style:normal;text-transform:none;text-decoration:none}@media only screen and (min-width:981px){.et_header_style_left #et-top-navigation,.et_header_style_split #et-top-navigation{padding:50px 0 0 0}.et_header_style_left #et-top-navigation nav>ul>li>a,.et_header_style_split #et-top-navigation nav>ul>li>a{padding-bottom:50px}.et_header_style_split .centered-inline-logo-wrap{width:100px;margin:-100px 0}.et_header_style_split .centered-inline-logo-wrap #logo{max-height:100px}.et_pb_svg_logo.et_header_style_split .centered-inline-logo-wrap #logo{height:100px}.et_header_style_centered #top-menu>li>a{padding-bottom:18px}.et_header_style_slide #et-top-navigation,.et_header_style_fullscreen #et-top-navigation{padding:41px 0 41px 0!important}.et_header_style_centered #main-header .logo_container{height:100px}#logo{max-height:90%}.et_pb_svg_logo #logo{height:90%}.et_header_style_centered.et_hide_primary_logo #main-header:not(.et-fixed-header) .logo_container,.et_header_style_centered.et_hide_fixed_logo #main-header.et-fixed-header .logo_container{height:18px}.et_header_style_left .et-fixed-header #et-top-navigation,.et_header_style_split .et-fixed-header #et-top-navigation{padding:25px 0 0 0}.et_header_style_left .et-fixed-header #et-top-navigation nav>ul>li>a,.et_header_style_split .et-fixed-header #et-top-navigation nav>ul>li>a{padding-bottom:25px}.et_header_style_centered header#main-header.et-fixed-header .logo_container{height:50px}.et_header_style_split #main-header.et-fixed-header .centered-inline-logo-wrap{width:50px;margin:-50px 0}.et_header_style_split .et-fixed-header .centered-inline-logo-wrap #logo{max-height:50px}.et_pb_svg_logo.et_header_style_split .et-fixed-header .centered-inline-logo-wrap #logo{height:50px}.et_header_style_slide .et-fixed-header #et-top-navigation,.et_header_style_fullscreen .et-fixed-header #et-top-navigation{padding:16px 0 16px 0!important}.et_fixed_nav #page-container .et-fixed-header#top-header{background-color:#ffffff!important}.et_fixed_nav #page-container .et-fixed-header#top-header #et-secondary-nav li ul{background-color:#ffffff}.et-fixed-header #top-menu li a{font-size:16px}.et-fixed-header #top-menu a,.et-fixed-header #et_search_icon:before,.et-fixed-header #et_top_search .et-search-form input,.et-fixed-header .et_search_form_container input,.et-fixed-header .et_close_search_field:after,.et-fixed-header #et-top-navigation .et-cart-info{color:#ffffff!important}.et-fixed-header .et_search_form_container input::-moz-placeholder{color:#ffffff!important}.et-fixed-header .et_search_form_container input::-webkit-input-placeholder{color:#ffffff!important}.et-fixed-header .et_search_form_container input:-ms-input-placeholder{color:#ffffff!important}.et-fixed-header #top-menu li.current-menu-ancestor>a,.et-fixed-header #top-menu li.current-menu-item>a,.et-fixed-header #top-menu li.current_page_item>a{color:#741012!important}}@media only screen and (min-width:1350px){.et_pb_row{padding:27px 0}.et_pb_section{padding:54px 0}.single.et_pb_pagebuilder_layout.et_full_width_page .et_post_meta_wrapper{padding-top:81px}.et_pb_fullwidth_section{padding:0}}h1,h1.et_pb_contact_main_title,.et_pb_title_container h1{font-size:57px}h2,.product .related h2,.et_pb_column_1_2 .et_quote_content blockquote p{font-size:49px}h3{font-size:41px}h4,.et_pb_circle_counter h3,.et_pb_number_counter h3,.et_pb_column_1_3 .et_pb_post h2,.et_pb_column_1_4 .et_pb_post h2,.et_pb_blog_grid h2,.et_pb_column_1_3 .et_quote_content blockquote p,.et_pb_column_3_8 .et_quote_content blockquote p,.et_pb_column_1_4 .et_quote_content blockquote p,.et_pb_blog_grid .et_quote_content blockquote p,.et_pb_column_1_3 .et_link_content h2,.et_pb_column_3_8 .et_link_content h2,.et_pb_column_1_4 .et_link_content h2,.et_pb_blog_grid .et_link_content h2,.et_pb_column_1_3 .et_audio_content h2,.et_pb_column_3_8 .et_audio_content h2,.et_pb_column_1_4 .et_audio_content h2,.et_pb_blog_grid .et_audio_content h2,.et_pb_column_3_8 .et_pb_audio_module_content h2,.et_pb_column_1_3 .et_pb_audio_module_content h2,.et_pb_gallery_grid .et_pb_gallery_item h3,.et_pb_portfolio_grid .et_pb_portfolio_item h2,.et_pb_filterable_portfolio_grid .et_pb_portfolio_item h2{font-size:34px}h5{font-size:30px}h6{font-size:26px}.et_pb_slide_description .et_pb_slide_title{font-size:87px}.et_pb_gallery_grid .et_pb_gallery_item h3,.et_pb_portfolio_grid .et_pb_portfolio_item h2,.et_pb_filterable_portfolio_grid .et_pb_portfolio_item h2,.et_pb_column_1_4 .et_pb_audio_module_content h2{font-size:30px}@media only screen and (max-width:767px){body,.et_pb_column_1_2 .et_quote_content blockquote cite,.et_pb_column_1_2 .et_link_content a.et_link_main_url,.et_pb_column_1_3 .et_quote_content blockquote cite,.et_pb_column_3_8 .et_quote_content blockquote cite,.et_pb_column_1_4 .et_quote_content blockquote cite,.et_pb_blog_grid .et_quote_content blockquote cite,.et_pb_column_1_3 .et_link_content a.et_link_main_url,.et_pb_column_3_8 .et_link_content a.et_link_main_url,.et_pb_column_1_4 .et_link_content a.et_link_main_url,.et_pb_blog_grid .et_link_content a.et_link_main_url{font-size:12px}.et_pb_slider.et_pb_module .et_pb_slides .et_pb_slide_content,.et_pb_best_value{font-size:13px}h1{font-size:22px}h2,.product .related h2,.et_pb_column_1_2 .et_quote_content blockquote p{font-size:18px}h3{font-size:16px}h4,.et_pb_circle_counter h3,.et_pb_number_counter h3,.et_pb_column_1_3 .et_pb_post h2,.et_pb_column_1_4 .et_pb_post h2,.et_pb_blog_grid h2,.et_pb_column_1_3 .et_quote_content blockquote p,.et_pb_column_3_8 .et_quote_content blockquote p,.et_pb_column_1_4 .et_quote_content blockquote p,.et_pb_blog_grid .et_quote_content blockquote p,.et_pb_column_1_3 .et_link_content h2,.et_pb_column_3_8 .et_link_content h2,.et_pb_column_1_4 .et_link_content h2,.et_pb_blog_grid .et_link_content h2,.et_pb_column_1_3 .et_audio_content h2,.et_pb_column_3_8 .et_audio_content h2,.et_pb_column_1_4 .et_audio_content h2,.et_pb_blog_grid .et_audio_content h2,.et_pb_column_3_8 .et_pb_audio_module_content h2,.et_pb_column_1_3 .et_pb_audio_module_content h2,.et_pb_gallery_grid .et_pb_gallery_item h3,.et_pb_portfolio_grid .et_pb_portfolio_item h2,.et_pb_filterable_portfolio_grid .et_pb_portfolio_item h2{font-size:13px}.et_pb_slider.et_pb_module .et_pb_slides .et_pb_slide_description .et_pb_slide_title{font-size:33px}.et_pb_gallery_grid .et_pb_gallery_item h3,.et_pb_portfolio_grid .et_pb_portfolio_item h2,.et_pb_filterable_portfolio_grid .et_pb_portfolio_item h2,.et_pb_column_1_4 .et_pb_audio_module_content h2{font-size:11px}h5{font-size:11px}h6{font-size:10px}.et_pb_section{padding:150px 0}.et_pb_section.et_pb_fullwidth_section{padding:0}.et_pb_row,.et_pb_column .et_pb_row_inner{padding:150px 0}}	h1,h2,h3,h4,h5,h6{font-family:'Montserrat',Helvetica,Arial,Lucida,sans-serif}body,input,textarea,select{font-family:'Montserrat',Helvetica,Arial,Lucida,sans-serif}#top-header .container{font-family:'Montserrat',Helvetica,Arial,Lucida,sans-serif}#main-content .container:before{background:none}#sidebar{display:none}@media (min-width:981px){#left-area{width:100%;padding:23px 0px 0px!important;float:none!important}}body:not(.et-tb) #main-content .container,body:not(.et-tb-has-header) #main-content .container{padding-top:5px!important}element.style{}.wp-block-toolset-blocks-container.tb-container[data-toolset-blocks-container="ed3832aa6201cbec5b1e5b902dc067e2"]{padding:5px!important}.et_pb_post .entry-content{padding-top:5px!important}.gform_required_legend{display:none}div.captcha-hidden{display:hidden;color:#741012;visibility:hidden}.captcha-hidden.label{display:hidden;color:#741012;visibility:hidden}@media only screen and (max-width:980px){.et_pb_column_0,.et_pb_column_1{padding-left:0px!important}.et_pb_section{padding:150px 0 5px 0!important}.et_pb_column .et_pb_row_inner,.et_pb_row{padding:10px 0 5px 0!important}.et_pb_section_0_tb_header{padding:10px 0 5px 0!important}.et_pb_menu--style-left_aligned.et_pb_text_align_center .et_pb_menu__wrap{-webkit-box-pack:right;-ms-flex-pack:right;justify-content:right}.et_pb_section_0_tb_footer{padding:10px 0 5px 0!important}.et_pb_row_0_tb_footer.et_pb_row{padding-top:5px!important;padding-bottom:5px!important;margin-top:0px!important;margin-right:auto!important;margin-bottom:0px!important;margin-left:auto!important;padding-top:50px;padding-bottom:150px}.et_pb_row_1_tb_footer{background-color:#000000;min-height:25px!important}.et_pb_text_0_tb_footer,.et_pb_social_media_follow_0_tb_footer,.et_pb_column_1_tb_footer{display:none}.et_pb_code_0_tb_footer,.et_pb_text_3_tb_footer,.et_pb_image_0_tb_footer,.et_pb_column_0_tb_footer{float:none!important;width:350px!important;margin:0 auto!important}.et_pb_image_0_tb_footer .et_pb_image_wrap img{width:350px!important;margin:0 auto!important}.et_pb_section_1,.et_pb_section_3{display:block}.et_pb_section_2{padding:0 0 5px 0!important}.et_pb_column{width:100%;margin-bottom:0px}#input_6_5{width:300px!important}}body #gform_wrapper_6{background-color:#741012}class GW_Round_Robin{private $_args=array();public function __construct($args=array()){// set our default arguments,parse against the provided arguments,and store for use throughout the class
$this->_args=wp_parse_args($args,array('form_id'=>6,'field_id'=>10,'hide_field'=>true,));// do version check in the init to make sure if GF is going to be loaded,it is already loaded
add_action('init',array($this,'init'))}public function init(){add_filter('gform_pre_render',array($this,'hide_round_robin_field'));add_filter('gform_entry_post_save',array($this,'apply_round_robin'),7,2);add_filter('gform_email_fields_notification_admin',array($this,'add_round_robin_field_to_notification_email_fields'),10,2)}public function hide_round_robin_field($form){if (! $this->_args['hide_field'] || ! $this->is_applicable_form($form)){return $form}foreach ($form['fields'] as &$field){if ($field->id==$this->_args['field_id']){$field->visibility='hidden'}}return $form}public function apply_round_robin($entry,$form){if (! $this->is_applicable_form($entry['form_id'])){return $entry}$rotation=$this->get_rotation_values($this->_args['field_id'],$form);$last_entry=$this->get_last_entry($entry,GFAPI::get_field($entry['form_id'],$this->_args['field_id']));// Get the value submitted for our designated field in the last entry.
$last_value=rgar($last_entry,$this->_args['field_id']);// Determine the next index at which to fetch our value.
$next_index=empty($last_value) ? 0 :array_search($last_value,$rotation)+1;if ($next_index>count($rotation)-1){$next_index=0}// Get the next value based on our rotation.
$next_value=$rotation[$next_index];// Update the value of our designated field in the database.
GFAPI::update_entry_field($entry['id'],$this->_args['field_id'],$next_value);// Update the value of our designated field in the $entry object that will be used to continuing processing the current submission.
$entry[$this->_args['field_id']]=$next_value;return $entry}public function get_last_entry($entry,$field){$field_filters=array();// GPPA integration only supports the first group of filters and filters that are field-specific (no custom values).
if (is_callable('gp_populate_anything') && $field->{'gppa-choices-enabled'}){$gppa_filters=rgar($field->{'gppa-choices-filter-groups'},0);foreach ($gppa_filters as $gppa_filter){if (strpos($gppa_filter['value'],'gf_field:') !==false){// Extract the field ID from the value property (e.g. `gf_field:3` → `3`).
$bits=explode('gf_field:',$gppa_filter['value']);$field_filters[]=array('key'=>$bits[1],'value'=>rgar($entry,$bits[1]),)}}}$last_entry=rgar(GFAPI::get_entries($entry['form_id'],array('status'=>'active','field_filters'=>$field_filters,),array('direction'=>'desc'),array('offset'=>1,'page_size'=>1,)),0);return $last_entry}public function add_round_robin_field_to_notification_email_fields($fields,$form){if (! $this->is_applicable_form($form)){return $fields}$field=GFAPI::get_field($form,$this->_args['field_id']);if (is_callable('gp_populate_anything') && $field->{'gppa-choices-enabled'}){$fields[]=$field}$rotation=$this->get_rotation_values($this->_args['field_id'],$form);if (filter_var($rotation[0],FILTER_VALIDATE_EMAIL)){$fields[]=$field}return $fields}public function get_rotation_values($field_id,$form){$field=clone GFAPI::get_field($form,$field_id);// Add support for GP Limit Choices.
if (is_callable('gp_limit_choices')){$field->choices=gp_limit_choices()->apply_choice_limits($field->choices,$field,$form)}// Add support for GP Inventory Choices.
if (is_callable('gp_inventory_type_choices')){$field->choices=gp_inventory_type_choices()->apply_choice_limits($field->choices,$field,$form)}$rotation=array_filter(wp_list_pluck($field->choices,'value'));return $rotation}public function is_applicable_form($form){$form_id=isset($form['id']) ? $form['id']: $form;return empty($this->_args['form_id']) || (int) $form_id===(int) $this->_args['form_id']}}# Configuration
new GW_Round_Robin(array('form_id'=>123,'field_id'=>4,));