Skip to content

Commit

Permalink
Using a select instead of checkboxes for categories, add cats array - #…
Browse files Browse the repository at this point in the history
  • Loading branch information
JayWood committed Sep 30, 2016
1 parent a6c1477 commit 99ec5f9
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions includes/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -447,12 +447,23 @@ public function get_settings_config() {
'id' => 'cat_list',
'name' => __( 'Category restrictions', 'content-warning-v2' ),
'desc' => __( 'Select categories that you would like to restrict with the dialog.', 'content-warning-v2' ),
'type' => 'check',
'options' =>
array(),
'type' => 'select',
'options' => $this->get_cat_list()
),
),
),
);
}

private function get_cat_list() {
$cat_list = get_categories();
$final_cat_list = array();
foreach ( $cat_list as $cw_cat ) {
$term_id = $cw_cat->term_id;
$term_name = $cw_cat->name;

$final_cat_list[ $term_id ] = $term_name;
}
return $final_cat_list;
}
}

0 comments on commit 99ec5f9

Please sign in to comment.