values(); $field['choices'] = [ '0' => __('None', 'badegg'), ]; foreach($colours as $slug => $hex): $field['choices'][$slug] = ' ' . @$NameThatColour->name($hex)['name']; endforeach; return $field; } public function load_tints( $field ) { $colour = new Utilities\Colour; $tints = $colour->tints(); $field['choices'] = []; foreach($tints as $slug => $hex): if($slug): $field['choices'][$slug] = ucfirst($slug); else: $field['choices'][0] = __('None', 'badegg'); endif; endforeach; return $field; } public function container_width( $field ) { $field['choices'] = [ 0 => 'Auto', 'narrow' => __('Narrow', 'badegg'), 'small' => __('Small', 'badegg'), 'medium' => __('Medium', 'badegg'), 'large' => __('Large', 'badegg'), 'full' => __('Edge to edge', 'badegg'), ]; return $field; } public function load_fontawesome_regular_icons( $field ) { $field['choices'] = []; $field['choices'] = $this->fontawesome_choices('regular'); return $field; } public function load_fontawesome_solid_icons( $field ) { $field['choices'] = []; $field['choices'] = $this->fontawesome_choices('solid'); return $field; } public function load_fontawesome_brand_icons( $field ) { $field['choices'] = []; $field['choices'] = $this->fontawesome_choices('brands'); return $field; } public function fontawesome_choices($set = 'solid') { $path = get_stylesheet_directory() . '/resources/json/font-awesome-' . $set . '.json'; $json = @file_get_contents($path); if(!$json) return false; $icons = json_decode($json, true); $choices = [ '0' => ' Please select an icon', ]; foreach($icons as $slug => $props): if(in_array($slug, range(0,9))) continue; $choices[$slug] = ' ' . (ucwords(str_replace('-', ' ', $slug))) . ''; endforeach; return $choices; } public function colour_ui() { ?>