You are here

function scs_node_sort_form in Simplenews Content Selection 8

Same name and namespace in other branches
  1. 7.2 scs.module \scs_node_sort_form()

Form callback: second step of the selection form, sorting nodes

2 calls to scs_node_sort_form()
scs_form_node_admin_content_alter in ./scs.module
Implements hook_form_FORM_ID_alter().
scs_views_create_newsletter_action_form in simplenews_content_selection_views/scs_views.module
Configuration form for tis action. Not used as form, but used as a step to go to the node sorter.

File

./scs.module, line 138
General hooks and commonly-used functions

Code

function scs_node_sort_form($form, &$form_state) {
  $nodes = array_filter($form_state['values']['nodes']);

  // Checkbox for Table of contents
  $form['scs_toc'] = array(
    '#type' => 'checkbox',
    '#title' => t('Create a table of contents'),
    '#description' => t('Create a table of contents at top of the newsletter with the titles of the selected nodes. If newsletter is HTML format, these table of contents will be bookmarks.'),
  );

  // Create elements for the tablesort
  $form['nodes']['#tree'] = TRUE;
  foreach ($nodes as $nid) {
    $form['nodes'][$nid]['weight'] = array(
      '#type' => 'weight',
      '#attributes' => array(
        'class' => array(
          'node-weight',
        ),
      ),
    );
    $form['nodes'][$nid]['view_mode'] = array(
      '#type' => 'select',
      '#options' => scs_view_mode_options(),
    );
  }
  $form['#theme'] = 'scs_sortable_table';
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Create newsletter'),
  );
  return $form;
}