File tree Expand file tree Collapse file tree 1 file changed +29
-2
lines changed
Expand file tree Collapse file tree 1 file changed +29
-2
lines changed Original file line number Diff line number Diff line change 1010
1111namespace Tutor \Components ;
1212
13- use Tutor \Components \Constants \Size ;
1413use TUTOR \Icon ;
1514use TUTOR \Input ;
15+ use Tutor \Components \Constants \Size ;
1616
1717if ( ! defined ( 'ABSPATH ' ) ) {
1818 exit ;
@@ -91,7 +91,8 @@ class DateFilter extends BaseComponent {
9191 */
9292 protected $ icon_class ;
9393
94- /* Button size.
94+ /**
95+ * Button size.
9596 *
9697 * @var string
9798 */
@@ -104,6 +105,15 @@ class DateFilter extends BaseComponent {
104105 */
105106 protected $ icon_size = 20 ;
106107
108+ /**
109+ * Whether to display the label text.
110+ *
111+ * @since 4.0.0
112+ *
113+ * @var bool
114+ */
115+ protected $ show_label = true ;
116+
107117 /**
108118 * Set filter type.
109119 *
@@ -185,6 +195,19 @@ public function icon_class( string $icon_class ): self {
185195 return $ this ;
186196 }
187197
198+ /**
199+ * Enable or disable the display of the label text.
200+ *
201+ * @since 4.0.0
202+ *
203+ * @param bool $show_label True to show the label, false to hide it.
204+ * @return $this
205+ */
206+ public function show_label ( bool $ show_label ) {
207+ $ this ->show_label = $ show_label ;
208+ return $ this ;
209+ }
210+
188211 /**
189212 * Render the component.
190213 *
@@ -292,6 +315,10 @@ protected function calculate_label(): string {
292315 return Input::get ( 'date ' , '' );
293316 }
294317
318+ if ( ! $ this ->show_label ) {
319+ return '' ;
320+ }
321+
295322 $ start_date = Input::get ( 'start_date ' );
296323 $ end_date = Input::get ( ( 'end_date ' ) );
297324
You can’t perform that action at this time.
0 commit comments