You are here

biblio.controller.inc in Bibliography Module 7.2

Same filename and directory in other branches
  1. 7.3 includes/biblio.controller.inc

File

includes/biblio.controller.inc
View source
<?php

/**
 * Biblio class.
 */
class Biblio extends Entity {
  protected function defaultLabel() {
    $wrapper = entity_metadata_wrapper('biblio', $this);
    return $wrapper->biblio_title
      ->value();
  }
  protected function defaultUri() {
    return array(
      'path' => 'biblio/' . $this
        ->identifier(),
    );
  }

}

/**
 * Biblio controller class
 */
class BiblioController extends EntityAPIController {
  public function create(array $sent_values = array()) {
    global $user;
    $values = array(
      'bid' => '',
      'publication_type' => $sent_values['publication_type'],
      'created' => REQUEST_TIME,
      'changed' => '',
      'uid' => $user->uid,
    );
    $values += $sent_values;
    return parent::create($values);
  }
  public function buildContent($entity, $view_mode = 'full', $langcode = NULL, $content = array()) {
    $wrapper = entity_metadata_wrapper('biblio', $entity);
    $content['author'] = array(
      '#markup' => t('Created by: !author', array(
        '!author' => $wrapper->uid->name
          ->value(array(
          'sanitize' => TRUE,
        )),
      )),
    );

    // Make Description and Status themed like default fields.
    // @todo: figure out what we can replace description with.
    $content['description'] = array(
      '#theme' => 'field',
      '#weight' => 0,
      '#title' => t('Description'),
      '#access' => TRUE,
      '#label_display' => 'above',
      '#view_mode' => 'full',
      '#language' => LANGUAGE_NONE,
      '#field_name' => 'field_fake_description',
      '#field_type' => 'text',
      '#entity_type' => 'biblio_contributor',
      '#bundle' => $entity->type,
      '#items' => array(
        array(
          'value' => $entity->description,
        ),
      ),
      '#formatter' => 'text_default',
      0 => array(
        '#markup' => check_plain($entity->description),
      ),
    );
    return parent::buildContent($entity, $view_mode, $langcode, $content);
  }

}

Classes

Namesort descending Description
Biblio Biblio class.
BiblioController Biblio controller class