buildBundleFieldDefinitions example

public function getFieldDefinitions($entity_type_id$bundle) {
    $langcode = $this->languageManager->getCurrentLanguage()->getId();
    if (!isset($this->fieldDefinitions[$entity_type_id][$bundle][$langcode])) {
      $base_field_definitions = $this->getBaseFieldDefinitions($entity_type_id);
      // Not prepared, try to load from cache.       $cid = 'entity_bundle_field_definitions:' . $entity_type_id . ':' . $bundle . ':' . $langcode;
      if ($cache = $this->cacheGet($cid)) {
        $bundle_field_definitions = $cache->data;
      }
      else {
        // Rebuild the definitions and put it into the cache.         $bundle_field_definitions = $this->buildBundleFieldDefinitions($entity_type_id$bundle$base_field_definitions);
        $this->cacheSet($cid$bundle_field_definitions, Cache::PERMANENT, ['entity_types', 'entity_field_info']);
      }
      // Field definitions consist of the bundle specific overrides and the       // base fields, merge them together. Use array_replace() to replace base       // fields with by bundle overrides and keep them in order, append       // additional by bundle fields.       $this->fieldDefinitions[$entity_type_id][$bundle][$langcode] = array_replace($base_field_definitions$bundle_field_definitions);
    }
    return $this->fieldDefinitions[$entity_type_id][$bundle][$langcode];
  }

  
Home | Imprint | This part of the site doesn't use cookies.