You are here

function icon_bundle_configure_form in Icon API 8

Same name and namespace in other branches
  1. 7 includes/admin.inc \icon_bundle_configure_form()

Menu callback for 'icon_bundle_configure_form'.

1 string reference to 'icon_bundle_configure_form'
icon_provider_import_form_submit in includes/import.inc
Submit callback for 'icon_provider_import_form'.

File

includes/admin.inc, line 257
admin.inc Provides administrative callbacks and tasks.

Code

function icon_bundle_configure_form($form, &$form_state, $bundle) {

  // @FIXME
  // drupal_set_title() has been removed. There are now a few ways to set the title
  // dynamically, depending on the situation.
  //
  //
  // @see https://www.drupal.org/node/2067859
  // drupal_set_title(t('Configure %bundle icons', array('%bundle' => $bundle['title'])), PASS_THROUGH);
  $form_state['bundle'] = $bundle;
  $form['status'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enabled'),
    '#default_value' => $bundle['status'],
  );
  $form['settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Bundle settings'),
    '#tree' => TRUE,
  );
  foreach (icon_extension_implements('icon_bundle_configure') as $extension => $type) {
    icon_extension_invoke($type, $extension, 'icon_bundle_configure', $form['settings'], $form_state, $form);
  }
  $settings = \Drupal\Core\Render\Element::children($form['settings']);
  if (empty($settings)) {
    $form['settings']['#access'] = FALSE;
  }
  $form['actions'] = array(
    '#type' => 'actions',
  );
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save bundle'),
  );
  if (!empty($bundle['import'])) {
    $form['actions']['delete'] = array(
      '#type' => 'submit',
      '#value' => t('Delete bundle'),
    );
  }
  elseif (!empty($bundle['overridden'])) {
    $form['actions']['reset'] = array(
      '#type' => 'submit',
      '#value' => t('Reset bundle'),
    );
  }
  return $form;
}