1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
<?php
namespace SIW\Widgets;
use SIW\Elements;
use SIW\Formatting;
use SIW\Properties;
use SIW\HTML;
class Contact extends Widget {
protected $widget_id = 'contact';
protected $widget_dashicon = 'phone';
protected function set_widget_properties() {
$this->widget_name = __( 'Contactinformatie', 'siw');
$this->widget_description = __( 'Toont contactinformatie', 'siw' );
}
public function get_widget_form() {
$widget_forms = [
'title' => [
'type' => 'text',
'label' => __( 'Titel', 'siw'),
'default' => __( 'Contact', 'siw' ),
],
];
return $widget_forms;
}
public function get_content( array $instance, array $args, array $template_vars, string $css_name ) {
ob_start();
?>
<div class="siw-contact">
<?php
echo wpautop( Formatting::array_to_text(
[
Properties::NAME,
sprintf( '%s | %s %s', Properties::ADDRESS, Properties::POSTCODE, Properties::CITY ),
sprintf( '%s | %s',
HTML::generate_link( "tel:" . Properties::PHONE_INTERNATIONAL, Properties::PHONE ),
HTML::generate_link( "mailto:" . antispambot( Properties::EMAIL ), antispambot( Properties::EMAIL ) )
),
Elements::generate_opening_hours('table'),
],
BR2
)
);
?>
</div>
<div class="siw-social-links clearfix">
<?php
$social_networks = siw_get_social_networks( 'follow' );
foreach ( $social_networks as $network ) {
echo HTML::generate_link(
$network->get_follow_url(),
'­',
[
'class' => $network->get_slug(),
'title' => $network->get_name(),
'target' => '_blank',
'rel' => 'noopener external',
'aria-label' => sprintf( esc_attr__( 'Volg ons op %s', 'siw' ), $network->get_name() ),
'data-balloon-pos' => 'up',
'data-original-title' => $network->get_name(),
'style' => '--hover-color: ' . $network->get_color(),
],
[
'class' => $network->get_icon_class(),
'size' => 2,
'background' => 'circle'
]
);
}
?>
</div>
<?php
$html_content = ob_get_clean();
return $html_content;
}
}