Skip to content

Commit 53ed721

Browse files
committed
add compare to macro
1 parent aeeaef2 commit 53ed721

2 files changed

Lines changed: 22 additions & 3 deletions

File tree

admin-pages/custom-css-usage.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ function render_custom_css_usage_page() {
2828

2929
<?php
3030

31+
echo '<p>' . __('Total Lines in Site Settings Custom CSS: ', 'solid-dynamics') . $site_settings_custom_css_line_count . '</p>';
32+
3133
if (empty($results)) {
32-
echo '<p>' . __('No posts contain custom css', 'solid-dynamics') . '.</p>';
34+
echo '<p>' . __('No posts contain custom css.', 'solid-dynamics') . '.</p>';
3335
return;
3436
}
3537

36-
echo '<p>' . __('Total Lines in Site Settings Custom CSS: ', 'solid-dynamics') . $site_settings_custom_css_line_count . '</p>';
3738
echo '<h2>' . __('Posts', 'solid-dynamics') . ':</h2>';
3839
echo '<table class="widefat fixed" cellspacing="0">';
3940
echo '<thead><tr><th>ID</th><th>' . __('Title', 'solid-dynamics') . '</th><th>' . __('Post Type', 'solid-dynamics') . '</th><th>' . __('Status', 'solid-dynamics') . '</th><th>' . __('Widgets', 'solid-dynamics') . '</th></tr></thead>';

classes/display-condition-solid-dynamics-macro.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ public function get_group() {
1717

1818
public function check( $args ) : bool {
1919
$value = solid_dynamics_macro($args['macro']);
20-
return boolval($value);
20+
21+
if (($args['compare'] ?? '') === 'true') {
22+
return boolval($value);
23+
} else {
24+
return ! boolval($value);
25+
}
2126
}
2227

2328
public function get_options() {
@@ -28,6 +33,19 @@ public function get_options() {
2833
'type' => \Elementor\Controls_Manager::TEXT,
2934
]
3035
);
36+
$this->add_control(
37+
'compare',
38+
[
39+
'label' => __( 'Compare', 'solid-dynamics' ),
40+
'type' => \Elementor\Controls_Manager::SELECT,
41+
'default' => 'true',
42+
'options' => [
43+
'true' => __( 'Is True', 'solid-dynamics' ),
44+
'false' => __( 'Is False', 'solid-dynamics' ),
45+
// TODO: add other options, equal, not equal, etc.
46+
],
47+
]
48+
);
3149
}
3250
}
3351

0 commit comments

Comments
 (0)