fix event category mapping when so categories are present

This commit is contained in:
André Menrath 2024-09-10 18:48:02 +02:00
parent ef858c91e0
commit df04913ba1
2 changed files with 5 additions and 0 deletions

View file

@ -73,6 +73,9 @@ class Settings {
* @param array $event_category_mappings The settings value.
*/
public static function sanitize_event_category_mappings( $event_category_mappings ) {
if ( empty( $event_category_mappings ) ) {
return array();
}
foreach ( $event_category_mappings as $taxonomy_slug => $event_category ) {
if ( ! self::is_allowed_event_category( $event_category ) ) {
unset( $event_category_mappings[ $taxonomy_slug ] );

View file

@ -93,6 +93,7 @@ $current_category_mapping = \get_option( 'activitypub_event_extensions_ev
</table>
</div>
<?php if( ! empty( $event_terms ) ) : ?>
<div class="box">
<h2> <?php esc_html_e( 'Advanced Event Category Settings', 'activitypub-event-extensions' ); ?> </h2>
<p> <?php esc_html_e( 'Take more control by adjusting how your event categories are mapped to the basic category set used in ActivityPub. This option lets you override the default selection above, ensuring more accurate categorization and better visibility for your events.' ); ?> </p>
@ -128,6 +129,7 @@ $current_category_mapping = \get_option( 'activitypub_event_extensions_ev
<?php } ?>
</table>
</div>
<?php endif; ?>
<?php \submit_button(); ?>
</form>
</div>