You are here

function taxonomy_breadcrumb_taxonomy_vocabulary_update in Taxonomy Breadcrumb 8

Same name and namespace in other branches
  1. 7 taxonomy_breadcrumb.module \taxonomy_breadcrumb_taxonomy_vocabulary_update()

Implements hook_ENTITY_TYPE_update().

File

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

Code

function taxonomy_breadcrumb_taxonomy_vocabulary_update(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();
  }
}