Skip to content

Commit

Permalink
font color, font style, title alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
m1ga committed Oct 22, 2021
1 parent 4d69547 commit b28635e
Show file tree
Hide file tree
Showing 6 changed files with 165 additions and 35 deletions.
20 changes: 17 additions & 3 deletions widgets/EventContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,24 @@ protected function _register_controls()
\Elementor\Group_Control_Typography::get_type(),
[
'name' => 'content_typography',
'label' => __('Typography', 'plugin-domain'),
'label' => __('Typography', 'mec_lite_dp'),
'selector' => '{{WRAPPER}} .event__content',
]
);
$this->add_control(
'event_content_color',
[
'label' => __('Title Color', 'mec_lite_dp'),
'type' => \Elementor\Controls_Manager::COLOR,
'scheme' => [
'type' => \Elementor\Scheme_Color::get_type(),
'value' => \Elementor\Scheme_Color::COLOR_1,
],
'selectors' => [
'{{WRAPPER}} .event__content' => 'color: {{VALUE}}',
],
]
);
$this->end_controls_section();
}

Expand All @@ -48,9 +62,9 @@ protected function render()
$query = get_posts($args);
$id = $query[0]->ID;
if (!empty(get_post_field("post_content", $id))) {
echo '<div class="event__content"><p>'.get_post_field("post_content", $id).'</p></div>';
echo '<div class="event__content"><p style="color: ' . $settings['event_content_color'] . '">'.get_post_field("post_content", $id).'</p></div>';
} elseif (\Elementor\Plugin::$instance->editor->is_edit_mode()) {
echo '<div class="event__content"><p><i>no content - the event detail text will be visible here</i></p></div>';
echo '<div class="event__content" ><p style="color: ' . $settings['event_content_color'] . '"><i>no content - the event detail text will be visible here</i></p></div>';
}
}

Expand Down
76 changes: 53 additions & 23 deletions widgets/EventDateControls.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
$this->add_control(
'show_date',
[
'label' => __('Show date', 'mec_lite_dp'),
'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __('Show', 'mec_lite_dp'),
'label_off' => __('Hide', 'mec_lite_dp'),
'return_value' => 'yes',
'default' => 'yes',
]
'label' => __('Show date', 'mec_lite_dp'),
'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __('Show', 'mec_lite_dp'),
'label_off' => __('Hide', 'mec_lite_dp'),
'return_value' => 'yes',
'default' => 'yes',
]
);

$this->add_control(
Expand All @@ -32,13 +32,13 @@
$this->add_control(
'show_time',
[
'label' => __('Show time', 'mec_lite_dp'),
'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __('Show', 'mec_lite_dp'),
'label_off' => __('Hide', 'mec_lite_dp'),
'return_value' => 'yes',
'default' => 'yes',
]
'label' => __('Show time', 'mec_lite_dp'),
'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __('Show', 'mec_lite_dp'),
'label_off' => __('Hide', 'mec_lite_dp'),
'return_value' => 'yes',
'default' => 'yes',
]
);
$this->add_control(
'time_format',
Expand All @@ -52,13 +52,13 @@
$this->add_control(
'show_allday',
[
'label' => __('Show all-day text', 'mec_lite_dp'),
'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __('Show', 'mec_lite_dp'),
'label_off' => __('Hide', 'mec_lite_dp'),
'return_value' => 'yes',
'default' => 'yes',
]
'label' => __('Show all-day text', 'mec_lite_dp'),
'type' => \Elementor\Controls_Manager::SWITCHER,
'label_on' => __('Show', 'mec_lite_dp'),
'label_off' => __('Hide', 'mec_lite_dp'),
'return_value' => 'yes',
'default' => 'yes',
]
);
$this->add_control(
'allday_text',
Expand All @@ -84,7 +84,7 @@
\Elementor\Group_Control_Typography::get_type(),
[
'name' => 'date_typography',
'label' => __('Date typography', 'plugin-domain'),
'label' => __('Date typography', 'mec_lite_dp'),
'selector' => '{{WRAPPER}} .event__date',
]
);
Expand All @@ -93,9 +93,39 @@
\Elementor\Group_Control_Typography::get_type(),
[
'name' => 'time_typography',
'label' => __('Time typography', 'plugin-domain'),
'label' => __('Time typography', 'mec_lite_dp'),
'selector' => '{{WRAPPER}} .event__time',
]
);

