You are here

function discussthis_admin_settings_validate in Discuss This! 6

Same name and namespace in other branches
  1. 7.2 discussthis.admin.inc \discussthis_admin_settings_validate()
  2. 7 discussthis.admin.inc \discussthis_admin_settings_validate()

\brief Validate the discussthis selections.

Make sure that every node-type selected also has a default Forum topic.

\param[in] $form The form concerned by this validation. \param[in,out] $form_state The current state of this form.

File

./discussthis.admin.inc, line 301
Settings callbacks

Code

function discussthis_admin_settings_validate($form, &$form_state) {
  $node_types = node_get_types('names');
  foreach ($form_state['values']['discussthis_nodetypes'] as $type => $enabled) {
    if ($enabled && $form_state['values']['discussthis_node_' . $type] == 0) {

      // The node type is enabled but has no default forum
      form_set_error('discussthis_node_' . $type, t('Please select a default Forum for @type nodes.', array(
        '@type' => $node_types[$type],
      )));
    }
  }
}