PHP code example of flexpress / component-taxonomy

1. Go to this page and download the library: Download flexpress/component-taxonomy library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

flexpress / component-taxonomy example snippets


$pimple["documentTypeTaxonomy"] = function () {
  return new DocumentType();
};

$pimple['taxonomyHelper'] = function ($c) {
    return new TaxonomyHelper($c['objectStorage'], array(
        $c["documentTypeTaxonomy"]
    ));
};

class DocumentType extends AbstractTaxonomy {

    public function getName()
    {
      return "document-type";
    }
    
    public function getSupportedPostTypes()
    {
      return array("document");
    }

}

class DocumentType extends AbstractTaxonomy {

  public function getName()
  {
    return "document-type";
  }
  
  public function getSupportedPostTypes()
  {
    return array("document");
  }

  protected function getLabels()
  {
    $labels = parent::getLabels();
    $labels['menu_name'] = 'Type';
    return $labels;
  }
  
  public function getArgs()
  {
    $args = parent::getArgs();
    $args['query_var'] = false;
    return $args;
  }
  
  public function getPluralName()
  {
    return "Doc types";
  }
  
  public function getSingularName()
  {
    return "Doc type";
  }

}