You are here

function taxonomy_breadcrumb_taxonomy_vocabulary_insert in Taxonomy Breadcrumb 8

Implements hook_ENTITY_TYPE_insert().

File

./taxonomy_breadcrumb.module, line 92
Generates taxonomy based breadcrumbs on node pages and taxonomy/term pages.

Code

function taxonomy_breadcrumb_taxonomy_vocabulary_insert(EntityInterface $entity) {
  if (!FieldConfig::loadByName('taxonomy_term', $entity
    ->id(), 'taxonomy_breadcrumb_path')) {
    FieldConfig::create(array(
      'field_name' => 'taxonomy_breadcrumb_path',
      'entity_type' => 'taxonomy_term',
      'bundle' => $entity
        ->id(),
      'label' => t('Breadcrumb path (taxonomy_breadcrumb)'),
      'description' => t('The image of this term.'),
      'required' => FALSE,
    ))
      ->save();
  }
}