You are here

function features_form_validate in Features 7

Same name and namespace in other branches
  1. 6 features.admin.inc \features_form_validate()
  2. 7.2 features.admin.inc \features_form_validate()

Validate handler for the 'manage features' form.

1 string reference to 'features_form_validate'
features_admin_form in ./features.admin.inc
Form constructor for the features configuration form.

File

./features.admin.inc, line 637
@todo.

Code

function features_form_validate(&$form, &$form_state) {
  include_once './includes/install.inc';
  $conflicts = features_get_conflicts();
  foreach ($form_state['values']['status'] as $module => $status) {
    if ($status) {
      if (!empty($conflicts[$module])) {
        foreach (array_keys($conflicts[$module]) as $conflict) {
          if (!empty($form_state['values']['status'][$conflict])) {
            form_set_error('status', t('The feature @module cannot be enabled because it conflicts with @conflict.', array(
              '@module' => $module,
              '@conflict' => $conflict,
            )));
          }
        }
      }
      if (!drupal_check_module($module)) {
        form_set_error('status', t('The feature @module cannot be enabled because it has unmet requirements.', array(
          '@module' => $module,
        )));
      }
    }
  }
}