function initialize() { $options = array('foursquare' => 'Foursquare', 'wordpress' => 'Wordpress'); $this->settings = ['source' => ['#title' => 'Source', '#type' => 'radios', '#options' => $options, '#default_value' => 'foursquare', '#to_js_settings' => true]]; // Get answers topics $topics = get_categories(['taxonomy' => 'location-taxonomy', 'hide_empty' => false, 'parent' => 0]); $options = []; if (!empty($topics) && empty($topics['errors'])) { foreach ($topics as $topic) { $options['wordpress:' . $topic->slug . ':' . $topic->name] = $topic->name; } } $this->settings += ['wordpress_layers' => ['#title' => 'Layers', '#type' => 'checkboxes', '#options' => $options, '#default_value' => ['all'], '#description' => 'Click all layers you would like to appear', '#to_js_settings' => true, '#states' => ['visible' => ['source' => ['operator' => '==', 'value' => ['wordpress'], 'glue' => '||']]]]]; $this->settings += ['zoom' => ['#title' => 'Default zoom level', '#type' => 'select', '#options' => array(11 => 11, 12 => 12, 13 => 13, 14 => 14, 15 => 15, 16 => 16), '#description' => 'A higher zoom level is more zoomed in.', '#default_value' => 15, '#to_js_settings' => true]]; parent::initialize(); }