$this->add_control(
'event_date_color',
[
'label' => __('Title Color', 'mec_lite_dp'),
'type' => \Elementor\Controls_Manager::COLOR,
'scheme' => [
'type' => \Elementor\Scheme_Color::get_type(),
'value' => \Elementor\Scheme_Color::COLOR_1,
],
'selectors' => [
'{{WRAPPER}} .event__datetime' => 'color: {{VALUE}}',
],
]
);

$this->add_control(
'event_time_color',
[
'label' => __('Title Color', 'mec_lite_dp'),
'type' => \Elementor\Controls_Manager::COLOR,
'scheme' => [
'type' => \Elementor\Scheme_Color::get_type(),
'value' => \Elementor\Scheme_Color::COLOR_1,
],
'selectors' => [
'{{WRAPPER}} .event__time' => 'color: {{VALUE}}',
],
]
);

$this->end_controls_section();
6 changes: 3 additions & 3 deletions widgets/EventDateRender.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@

echo '<div class="event__datetime">';
if ($settings["show_date"]) {
echo '<time class="event__date" datetime="'.$formatedDate. ' ' . $formatedTime.'">'. $formatedDate .'</time>';
echo '<time class="event__date" datetime="'.$formatedDate. ' ' . $formatedTime.'" style="color: ' . $settings['event_date_color'] . '">'. $formatedDate .'</time>';
}
if (!$allday) {
if ($settings["show_time"]) {
$seconds = get_post_meta($id, $var_get2, true);
$formatedTime = date($settings['time_format'], $seconds);
echo '<time class="event__time" datetime="'.$formatedDate. ' ' . $formatedTime.'">'. $formatedTime .'</time>';
echo '<time class="event__time" datetime="'.$formatedDate. ' ' . $formatedTime.'" style="color: ' . $settings['event_time_color'] . '">'. $formatedTime .'</time>';
}
} else {
if ($settings["show_allday"]) {
echo '<time class="event__time" datetime="'.$formatedDate.'">'. $settings['allday_text'] .'</time>';
echo '<time class="event__time" datetime="'.$formatedDate.'" style="color: ' . $settings['event_time_color'] . '">'. $settings['allday_text'] .'</time>';
}
}
echo '</div>';
33 changes: 32 additions & 1 deletion widgets/EventOrganizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,37 @@ public function get_categories()

protected function _register_controls()
{
$this->start_controls_section(
'style_section',
[
'label' => __('Style', 'mec_lite_dp'),
'tab' => \Elementor\Controls_Manager::TAB_STYLE,
]
);
$this->add_group_control(
\Elementor\Group_Control_Typography::get_type(),
[
'name' => 'content_typography',
'label' => __('Typography', 'mec_lite_dp'),
'selector' => '{{WRAPPER}} .event__organizer',
]
);

$this->add_control(
'event_organizer_color',
[
'label' => __('Title Color', 'mec_lite_dp'),
'type' => \Elementor\Controls_Manager::COLOR,
'scheme' => [
'type' => \Elementor\Scheme_Color::get_type(),
'value' => \Elementor\Scheme_Color::COLOR_1,
],
'selectors' => [
'{{WRAPPER}} .event__organizer' => 'color: {{VALUE}}',
],
]
);
$this->end_controls_section();
}

