You are here

function _oa_core_setup_taxonomy_space_type in Open Atrium Core 7.2

Alters a taxonomy edit form to setup the 'Space Blueprint' functionality.

Parameters

string $layout_bundle: The name of the bundle to get the layout options for.

2 calls to _oa_core_setup_taxonomy_space_type()
oa_core_form_taxonomy_form_term_alter in ./oa_core.module
Implements hook_form_FORM_ID_alter().
oa_sections_form_taxonomy_form_term_alter in modules/oa_sections/oa_sections.module
Implements hook_form_FORM_ID_alter().

File

./oa_core.module, line 1743

Code

function _oa_core_setup_taxonomy_space_type(&$form, $layout_bundle = 'oa_space') {
  $term = (object) $form['#term'];
  $layout = field_get_items('taxonomy_term', $term, 'field_oa_section_layout', LANGUAGE_NONE);
  $layout_defaults = array();
  if (!empty($layout[0]['value'])) {
    $layout_defaults[] = $layout[0]['value'];
  }

  // Provide section layout options.
  $section_layouts = oa_core_get_space_type_layout_options($layout_bundle);
  if (isset($form['field_oa_section_layout'])) {
    $form['field_oa_section_layout'][$form['field_oa_section_layout']['#language']]['#options'] = $section_layouts;
    $form['field_oa_section_layout'][$form['field_oa_section_layout']['#language']]['#default_value'] = $layout_defaults;
  }
}