You are here

public function Application::getAdminForm in Module Object Oriented Programming API 7.2

Same name and namespace in other branches
  1. 6.2 component/moopapi.component.inc \Application::getAdminForm()
  2. 6 component/moopapi.component.inc \Application::getAdminForm()
  3. 7 component/moopapi.component.inc \Application::getAdminForm()

File

component/moopapi.component.inc, line 143

Class

Application
@todo Desc for Application.

Code

public function getAdminForm($form, &$form_state, $form_name) {
  $app_name = strtolower($this->app_name);

  // @todo Refactor this switch stuff with classes since they are similar a lot.
  switch ($form_name) {
    case 'general':

      // Development fieldset.
      $form['development'] = array(
        '#type' => 'fieldset',
        '#title' => t('Development'),
        '#description' => t('In fact you should change the state of these settings only for development purposes.'),
      );

      // Decorator fieldset.
      $form['development']['decorators'] = array(
        '#type' => 'fieldset',
        '#title' => t('Decorators'),
        '#description' => t('Features that extend usual behavior of the module. For more details see <a href="@decorator_link">Decorator pattern</a> article.', array(
          '@decorator_link' => url("http://en.wikipedia.org/wiki/Decorator_pattern"),
        )),
      );

      // Logger decorator.
      $form['development']['decorators']['logger'] = array(
        '#type' => 'checkbox',
        '#title' => t('Logger'),
        '#description' => t('Enable to get full log of all application method calls as a file.'),
        '#default_value' => in_array('Logger', (array) unserialize(variable_get("{$app_name}_decorators", serialize(array())))),
      );

      // Cacher decorator.
      $form['development']['decorators']['cacher'] = array(
        '#disabled' => TRUE,
        '#type' => 'checkbox',
        '#title' => t('Cacher'),
        '#description' => t('Speeds up each method call by using multi-level caching.') . ' ' . $this
          ->getStubText(1870060, 'moopapi'),
        '#default_value' => in_array('Cacher', (array) unserialize(variable_get("{$app_name}_decorators", serialize(array())))),
      );
      break;
  }
  return $form;
}