You are here

function taxonomy_breadcrumb_taxonomy_term_insert in Taxonomy Breadcrumb 8

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

Implements hook_ENTITY_TYPE_insert().

File

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

Code

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