You are here

MarcReferenceNormalizer.php in Bibliography & Citation 8

Same filename and directory in other branches
  1. 2.0.x modules/bibcite_marc/src/Normalizer/MarcReferenceNormalizer.php

File

modules/bibcite_marc/src/Normalizer/MarcReferenceNormalizer.php
View source
<?php

namespace Drupal\bibcite_marc\Normalizer;

use Drupal\bibcite_entity\Entity\ReferenceInterface;
use Drupal\bibcite_entity\Normalizer\ReferenceNormalizerBase;

/**
 * Normalizes/denormalizes reference entity to Marc format.
 */
class MarcReferenceNormalizer extends ReferenceNormalizerBase {

  /**
   * {@inheritdoc}
   */
  protected function extractFields(ReferenceInterface $reference, $format) {
    $attributes = parent::extractFields($reference, $format);
    $attributes['title'] = $this
      ->extractScalar($reference
      ->get('title'));
    $attributes['reference'] = $reference
      ->id();
    return $attributes;
  }

}

Classes

Namesort descending Description
MarcReferenceNormalizer Normalizes/denormalizes reference entity to Marc format.