HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: /var/www/html/bwcsports-site/wp-content/plugins/quiz-master-next/blocks/src/question/index.js
import { registerBlockType } from '@wordpress/blocks';
import Edit from './edit';
import metadata from './block.json';
import { questionBlockIcon } from "../component/icon";

registerBlockType( metadata.name, {
	icon:questionBlockIcon,
	/**
	 * @see ./edit.js
	 */
	edit: Edit,
	__experimentalLabel( attributes, { context } ) {
		const { title } = attributes;

		const customName = attributes?.metadata?.name;
		const hasContent = title?.length > 0;

		// In the list view, use the question title as the label.
		// If the title is empty, fall back to the default label.
		if ( context === 'list-view' && ( customName || hasContent ) ) {
			return customName || title;
		}
	},
} );