MP_Settings::fonts( array $args )

Callback fonts function.


Parameters Parameters

$args

(array) (Required) array of arguments


Top ↑

Source Source

File: mortgage-platform/Inc/Base/MP_Settings.php

	public function fonts( $args ) {
		$google_fonts = $this->get_google_fonts();
		$name         = $args['label_for'];
		$option_name  = $args['option_name'];
		$input        = get_option( $option_name );
		$default      = $args['default'];
		$value        = ! empty( $input[ $name ] ) ? $input[ $name ] : $default;
		$description  = $args['description'];

		echo '<select style="float:left;margin-right:30px; width: 50%;" name="' . esc_attr( $option_name ) . '[' . esc_attr( $name ) . ']" id="' . esc_attr( $name ) . '">';
		foreach ( $google_fonts as $key => $font ) {
			$selected = '';
			if ( '' !== $value ) {
				if ( $value === $key ) {
					$selected = ' selected="selected"';
				}
			}
			echo '<option ' . esc_attr( $selected ) . ' value="' . esc_attr( $key ) . '">' . esc_attr( $font ) . '</option>';
		}

		echo '</select>';
		echo '<p id="font-example" style="font-size:30px; line-height:1;margin:0;padding:0; font-family:'.$google_fonts[$value].'">' . esc_attr( $google_fonts[$value] ) . '</p>';


		echo '<p>' . esc_attr( $description ) . '</p>';
	}

Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.