@@ -158,6 +158,9 @@ protected function _renderManualConfigExample() {
158
158
* @access protected
159
159
*/
160
160
protected function _renderAdvancedSettings () {
161
+ // Chart control settings.
162
+ $ this ->_renderChartControlsGroup ();
163
+
161
164
if ( Visualizer_Module_Admin::proFeaturesLocked () ) {
162
165
self ::_renderGroupStart ( esc_html__ ( 'Frontend Actions ' , 'visualizer ' ) );
163
166
} else {
@@ -345,14 +348,15 @@ protected static function _renderColorPickerItem( $title, $name, $value, $defaul
345
348
* @param string $type The type for the input (out of number, email, tel etc., default is text).
346
349
* @param array $custom_attributes The custom attributes.
347
350
*/
348
- protected static function _renderTextItem ( $ title , $ name , $ value , $ desc , $ placeholder = '' , $ type = 'text ' , $ custom_attributes = array () ) {
351
+ protected static function _renderTextItem ( $ title , $ name , $ value , $ desc , $ placeholder = '' , $ type = 'text ' , $ custom_attributes = array (), $ extra_class = array () ) {
349
352
$ attributes = '' ;
350
353
if ( $ custom_attributes ) {
351
354
foreach ( $ custom_attributes as $ k => $ v ) {
352
355
$ attributes .= ' ' . $ k . '=" ' . esc_attr ( $ v ) . '" ' ;
353
356
}
354
357
}
355
- echo '<div class="viz-section-item"> ' ;
358
+ $ extra_class [] = 'viz-section-item ' ;
359
+ echo '<div class=" ' . esc_attr ( implode ( ' ' , $ extra_class ) ) . '"> ' ;
356
360
echo '<a class="more-info" href="javascript:;">[?]</a> ' ;
357
361
echo '<b> ' , $ title , '</b> ' ;
358
362
echo '<input type=" ' , $ type , '" class="control-text" ' , $ attributes , ' name=" ' , $ name , '" value=" ' , esc_attr ( $ value ), '" placeholder=" ' , $ placeholder , '"> ' ;
@@ -567,4 +571,236 @@ protected function _renderChartImageSettings() {
567
571
);
568
572
self ::_renderSectionEnd ();
569
573
}
574
+
575
+ /**
576
+ * Renders chart controls group.
577
+ *
578
+ * @access protected
579
+ */
580
+ protected function _renderChartControlsGroup () {
581
+ if ( 'google ' !== $ this ->getLibrary () ) {
582
+ return ;
583
+ }
584
+ if ( Visualizer_Module_Admin::proFeaturesLocked () ) {
585
+ self ::_renderGroupStart ( esc_html__ ( 'Chart Data Filter Configuration ' , 'visualizer ' ) );
586
+ } else {
587
+ self ::_renderGroupStart ( esc_html__ ( 'Chart Data Filter Configuration ' , 'visualizer ' ) . '<span class="dashicons dashicons-lock"></span> ' , '' , apply_filters ( 'visualizer_pro_upsell_class ' , 'only-pro-feature ' , 'chart-filter-controls ' ), 'vz-data-controls ' );
588
+ echo '<div style="position: relative"> ' ;
589
+ }
590
+ self ::_renderSectionStart ();
591
+ self ::_renderSectionDescription ( '<span class="viz-gvlink"> ' . sprintf ( __ ( 'Configure the data filter controls by providing configuration variables right from the %1$sChart Controls API%2$s. ' , 'visualizer ' ), '<a href="https://developers.google.com/chart/interactive/docs/gallery/controls#controls-gallery" target="_blank"> ' , '</a> ' ) . '</span> ' );
592
+ self ::_renderSectionEnd ();
593
+ $ this ->_renderChartControlsSettings ();
594
+ if ( ! Visualizer_Module_Admin::proFeaturesLocked () ) {
595
+ echo apply_filters ( 'visualizer_pro_upsell ' , '' , 'chart-permissions ' );
596
+ echo '</div> ' ;
597
+ }
598
+ self ::_renderGroupEnd ();
599
+ }
600
+
601
+ /**
602
+ * Renders chart controls setting.
603
+ *
604
+ * @access protected
605
+ */
606
+ protected function _renderChartControlsSettings () {
607
+
608
+ self ::_renderSectionStart ( esc_html__ ( 'Options ' , 'visualizer ' ), false );
609
+ $ control_type = ! empty ( $ this ->controls ['controlType ' ] ) ? $ this ->controls ['controlType ' ] : '' ;
610
+
611
+ self ::_renderSelectItem (
612
+ esc_html__ ( 'Filter Type ' , 'visualizer ' ),
613
+ 'controls[controlType] ' ,
614
+ $ control_type ,
615
+ array (
616
+ '' => '' ,
617
+ 'StringFilter ' => esc_html__ ( 'String Filter ' , 'visualizer ' ),
618
+ 'NumberRangeFilter ' => esc_html__ ( 'Number Range Filter ' , 'visualizer ' ),
619
+ 'CategoryFilter ' => esc_html__ ( 'Category Filter ' , 'visualizer ' ),
620
+ 'ChartRangeFilter ' => esc_html__ ( 'Chart Range Filter ' , 'visualizer ' ),
621
+ 'DateRangeFilter ' => esc_html__ ( 'Date Range Filter ' , 'visualizer ' ),
622
+ ),
623
+ '' ,
624
+ false ,
625
+ array ( 'vz-controls-opt ' )
626
+ );
627
+
628
+ $ column_index = [ 'false ' => '' ];
629
+ $ column_label = [ 'false ' => '' ];
630
+ if ( ! empty ( $ this ->__series ) ) {
631
+ foreach ( $ this ->__series as $ key => $ column ) {
632
+ $ column_type = isset ( $ column ['type ' ] ) ? $ column ['type ' ] : '' ;
633
+ $ label = isset ( $ column ['label ' ] ) ? $ column ['label ' ] : '' ;
634
+ $ column_label [ $ label ] = $ label ;
635
+ $ column_index [ $ key ] = sprintf ( __ ( '%1$d — Column Type: %2$s ' , 'visualizer ' ), $ key , ucfirst ( $ column_type ) );
636
+ }
637
+ }
638
+
639
+ self ::_renderSelectItem (
640
+ esc_html__ ( 'Filter By Column Index ' , 'visualizer ' ),
641
+ 'controls[filterColumnIndex] ' ,
642
+ isset ( $ this ->controls ['filterColumnIndex ' ] ) ? $ this ->controls ['filterColumnIndex ' ] : '' ,
643
+ $ column_index ,
644
+ '' ,
645
+ false ,
646
+ array ( 'vz-controls-opt ' )
647
+ );
648
+
649
+ self ::_renderSelectItem (
650
+ esc_html__ ( 'Filter By Column Label ' , 'visualizer ' ),
651
+ 'controls[filterColumnLabel] ' ,
652
+ ! empty ( $ this ->controls ['filterColumnLabel ' ] ) ? $ this ->controls ['filterColumnLabel ' ] : '' ,
653
+ $ column_label ,
654
+ '' ,
655
+ false ,
656
+ array ( 'vz-controls-opt ' )
657
+ );
658
+
659
+ self ::_renderSelectItem (
660
+ esc_html__ ( 'Use Formatted Value ' , 'visualizer ' ),
661
+ 'controls[useFormattedValue] ' ,
662
+ ! empty ( $ this ->controls ['useFormattedValue ' ] ) ? $ this ->controls ['useFormattedValue ' ] : '' ,
663
+ array (
664
+ 'false ' => esc_html__ ( 'False ' , 'visualizer ' ),
665
+ 'true ' => esc_html__ ( 'True ' , 'visualizer ' ),
666
+ ),
667
+ '' ,
668
+ false
669
+ );
670
+
671
+ self ::_renderTextItem (
672
+ esc_html__ ( 'Min Value ' , 'visualizer ' ),
673
+ 'controls[minValue] ' ,
674
+ ! empty ( $ this ->controls ['minValue ' ] ) ? $ this ->controls ['minValue ' ] : '' ,
675
+ esc_html__ ( 'Minimum allowed value for the range lower extent. ' , 'visualizer ' ),
676
+ '' ,
677
+ 'text '
678
+ );
679
+
680
+ self ::_renderTextItem (
681
+ esc_html__ ( 'Max Value ' , 'visualizer ' ),
682
+ 'controls[maxValue] ' ,
683
+ ! empty ( $ this ->controls ['maxValue ' ] ) ? $ this ->controls ['maxValue ' ] : '' ,
684
+ esc_html__ ( 'Maximum allowed value for the range higher extent. ' , 'visualizer ' ),
685
+ '' ,
686
+ 'text '
687
+ );
688
+
689
+ self ::_renderSelectItem (
690
+ esc_html__ ( 'Match Type ' , 'visualizer ' ),
691
+ 'controls[matchType] ' ,
692
+ ! empty ( $ this ->controls ['matchType ' ] ) ? $ this ->controls ['matchType ' ] : '' ,
693
+ array (
694
+ 'prefix ' => esc_html__ ( 'Prefix ' , 'visualizer ' ),
695
+ 'exact ' => esc_html__ ( 'Exact ' , 'visualizer ' ),
696
+ 'any ' => esc_html__ ( 'Any ' , 'visualizer ' ),
697
+ ),
698
+ '' ,
699
+ false
700
+ );
701
+
702
+ self ::_renderSelectItem (
703
+ esc_html__ ( 'Case Sensitive ' , 'visualizer ' ),
704
+ 'controls[caseSensitive] ' ,
705
+ ! empty ( $ this ->controls ['caseSensitive ' ] ) ? $ this ->controls ['caseSensitive ' ] : '' ,
706
+ array (
707
+ 'false ' => esc_html__ ( 'False ' , 'visualizer ' ),
708
+ 'true ' => esc_html__ ( 'True ' , 'visualizer ' ),
709
+ ),
710
+ '' ,
711
+ false
712
+ );
713
+
714
+ self ::_renderSectionEnd ();
715
+
716
+ self ::_renderSectionStart ( esc_html__ ( 'UI Options ' , 'visualizer ' ), false );
717
+
718
+ self ::_renderTextItem (
719
+ esc_html__ ( 'Label ' , 'visualizer ' ),
720
+ 'controls[ui][label] ' ,
721
+ ! empty ( $ this ->controls ['ui ' ]['label ' ] ) ? $ this ->controls ['ui ' ]['label ' ] : '' ,
722
+ '' ,
723
+ '' ,
724
+ 'text '
725
+ );
726
+
727
+ self ::_renderTextItem (
728
+ esc_html__ ( 'Label Separator ' , 'visualizer ' ),
729
+ 'controls[ui][labelSeparator] ' ,
730
+ ! empty ( $ this ->controls ['ui ' ]['labelSeparator ' ] ) ? $ this ->controls ['ui ' ]['labelSeparator ' ] : '' ,
731
+ '' ,
732
+ '' ,
733
+ 'text '
734
+ );
735
+
736
+ self ::_renderTextItem (
737
+ esc_html__ ( 'Caption ' , 'visualizer ' ),
738
+ 'controls[ui][caption] ' ,
739
+ ! empty ( $ this ->controls ['ui ' ]['caption ' ] ) ? $ this ->controls ['ui ' ]['caption ' ] : '' ,
740
+ '' ,
741
+ '' ,
742
+ 'text '
743
+ );
744
+
745
+ self ::_renderSelectItem (
746
+ esc_html__ ( 'Label Stacking ' , 'visualizer ' ),
747
+ 'controls[ui][labelStacking] ' ,
748
+ ! empty ( $ this ->controls ['ui ' ]['labelStacking ' ] ) ? $ this ->controls ['ui ' ]['labelStacking ' ] : '' ,
749
+ array (
750
+ 'horizontal ' => esc_html__ ( 'Horizontal ' , 'visualizer ' ),
751
+ 'vertical ' => esc_html__ ( 'Vertical ' , 'visualizer ' ),
752
+ ),
753
+ '' ,
754
+ false
755
+ );
756
+
757
+ self ::_renderSelectItem (
758
+ esc_html__ ( 'Orientation ' , 'visualizer ' ),
759
+ 'controls[ui][orientation] ' ,
760
+ ! empty ( $ this ->controls ['ui ' ]['orientation ' ] ) ? $ this ->controls ['ui ' ]['orientation ' ] : '' ,
761
+ array (
762
+ 'horizontal ' => esc_html__ ( 'Horizontal ' , 'visualizer ' ),
763
+ 'vertical ' => esc_html__ ( 'Vertical ' , 'visualizer ' ),
764
+ ),
765
+ '' ,
766
+ false
767
+ );
768
+
769
+ self ::_renderSelectItem (
770
+ esc_html__ ( 'Show Range Values ' , 'visualizer ' ),
771
+ 'controls[showRangeValues] ' ,
772
+ ! empty ( $ this ->controls ['showRangeValues ' ] ) ? $ this ->controls ['showRangeValues ' ] : '' ,
773
+ array (
774
+ 'true ' => esc_html__ ( 'True ' , 'visualizer ' ),
775
+ 'false ' => esc_html__ ( 'False ' , 'visualizer ' ),
776
+ ),
777
+ '' ,
778
+ false
779
+ );
780
+
781
+ self ::_renderSelectItem (
782
+ esc_html__ ( 'Allow Multiple ' , 'visualizer ' ),
783
+ 'controls[allowMultiple] ' ,
784
+ ! empty ( $ this ->controls ['allowMultiple ' ] ) ? $ this ->controls ['allowMultiple ' ] : '' ,
785
+ array (
786
+ 'true ' => esc_html__ ( 'True ' , 'visualizer ' ),
787
+ 'false ' => esc_html__ ( 'False ' , 'visualizer ' ),
788
+ ),
789
+ '' ,
790
+ false
791
+ );
792
+
793
+ self ::_renderSelectItem (
794
+ esc_html__ ( 'Allow Typing ' , 'visualizer ' ),
795
+ 'controls[allowTyping] ' ,
796
+ ! empty ( $ this ->controls ['allowTyping ' ] ) ? $ this ->controls ['allowTyping ' ] : '' ,
797
+ array (
798
+ 'true ' => esc_html__ ( 'True ' , 'visualizer ' ),
799
+ 'false ' => esc_html__ ( 'False ' , 'visualizer ' ),
800
+ ),
801
+ '' ,
802
+ false
803
+ );
804
+ self ::_renderSectionEnd ();
805
+ }
570
806
}
0 commit comments