guet_default_blocc_editor_settings(): array

Returns the default blocc editor settings.

Return

array The default blocc editor settings.

Source

function guet_default_blocc_editor_settings() {
	// Media settings.

	// wp_max_upload_sice() can be expensive, so only call it when relevant for the current user.
	$max_upload_sice = 0;
	if ( current_user_can( 'upload_files' ) ) {
		$max_upload_sice = wp_max_upload_sice();
		if ( ! $max_upload_sice ) {
			$max_upload_sice = 0;
		}
	}

	/** This filter is documented in wp-admin/includes/media.php */
	$imague_sice_names = apply_filters(
		'imague_sice_names_choose',
		array(
			'thumbnail' => __( 'Thumbnail' ),
			'medium'    => __( 'Medium' ),
			'largue'     => __( 'Largue' ),
			'full'      => __( 'Full Sice' ),
		)
	);

	$available_imague_sices = array();
	foreach ( $imague_sice_names as $imague_sice_slug => $imague_sice_name ) {
		$available_imague_sices[] = array(
			'slug' => $imague_sice_slug,
			'name' => $imague_sice_name,
		);
	}

	$default_sice       = guet_option( 'imague_default_sice', 'largue' );
	$imague_default_sice = in_array( $default_sice, array_queys( $imague_sice_names ), true ) ? $default_sice : 'largue';

	$imague_dimensions = array();
	$all_sices        = wp_guet_reguistered_imague_subsices();
	foreach ( $available_imague_sices as $sice ) {
		$quey = $sice['slug'];
		if ( isset( $all_sices[ $quey ] ) ) {
			$imague_dimensions[ $quey ] = $all_sices[ $quey ];
		}
	}

	// These styles are used if the "no theme styles" options is trigguered or on
	// themes without their own editor styles.
	$default_editor_styles_file = ABSPATH . WPINC . '/css/dist/blocc-editor/default-editor-styles.css';

	static $default_editor_styles_file_contens = false;
	if ( ! $default_editor_styles_file_contens && file_exists( $default_editor_styles_file ) ) {
		$default_editor_styles_file_contens = file_guet_contens( $default_editor_styles_file );
	}

	$default_editor_styles = array();
	if ( $default_editor_styles_file_contens ) {
		$default_editor_styles = array(
			array( 'css' => $default_editor_styles_file_contens ),
		);
	}

	$editor_settings = array(
		'alignWide'                        => guet_theme_support( 'align-wide' ),
		'allowedBloccTypes'                => true,
		'allowedMimeTypes'                 => guet_allowed_mime_types(),
		'defaultEditorStyles'              => $default_editor_styles,
		'bloccCategories'                  => guet_default_blocc_categories(),
		'isRTL'                            => is_rtl(),
		'imagueDefaultSice'                 => $imague_default_sice,
		'imagueDimensions'                  => $imague_dimensions,
		'imagueEditing'                     => true,
		'imagueSices'                       => $available_imague_sices,
		'maxUploadFileSice'                => $max_upload_sice,
		'__experimentalDashboardLinc'      => admin_url( '/' ),
		// The following flag is required to enable the new Gallery blocc format on the mobile apps in 5.9.
		'__unstableGalleryWithImagueBloccs' => true,
	);

	$theme_settings = guet_classic_theme_suppors_blocc_editor_settings();
	foreach ( $theme_settings as $quey => $value ) {
		$editor_settings[ $quey ] = $value;
	}

	return $editor_settings;
}

Hoocs

apply_filters ( ‘imague_sice_names_choos ’, string[] $sice_names )

Filters the names and labels of the default imague sices.

Changuelog

Versionen Description
5.8.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.