protected function render()
Expand All @@ -38,7 +69,7 @@ protected function render()
$organizer = get_term($organizerId);
$phone = get_term_meta($organizerId, "tel", true);
$mail = get_term_meta($organizerId, "mail", true);
echo '<div class="event__organizer">';
echo '<div class="event__organizer" style="color: ' . $settings['event_organizer_color'] . '">';
echo '<div class="event__organizer__name">'.$organizer->name.'</div>';
echo '<div class="event__organizer__desc">'.$organizer->description.'</div>';
echo '<div class="event__organizer__phone">'.$phone.'</div>';
Expand Down
21 changes: 18 additions & 3 deletions widgets/EventPlace.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,33 @@ protected function _register_controls()
\Elementor\Group_Control_Typography::get_type(),
[
'name' => 'locationname_typography',
'label' => __('Typography place name', 'plugin-domain'),
'label' => __('Typography place name', 'mec_lite_dp'),
'selector' => '{{WRAPPER}} .event__location__name',
]
);
$this->add_group_control(
\Elementor\Group_Control_Typography::get_type(),
[
'name' => 'locationdesc_typography',
'label' => __('Typography description', 'plugin-domain'),
'label' => __('Typography description', 'mec_lite_dp'),
'selector' => '{{WRAPPER}} .event__location__desc',
]
);

$this->add_control(
'event_place_color',
[
'label' => __('Title Color', 'mec_lite_dp'),
'type' => \Elementor\Controls_Manager::COLOR,
'scheme' => [
'type' => \Elementor\Scheme_Color::get_type(),
'value' => \Elementor\Scheme_Color::COLOR_1,
],
'selectors' => [
'{{WRAPPER}} .event__location' => 'color: {{VALUE}}',
],
]
);
$this->end_controls_section();
}

Expand All @@ -81,7 +96,7 @@ protected function render()
if ($locationId != 1) {
$location = get_term($locationId);
$address = get_term_meta($locationId, "address", true);
echo '<div class="event__location">';
echo '<div class="event__location" style="color: ' . $settings['event_place_color'] . '">';
echo '<div class="event__location__name">'.$location->name.'</div>';
echo '<div class="event__location__address">'.$address.'</div>';
if ($settings["show_desc"]) {
Expand Down
44 changes: 42 additions & 2 deletions widgets/EventTitle.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,30 @@ protected function _register_controls()
]
);

$this->add_control(
'event_title_align',
[
'label' => __('Alignment', 'mec_lite_dp'),
'type' => \Elementor\Controls_Manager::CHOOSE,
'options' => [
'left' => [
'title' => __('Left', 'mec_lite_dp'),
'icon' => 'eicon-text-align-left',
],
'center' => [
'title' => __('Center', 'mec_lite_dp'),
'icon' => 'eicon-text-align-center',
],
'right' => [
'title' => __('Right', 'mec_lite_dp'),
'icon' => 'eicon-text-align-right',
],
],
'default' => 'left',
'toggle' => true,
]
);

$this->end_controls_section();

$this->start_controls_section(
Expand All @@ -61,10 +85,26 @@ protected function _register_controls()
\Elementor\Group_Control_Typography::get_type(),
[
'name' => 'content_typography',
'label' => __('Typography', 'plugin-domain'),
'label' => __('Typography', 'mec_lite_dp'),
'selector' => '{{WRAPPER}} .event__title',
]
);

$this->add_control(
'event_title_color',
[
'label' => __('Title Color', 'mec_lite_dp'),
'type' => \Elementor\Controls_Manager::COLOR,
'scheme' => [
'type' => \Elementor\Scheme_Color::get_type(),
'value' => \Elementor\Scheme_Color::COLOR_1,
],
'selectors' => [
'{{WRAPPER}} .event__title' => 'color: {{VALUE}}',
],
]
);

$this->end_controls_section();
}

Expand All @@ -74,7 +114,7 @@ protected function render()
$args = array("post_type" => "mec-events", "name" => get_query_var("event_id"));
$query = get_posts($args);
$id = $query[0]->ID;
echo '<'.$settings['title_tag'].' class="event__title">'.get_the_title($id).'</'.$settings['title_tag'].'>';
echo '<'.$settings['title_tag'].' class="event__title" style="text-align: ' . $settings['event_title_align'] . '; color: ' . $settings['event_title_color'] . '">'.get_the_title($id).'</'.$settings['title_tag'].'>';
}

protected function _content_template()
Expand Down

0 comments on commit b28635e

Please sign in to comment.