You are here

function simplemeta_meta_form in Simple Meta 6.2

Same name and namespace in other branches
  1. 7 simplemeta.module \simplemeta_meta_form()
3 string references to 'simplemeta_meta_form'
simplemeta_add in ./simplemeta.admin.inc
simplemeta_footer in ./simplemeta.module
Implements hook_footer()
simplemeta_menu in ./simplemeta.module
Implements hook_menu()

File

./simplemeta.module, line 294

Code

function simplemeta_meta_form(&$form_state, $meta, $ajax = FALSE) {
  $form = array();

  // let's use _ as prefix to not conflict with other elements
  $form['_meta'] = array(
    '#type' => 'value',
    '#value' => $meta,
  );
  $form['_ajax'] = array(
    '#type' => 'value',
    '#value' => $ajax,
  );
  if (!isset($meta->path)) {
    $form['_path'] = array(
      '#type' => 'textfield',
      '#title' => t('Path'),
      // '#description' => t(''),
      '#required' => TRUE,
    );
  }
  else {
    $form['_path'] = array(
      '#type' => 'value',
      '#value' => $meta->path,
    );
  }
  $form += simplemeta_get_form_elements($meta);
  $form['_buttons'] = array();
  $form['_buttons']['save'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
    '#validate' => array(
      'simplemeta_meta_form_validate_save',
    ),
    '#submit' => array(
      'simplemeta_meta_form_submit_save',
    ),
    '#attributes' => array(
      'class' => 'button-save',
    ),
  );
  $form['_buttons']['delete'] = array(
    '#type' => 'submit',
    '#value' => t('Delete'),
    '#submit' => array(
      'simplemeta_meta_form_submit_delete',
    ),
    '#access' => !empty($meta->sid),
    '#attributes' => array(
      'class' => 'button-delete',
    ),
  );
  if ($ajax) {
    $form['#attributes']['class'] = 'simplemeta-meta-form-ajax';
  }
  return $form;
}