You are here

private function PurgePurgerBundleUI::get_form_action in Purge 7.2

Generate the submit buttons.

2 calls to PurgePurgerBundleUI::get_form_action()
PurgePurgerBundleUI::get_form_edit in includes/purge_ui.class.inc
Generates a form to edit an item.
PurgePurgerBundleUI::get_form_view in includes/purge_ui.class.inc
Generates a form to view an item.

File

includes/purge_ui.class.inc, line 429
Provides administrative interface for the Purge module.

Class

PurgePurgerBundleUI
Generates UI elements for the Purge UI module.

Code

private function get_form_action() {
  $form = array();

  // Save button.
  if ($this->action != 'view' && in_array(PURGE_ACCESS_FULL, $this->form_item->access)) {
    $form['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Save'),
    );
    if ($this->form_item instanceof PurgeValidateable) {
      $form['validate'] = array(
        '#type' => 'button',
        '#value' => t('Validate'),
      );
    }
  }

  // Enable/disable button.
  if (in_array(PURGE_ACCESS_ENABLE, $this->form_item->access) || in_array(PURGE_ACCESS_FULL, $this->form_item->access)) {
    if ($this->form_item->enabled) {
      $form['disable'] = array(
        '#type' => 'submit',
        '#name' => 'disable',
        '#value' => t('Disable'),
        '#submit' => array(
          'purge_form_button_callback',
        ),
      );
    }
    else {
      $form['enable'] = array(
        '#type' => 'submit',
        '#name' => 'enable',
        '#value' => t('Enable'),
        '#submit' => array(
          'purge_form_button_callback',
        ),
      );
    }
  }

  // Delete button.
  if (in_array(PURGE_ACCESS_FULL, $this->form_item->access) && $this->action == 'edit') {
    $form['delete'] = array(
      '#type' => 'submit',
      '#name' => 'delete',
      '#value' => t('Delete'),
      '#submit' => array(
        'purge_form_button_callback',
      ),
    );
  }
  return $form;
}