Blocks::tribe_blocks_editor_update_classic_content_params( array|string $params, string $slug, WP_Post $post )
Migrates additional fields parameters to blocks.
Contents
This function checks if the given slug matches a specific condition and updates the parameters accordingly.
Parameters
- $params
-
(array|string) (Required) The original parameter.
- $slug
-
(string) (Required) The slug to check against.
- $post
-
(WP_Post) (Required) The post object to extract the ID from.
Return
(mixed) Modified or original parameters.
Source
File: src/Events_Community/Block_Conversion/Blocks.php
public function tribe_blocks_editor_update_classic_content_params( $params, string $slug, WP_Post $post ) {
if ( ! $this->is_community_event_post( $post ) ) {
return $params;
}
switch ( $slug ) {
case 'tribe/event-venue':
$value = (int) tribe_get_venue_id( $post->ID );
if ( $value > 0 ) {
$params = [ 'venue' => $value ];
}
break;
case 'tribe/event-organizer':
$value = (int) tribe_get_organizer_id( $post->ID );
if ( $value > 0 ) {
$params = [ 'organizer' => $value ];
}
break;
case 'tribe/event-website':
$value = tribe_get_event_website_link( $post->ID );
if ( ! empty( $value ) ) {
$params = [ 'urlLabel' => __( 'External Link:', 'tribe-events-community' ) ];
}
break;
}
return $params;
}
Changelog
| Version | Description |
|---|---|
| 4.10.17 | Introduced. |