# adminify/3.2.4.1/Libs/adminify-framework/fields/palette/palette.php

Adminify – White Label, Admin Menu Editor, Login Customizer, version 3.2.4.1. 49 lines.

- Page: https://pluginprobe.com/plugins/adminify/3.2.4.1/code/Libs/adminify-framework/fields/palette/palette.php
- Raw: https://pluginprobe.com/plugins/adminify/3.2.4.1/raw/Libs/adminify-framework/fields/palette/palette.php
- Modified: 2023-11-01T08:36:22+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/adminify/3.2.4.1/code/Libs/adminify-framework/fields/palette/palette.php#L10-L20`.

```php
<?php if ( ! defined( 'ABSPATH' ) ) {
	die; } // Cannot access directly.
/**
 *
 * Field: palette
 *
 * @since 1.0.0
 * @version 1.0.0
 */
if ( ! class_exists( 'ADMINIFY_Field_palette' ) ) {
	class ADMINIFY_Field_palette extends ADMINIFY_Fields {

		public function __construct( $field, $value = '', $unique = '', $where = '', $parent = '' ) {
			parent::__construct( $field, $value, $unique, $where, $parent );
		}

		public function render() {
			$palette = ( ! empty( $this->field['options'] ) ) ? $this->field['options'] : [];

			echo wp_kses_post( $this->field_before() );

			if ( ! empty( $palette ) ) {
				echo '<div class="adminify-siblings adminify--palettes">';

				foreach ( $palette as $key => $colors ) {
					$active  = ( $key === $this->value ) ? ' adminify--active' : '';
					$checked = ( $key === $this->value ) ? ' checked' : '';

					echo '<div class="adminify--sibling adminify--palette' . esc_attr( $active ) . '">';

					if ( ! empty( $colors ) ) {
						foreach ( $colors as $color ) {
							  echo '<span style="background-color: ' . esc_attr( $color ) . ';"></span>';
						}
					}

					echo '<input type="radio" name="' . esc_attr( $this->field_name() ) . '" value="' . esc_attr( $key ) . '"' . wp_kses_post( $this->field_attributes() ) . esc_attr( $checked ) . '/>';
					echo '</div>';
				}

				echo '</div>';
			}

			echo wp_kses_post( $this->field_after() );
		}

	}
}

```
