classes/Tools/Imgix/ImgixTool.php
private function buildPresetsUI($image_id, $size) {
		$presets = get_option('ilab-imgix-presets');
		if(!$presets) {
			$presets = [];
		}

		$sizePresets = get_option('ilab-imgix-size-presets');
		if(!$sizePresets) {
			$sizePresets = [];
		}

		$presetsUI = [];
		foreach($presets as $pkey => $pinfo) {
			$default_for = '';
			foreach($sizePresets as $psize => $psizePreset) {
				if($psizePreset == $pkey) {
					$default_for = $psize;
					break;
				}
			}

			$psettings = $pinfo['settings'];
			foreach($this->paramPropsByType['media-chooser'] as $mkey => $minfo) {
				if(isset($psettings[$mkey])) {
					if(!empty($psettings[$mkey])) {
						$psettings[$mkey.'_url'] = wp_get_attachment_url($psettings[$mkey]);
					}
				}
			}

			$presetsUI[$pkey] = [
				'title' => $pinfo['title'],
				'default_for' => $default_for,
				'settings' => $psettings
			];
		}

		return $presetsUI;
	}
private function buildPresetsUI($image_id, $size) {
		$presets = get_option('ilab-imgix-presets');
		if(!$presets) {
			$presets = [];
		}

		$sizePresets = get_option('ilab-imgix-size-presets');
		if(!$sizePresets) {
			$sizePresets = [];
		}

		$presetsUI = [];
		foreach($presets as $pkey => $pinfo) {
			$default_for = '';
			foreach($sizePresets as $psize => $psizePreset) {
				if($psizePreset == $pkey) {
					$default_for = $psize;
					break;
				}
			}

			$psettings = $pinfo['settings'];
			foreach($this->paramPropsByType['media-chooser'] as $mkey => $minfo) {
				if(isset($psettings[$mkey])) {
					if(!empty($psettings[$mkey])) {
						$psettings[$mkey.'_url'] = wp_get_attachment_url($psettings[$mkey]);
					}
				}
			}

			$presetsUI[$pkey] = [
				'title' => $pinfo['title'],
				'default_for' => $default_for,
				'settings' => $psettings
			];
		}

		return $presetsUI;
	}
private function buildPresetsUI ( $ image_id , $ size ) { $ presets = get_option ( 'ilab-imgix-presets' ) ; if ( ! $ presets ) { $ presets = [ ] ; } $ sizePresets = get_option ( 'ilab-imgix-size-presets' ) ; if ( ! $ sizePresets ) { $ sizePresets = [ ] ; } $ presetsUI = [ ] ; foreach ( $ presets as $ pkey => $ pinfo ) { $ default_for = '' ; foreach ( $ sizePresets as $ psize => $ psizePreset ) { if ( $ psizePreset == $ pkey ) { $ default_for = $ psize ; break ; } } $ psettings = $ pinfo [ 'settings' ] ; foreach ( $ this -> paramPropsByType [ 'media-chooser' ] as $ mkey => $ minfo ) { if ( isset ( $ psettings [ $ mkey ] ) ) { if ( ! empty ( $ psettings [ $ mkey ] ) ) { $ psettings [ $ mkey . '_url' ] = wp_get_attachment_url ( $ psettings [ $ mkey ] ) ; } } } $ presetsUI [ $ pkey ] = [ 'title' => $ pinfo [ 'title' ] , 'default_for' => $ default_for , 'settings' => $ psettings ] ; } return $ presetsUI ; }
Builds the presets UI

@param int $image_id
@param string $size

@return array
Builds the presets UI