You are here

function _epub_add_form_elements in Epub 6

Build the common elements of the epub form for the node forms.

Parameters

&$form: The form structure to be altered

$node: The node containing ePub information

1 call to _epub_add_form_elements()
epub_form in ./epub.module
Implementation of hook_form().

File

./epub.module, line 522
Provide ePub content type and enable the creation of ePub files from book contents.

Code

function _epub_add_form_elements(&$form, $node) {
  $form['epub'] = array(
    '#type' => 'fieldset',
    '#title' => t('ePub settings'),
    '#weight' => 5,
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['epub']['book_outline'] = array(
    '#type' => 'textfield',
    '#title' => t('Book'),
    '#description' => t("ePub file' s cover page, root of the book."),
    '#required' => TRUE,
    '#autocomplete_path' => 'epub/book_list_autocomplete',
    '#default_value' => $node->book_outline,
  );
  $form['epub']['author_name'] = array(
    '#type' => 'textfield',
    '#title' => t('Author'),
    '#description' => t('Who wrote this book'),
    '#required' => FALSE,
    '#default_value' => $node->author_name,
  );
  $form['epub']['language_code'] = array(
    '#type' => 'iso_639',
    '#title' => t('Language'),
    '#description' => t('RFC3066 Language codes, such as "en", "da", "fr", ...'),
    '#required' => TRUE,
    '#default_value' => $node->language_code ? $node->language_code : 'en',
  );
  $form['epub']['identifier'] = array(
    '#type' => 'textfield',
    '#title' => t('Identifier'),
    '#description' => t("The ePub' s ISBN number, preferred for published books, or a UUID."),
    '#required' => FALSE,
    '#default_value' => $node->identifier,
  );
  $form['epub']['identifier_type'] = array(
    '#type' => 'textfield',
    '#title' => t('Identifier Type'),
    '#description' => t("The ePub' s identifier type, ie: ISBN, ISSN, UUID, ..."),
    '#required' => FALSE,
    '#default_value' => $node->identifier_type,
  );
  $form['epub']['publisher_name'] = array(
    '#type' => 'textfield',
    '#title' => t("Publisher' s Name"),
    '#description' => t("Publisher' s name."),
    '#required' => FALSE,
    '#default_value' => $node->publisher_name,
  );
  $form['epub']['publisher_site'] = array(
    '#type' => 'textfield',
    '#title' => t("Publisher' s Site"),
    '#description' => t("Publisher' s site."),
    '#required' => FALSE,
    '#default_value' => $node->publisher_site,
  );
  $form['epub']['rights'] = array(
    '#type' => 'textfield',
    '#title' => t('Rights'),
    '#description' => t('Copyright and license information specific for the ePub.'),
    '#required' => FALSE,
    '#default_value' => $node->rights,
  );
  $form['epub']['creation_date'] = array(
    '#type' => 'textfield',
    '#title' => t('Creation date'),
    '#default_value' => date('Y-m-d H:i:s'),
    '#description' => t('Creation date(YYYY-MM-DD HH:MM:SS format).'),
    '#required' => FALSE,
    '#default_value' => isset($node->creation_date) ? $node->creation_date : date('Y-m-d H:i:s'),
  );
  $form['epub']['source_url'] = array(
    '#type' => 'textfield',
    '#title' => t('Source URL'),
    '#description' => t('URL of the site in which the ePub is available.'),
    '#required' => FALSE,
    '#default_value' => $node->source_url,
  );
}