You are here

function botcha_recipebooks_form in BOTCHA Spam Prevention 6.2

Same name and namespace in other branches
  1. 7.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 182
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) {

    /* @todo Abstarct it.
       $form['recipebooks'][$recipebook->id]['title']['#markup'] = $recipebook->title;
       $form['recipebooks'][$recipebook->id]['description']['#markup'] = $recipebook->description;
       $form['recipebooks'][$recipebook->id]['operations']['#markup'] = l(t('Edit'), Botcha::BOTCHA_ADMIN_PATH . '/recipebook/' . $recipebook->id)
        *
        */
    $form['recipebooks'][$recipebook->id]['title']['#value'] = $recipebook->title;
    $form['recipebooks'][$recipebook->id]['description']['#value'] = $recipebook->description;
    $form['recipebooks'][$recipebook->id]['operations']['#value'] = 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;
}