/** * Function for handling the widget control in admin panel * * @param array $instance * * @return void|string * @since 1.0 */ public function form($instance) { $authors = $this->plugin->getUsers(); $terms = $this->plugin->getTerms(); // Create a lookup table with all the terms indexed by their ID $terms_by_id = array(); foreach ($terms as $taxonomyTerms) { foreach ($taxonomyTerms as $term) { $terms_by_id[$term->term_id] = $term; } } // Create a lookup table with all the authors indexed by their ID $authors_by_id = array(); foreach ($authors as $author) { $authors_by_id[$author->ID] = $author; } $data = array('dataConfig' => new UTCW_DataConfig($instance, $this->plugin), 'renderConfig' => new UTCW_RenderConfig($instance, $this->plugin), 'configurations' => $this->plugin->getConfigurations(), 'available_post_types' => $this->plugin->getAllowedPostTypes(), 'available_taxonomies' => $this->plugin->getAllowedTaxonomiesObjects(), 'authors' => $authors, 'terms' => $terms, 'authors_by_id' => $authors_by_id, 'terms_by_id' => $terms_by_id); $this->render('settings', $data); }