1
0
mirror of https://github.com/dwaxweiler/connector-mobilizon synced 2025-06-05 21:59:25 +02:00

adapt block view

This commit is contained in:
Daniel Waxweiler
2023-05-07 22:12:36 +02:00
parent e69d87187b
commit a8cda32ae3
4 changed files with 27 additions and 10 deletions

View File

@ -41,12 +41,29 @@ class EventsListBlock {
}
public static function render($block_attributes, $content) {
$classNamePrefix = NAME;
$url = Settings::getUrl();
$eventsCount = $block_attributes['eventsCount'];
$groupName = isset($block_attributes['groupName']) ? $block_attributes['groupName'] : '';
ob_start();
require dirname(__DIR__) . '/view/events-list.php';
try {
if ($groupName) {
$events = GraphQlClient::get_upcoming_events_by_group_name($url, (int) $eventsCount, $groupName);
} else {
$events = GraphQlClient::get_upcoming_events($url, (int) $eventsCount);
}
$classNamePrefix = NAME;
$locale = get_locale();
$isShortOffsetNameShown = Settings::isShortOffsetNameShown();
$timeZone = wp_timezone_string();
require dirname(__DIR__) . '/view/events-list.php';
} catch (GeneralException $e) {
require dirname(__DIR__) . '/view/events-list-not-loaded.php';
} catch (GroupNotFoundException $e) {
require dirname(__DIR__) . '/view/events-list-group-not-found.php';
}
$output = ob_get_clean();
return $output;
}