"select", "label" => "Show Advanced Woo Labels?", "default" => "yes", "options" => array( 'yes' => 'Yes', 'no' => 'No' ) ); if ( 'woocommerce' == $id ) { $form['general']['sections']['multiple_products']['fields']['show_awl'] = $awl_option; } return $form; } /* * Check module settings */ public function fl_builder_before_render_modules( $nodes, $col_id ) { if ( $nodes ) { foreach ( $nodes as $node ) { if ( $node->type === 'module' && $node->settings ) { if ( property_exists( $node->settings, 'show_awl' ) && $node->settings->show_awl === 'no' ) { $this->data['show_labels'] = false; } else { $this->data['show_labels'] = true; } } } } } public function before_render( $module ) { $this->data['is_beaver'] = true; $this->data['show_labels'] = true; } public function after_render( $module ) { $this->data['is_beaver'] = false; $this->data['show_labels'] = true; } /* * Enable or not products labels */ function disable_labels( $disable, $product ) { if ( isset( $this->data['show_labels'] ) && ! $this->data['show_labels'] ) { $disable = true; } return $disable; } /* * Add new label conditions for admin */ public function label_rules( $options ) { $options['Special'][] = array( "name" => __( "Beaver builder: Is builder block", "advanced-woo-labels" ), "id" => "aws_is_beaver", "type" => "bool", "operators" => "equals", ); return $options; } /* * Add custom condition rule method */ public function condition_rules( $rules ) { $rules['aws_is_beaver'] = array( $this, 'awl_is_beaver' ); return $rules; } /* * Condition: Is Beaver block */ public function awl_is_beaver( $condition_rule ) { global $product; $match = false; $operator = $condition_rule['operator']; $value = $condition_rule['value']; $compare_value = 'false'; if ( isset( $this->data['is_beaver'] ) && $this->data['is_beaver'] ) { $compare_value = 'true'; } if ( 'equal' == $operator ) { $match = ($compare_value == $value); } elseif ( 'not_equal' == $operator ) { $match = ($compare_value != $value); } return $match; } } endif; AWL_BB::instance();