# suredonation/1.2.0/inc/blocks/dropdown/block.php

SureDonation – Donation Forms, Fundraising Campaigns &amp; Donor Management, version 1.2.0. 52 lines.

- Page: https://pluginprobe.com/plugins/suredonation/1.2.0/code/inc/blocks/dropdown/block.php
- Raw: https://pluginprobe.com/plugins/suredonation/1.2.0/raw/inc/blocks/dropdown/block.php
- Modified: 2026-07-09T11:38:14+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/suredonation/1.2.0/code/inc/blocks/dropdown/block.php#L10-L20`.

```php
<?php
/**
 * PHP render for Dropdown Block.
 *
 * @package SureDonation
 * @since 1.1.1
 */

namespace SureDonation\Inc\Blocks\Dropdown;

use SureDonation\Inc\Blocks\Base;
use SureDonation\Inc\Fields\Dropdown_Markup;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

/**
 * Dropdown Block.
 *
 * @since 1.1.1
 */
class Block extends Base {
	/**
	 * Render the block.
	 *
	 * @param array<string, mixed> $attributes Block attributes.
	 * @param string               $content    Block content.
	 * @return string
	 * @since 1.1.1
	 */
	public function render( $attributes, $content = '' ) {
		unset( $content ); // Unused parameter.

		if ( empty( $attributes ) ) {
			return '';
		}

		// Load tom-select and the dropdown initializer only when a dropdown is on
		// the page. suredonation-dropdown declares tom-select as a dependency, so
		// enqueuing it pulls the library in too, in the right order.
		wp_enqueue_style( 'suredonation-tom-select' );
		wp_enqueue_script( 'suredonation-dropdown' );

		$markup_class = new Dropdown_Markup( $attributes );
		ob_start();
		echo wp_kses( $markup_class->markup(), self::get_allowed_form_html() );
		$output = ob_get_clean();
		return false !== $output ? $output : '';
	}
}

```
