Classe di base del walker per produrre un elenco non ordinato di elementi di input di checkbox di categoria.

Descrizione

Vedere anche

  • Camminatore
  • wp_category_checklist()
  • wp_terms_checklist()

Fonte

File: wp-admin/includes/class-walker-category-checklist.php

classWalker_Category_ChecklistextendsWalker{public$tree_type='category';public$db_fields=array('parent'=>'parent','id'=>'term_id',);// TODO: Decouple this./**
	 * Starts the list before the elements are added.
	 *
	 * @see Walker:start_lvl()
	 *
	 * @since 2.5.1
	 *
	 * @param string $output Used to append additional content (passed by reference).
	 * @param int    $depth  Depth of category. Used for tab indentation.
	 * @param array  $args   An array of arguments. @see wp_terms_checklist()
	 */publicfunctionstart_lvl(&$output,$depth=0,$args=array()){$indent=str_repeat("t",$depth);$output.="$indent
    n";}/** * Ends the list of after the elements are added. * * @see Walker::end_lvl() * * @since 2.5.1 * * @param string $output Used to append additional content (passed by reference). * @param int $depth Depth of category. Used for tab indentation. * @param array $args An array of arguments. @see wp_terms_checklist() */publicfunctionend_lvl(&$output,$depth=0,$args=array()){$indent=str_repeat("t",$depth);$output.="$indent
n"
;}/** * Start the element output. * * @see Walker::start_el() * * @since 2.5.1 * * @param string $output Used to append additional content (passed by reference). * @param WP_Term $category The current term object. * @param int $depth Depth of the term in reference to parents. Default 0. * @param array $args An array of arguments. @see wp_terms_checklist() * @param int $id ID of the current term. */publicfunctionstart_el(&$output,$category,$depth=0,$args=array(),$id=0){if(empty($args['taxonomy'])){$taxonomy='category';}else{$taxonomy=$args['taxonomy'];}if('category'===$taxonomy){$name='post_category';}else{$name='tax_input['$taxonomy']';}$args['popular_cats']=!empty($args['popular_cats'])?array_map('intval',$args['popular_cats']):array();$class=in_array($category->term_id,$args['popular_cats'],true)?'':'';$args['selected_cats']=!empty($args['selected_cats'])?array_map('intval',$args['selected_cats']):array();if(!empty($args['list_only'])){$aria_checked='false';$inner_class='category';if(in_array($category->term_id,$args['selected_cats'],true)){$inner_class.=' selected';$aria_checked='true';}$output.="n"'$class'>''

Correlato

Utilizzi

Usi Descrizione
wp-includes/class-wp-walker.php: Camminatore

Una classe per visualizzare varie strutture ad albero.

Metodi

  • end_el - Termina l'output dell'elemento, se necessario.
  • end_lvl - Termina l'elenco dopo l'aggiunta degli elementi.
  • start_el - Avvia l'output degli elementi.
  • start_lvl - Avvia l'elenco prima dell'aggiunta degli elementi.

Changelog

Versione Descrizione
2.5.1 Introdotto.