Skip to content

Commit

Permalink
Merge pull request #234 from helsingborg-stad/fix/missing-view-paths
Browse files Browse the repository at this point in the history
Fix missing view paths
  • Loading branch information
thorbrink authored Feb 27, 2024
2 parents 8193d32 + b1922bf commit 48696d8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions source/php/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,23 @@ public function __construct()
add_action('widgets_init', function () {
register_widget('EventManagerIntegration\Widget\DisplayEvents');
});

// Add view paths
add_action('template_redirect', function () {
if (get_post_type() === 'event') {
add_filter('Municipio/viewPaths', array($this, 'addViewPaths'), 2, 1);
}
}, 10);
}

/**
* Add searchable blade template paths
* @param array $array Template paths
* @return array Modified template paths
*/
public function addViewPaths($array)
{
return array_merge( [EVENTMANAGERINTEGRATION_VIEW_PATH], $array );
}

/**
Expand Down
2 changes: 1 addition & 1 deletion source/php/PostTypes/Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public function singleViewData($data)
];

$data['eventLang'] = (object) array(
'accessibilityLabels' => array_filter($accessibilityLabels, fn($key) => in_array($key, $locationInfo['accessibility']), ARRAY_FILTER_USE_KEY),
'accessibilityLabels' => array_filter($accessibilityLabels, fn($key) => in_array($key, $locationInfo['accessibility'] ?? []), ARRAY_FILTER_USE_KEY),
'link' => __('Event link', 'event-integration'),
'ticket' => __('Ticket', 'event-integration'),
'goToEventWebsite' => __('Go to event website', 'event-integration'),
Expand Down

0 comments on commit 48696d8

Please sign in to comment.