You are here

function nd_build_modes in Node displays 6

Build modes overview.

6 string references to 'nd_build_modes'
nd_build_mode_delete_form_submit in includes/nd.buildmodes.inc
Delete display.
nd_build_mode_form in includes/nd.buildmodes.inc
Build mode form.
nd_build_mode_form_submit in includes/nd.buildmodes.inc
Save new build mode.
NodeDisplaysBuildModes::testNdBuildModes in tests/nd.buildmodes.test
Test build modes.
_nd_content_build_modes in includes/nd.registry.inc
Return nd build modes.

... See full list

File

includes/nd.buildmodes.inc, line 11
Manage build modes.

Code

function nd_build_modes() {
  $output = '';
  $action = arg(5);
  $build_mode = arg(6);
  $build_modes = variable_get('nd_build_modes', array());

  // Delete form.
  if (in_array($build_mode, array_keys($build_modes)) && $action == 'delete') {
    $output .= drupal_get_form('nd_build_mode_delete_form', $build_mode);
  }
  elseif (in_array($build_mode, array_keys($build_modes)) && $action == 'edit') {
    $output .= drupal_get_form('nd_build_mode_form', $build_mode);
  }
  else {
    if (empty($build_modes)) {
      $output .= '<p>' . t('You have not defined any custom build modes.') . '</p>';
    }
    else {
      $header = array(
        t('Name'),
        t('Key'),
        t('Operations'),
      );
      $rows = array();
      foreach ($build_modes as $key => $name) {
        $row = array();
        $row[] = check_plain($name);
        $row[] = $key;
        $row[] = l(t('Edit'), 'admin/content/types/nd/buildmodes/edit/' . $key) . ' - ' . l(t('Delete'), 'admin/content/types/nd/buildmodes/delete/' . $key);
        $rows[] = $row;
      }
      $output .= theme('table', $header, $rows);
    }

    // New build mode form.
    $output .= drupal_get_form('nd_build_mode_form');

    // Build modes matrix form.
    $output .= drupal_get_form('nd_buildmodes_matrix_form');
  }
  return $output;
}