wpseek.com
Uma área de pesquisa sobre o WordPress para devs e autores do tema



block_core_image_get_lightbox_settings › WordPress Function

Desden/a
Obsoleton/a
block_core_image_get_lightbox_settings ( $block )
Parâmetros:
  • (array) $block Block data.
    Required: Yes
Retorna:
  • (array) Filtered block data.
Definido em:
Codex:

Adds the lightboxEnabled flag to the block data.

This is used to determine whether the lightbox should be rendered or not.


Fonte

function block_core_image_get_lightbox_settings( $block ) {
	// Gets the lightbox setting from the block attributes.
	if ( isset( $block['attrs']['lightbox'] ) ) {
		$lightbox_settings = $block['attrs']['lightbox'];
	}

	if ( ! isset( $lightbox_settings ) ) {
		$lightbox_settings = wp_get_global_settings( array( 'lightbox' ), array( 'block_name' => 'core/image' ) );

		// If not present in global settings, check the top-level global settings.
		//
		// NOTE: If no block-level settings are found, the previous call to
		// `wp_get_global_settings` will return the whole `theme.json` structure in
		// which case we can check if the "lightbox" key is present at the top-level
		// of the global settings and use its value.
		if ( isset( $lightbox_settings['lightbox'] ) ) {
			$lightbox_settings = wp_get_global_settings( array( 'lightbox' ) );
		}
	}

	return $lightbox_settings ?? null;
}