You are here

function botcha_recipebooks_form in BOTCHA Spam Prevention 7.2

Same name and namespace in other branches
  1. 6.2 botcha.admin.inc \botcha_recipebooks_form()

Callback for "Recipe books" admin page. @todo ?Is it form really? Perhaps table?

1 string reference to 'botcha_recipebooks_form'
botcha_menu in ./botcha.module
Implements hook_menu().

File

./botcha.admin.inc, line 314
Implementation of botcha administration forms.

Code

function botcha_recipebooks_form() {
  $form['#header'] = array(
    t('Title'),
    t('Description'),
    t('Operations'),
  );

  // Get all recipe books from database.
  $recipebooks = Botcha::getRecipebooks();

  // Protect default recipebook from being deleted.
  foreach ($recipebooks as $recipebook) {
    $form['recipebooks'][$recipebook->id]['title']['#markup'] = $recipebook->title;
    $form['recipebooks'][$recipebook->id]['description']['#markup'] = $recipebook->description;
    $form['recipebooks'][$recipebook->id]['operations']['#markup'] = in_array($recipebook->id, array(
      'forbidden_forms',
    )) ? '' : l(t('Edit'), Botcha::BOTCHA_ADMIN_PATH . "/recipebook/{$recipebook->id}") . (in_array($recipebook->id, array(
      'default',
      'forbidden_forms',
    )) ? '' : ' | ' . l(t('Delete'), Botcha::BOTCHA_ADMIN_PATH . "/recipebook/{$recipebook->id}/delete"));
  }
  return $form;
}