Skip to main content

TaxonomyHandler

Trait TaxonomyHandler 

Source
pub trait TaxonomyHandler:
    Send
    + Sync
    + 'static {
    // Required methods
    fn slug(&self) -> &'static str;
    fn verbose_name(&self) -> &'static str;

    // Provided methods
    fn hierarchical(&self) -> bool { ... }
    fn max_depth(&self) -> i32 { ... }
    fn icon(&self) -> Option<&'static str> { ... }
    fn description(&self) -> Option<&'static str> { ... }
    fn ext_table(&self) -> Option<&'static str> { ... }
    fn ext_widgets<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _pool: &'life1 Pool,
        _category_id: i64,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Widget>, ExecError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn save_ext<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _pool: &'life1 Pool,
        _category_id: i64,
        _form: &'life2 HashMap<String, String>,
    ) -> Pin<Box<dyn Future<Output = Result<(), ExecError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
}
Expand description

A code-registered vocabulary. Mirrors PageTypeHandler: process-global, zero-arg constructible via the register_taxonomy! factory. The definition is synced into a cms_taxonomy row at seed; the optional extension hooks back a custom typed-field table.

Required Methods§

Source

fn slug(&self) -> &'static str

Stable identifier — the URL/registry key, unique across vocabularies.

Source

fn verbose_name(&self) -> &'static str

Human label for the admin nav + headings.

Provided Methods§

Source

fn hierarchical(&self) -> bool

true allows nested categories; false rejects any non-NULL parent.

Source

fn max_depth(&self) -> i32

Nesting cap (create/move enforced).

Source

fn icon(&self) -> Option<&'static str>

Material Symbols icon for the nav entry.

Source

fn description(&self) -> Option<&'static str>

Source

fn ext_table(&self) -> Option<&'static str>

Per-type extension table name (typed extra fields), or None for a base-columns-only vocabulary like the built-in category.

Source

fn ext_widgets<'life0, 'life1, 'async_trait>( &'life0 self, _pool: &'life1 Pool, _category_id: i64, ) -> Pin<Box<dyn Future<Output = Result<Vec<Widget>, ExecError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Extra field widgets for the category editor (custom vocabularies), prefilled from the extension row. Rendered through the shared _widget.html macro alongside the base fields.

Source

fn save_ext<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _pool: &'life1 Pool, _category_id: i64, _form: &'life2 HashMap<String, String>, ) -> Pin<Box<dyn Future<Output = Result<(), ExecError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Persist the extension row from the posted form (custom vocabularies).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§