Commit 6b26ea94 authored by Jelle Sebreghts's avatar Jelle Sebreghts
Browse files

don't use disabled settings

parent 3acffb8b
...@@ -90,7 +90,7 @@ function clientside_validation_general_settings_form($form_id, $form_state) { ...@@ -90,7 +90,7 @@ function clientside_validation_general_settings_form($form_id, $form_state) {
} }
function clientside_validation_settings_form($form, $form_state, $cvs_formid = NULL, $cvs_type = 'default') { function clientside_validation_settings_form($form, $form_state, $cvs_formid = NULL, $cvs_type = 'default') {
$settings = clientside_validation_settings_load($cvs_type, $cvs_formid); $settings = clientside_validation_settings_load($cvs_type, $cvs_formid, TRUE);
$form['new'] = array( $form['new'] = array(
'#type' => 'value', '#type' => 'value',
...@@ -452,13 +452,15 @@ function _cv_setting_status($status) { ...@@ -452,13 +452,15 @@ function _cv_setting_status($status) {
function clientside_validation_settings_overview($form, $form_state, $cvs_type) { function clientside_validation_settings_overview($form, $form_state, $cvs_type) {
$form = array(); $form = array();
$settings = clientside_validation_settings_load($cvs_type); $settings = clientside_validation_settings_load($cvs_type, NULL, TRUE);
$definedforms = array(); $definedforms = array();
$empty_text = "";
switch ($cvs_type) { switch ($cvs_type) {
case 'content-types': case 'content-types':
$destination = array('destination' => 'admin/config/validation/clientside_validation/content-types'); $destination = array('destination' => 'admin/config/validation/clientside_validation/content-types');
$settinguri = 'admin/config/validation/clientside_validation/content-types/'; $settinguri = 'admin/config/validation/clientside_validation/content-types/';
$headerlabel = t('Content type'); $headerlabel = t('Content type');
$empty_text = t('No content types available');
$content_types = node_type_get_types(); $content_types = node_type_get_types();
foreach ($content_types as $content_type) { foreach ($content_types as $content_type) {
...@@ -473,6 +475,7 @@ function clientside_validation_settings_overview($form, $form_state, $cvs_type) ...@@ -473,6 +475,7 @@ function clientside_validation_settings_overview($form, $form_state, $cvs_type)
$destination = array('destination' => 'admin/config/validation/clientside_validation/webforms'); $destination = array('destination' => 'admin/config/validation/clientside_validation/webforms');
$settinguri = 'admin/config/validation/clientside_validation/webforms/'; $settinguri = 'admin/config/validation/clientside_validation/webforms/';
$headerlabel = t('Webforms'); $headerlabel = t('Webforms');
$empty_text = t('No webforms available');
$webform_types = webform_variable_get('webform_node_types'); $webform_types = webform_variable_get('webform_node_types');
$nodes = array(); $nodes = array();
...@@ -496,6 +499,7 @@ function clientside_validation_settings_overview($form, $form_state, $cvs_type) ...@@ -496,6 +499,7 @@ function clientside_validation_settings_overview($form, $form_state, $cvs_type)
$destination = array('destination' => 'admin/config/validation/clientside_validation/custom-forms'); $destination = array('destination' => 'admin/config/validation/clientside_validation/custom-forms');
$settinguri = 'admin/config/validation/clientside_validation/custom-forms/'; $settinguri = 'admin/config/validation/clientside_validation/custom-forms/';
$headerlabel = t('Form Id'); $headerlabel = t('Form Id');
$empty_text = t('No custom forms added yet');
foreach ($settings as $customform) { foreach ($settings as $customform) {
$definedforms[] = array( $definedforms[] = array(
...@@ -600,11 +604,11 @@ function clientside_validation_settings_overview($form, $form_state, $cvs_type) ...@@ -600,11 +604,11 @@ function clientside_validation_settings_overview($form, $form_state, $cvs_type)
t('Status'), t('Status'),
t('Actions'), t('Actions'),
); );
$form['contenttypes'] = array( $form[str_replace('-', '', $cvs_type)] = array(
'#theme' => 'table', '#theme' => 'table',
'#header' => $header, '#header' => $header,
'#rows' => $rows, '#rows' => $rows,
'#empty' => t('No content types available.'), '#empty' => $empty_text,
); );
return $form; return $form;
......
...@@ -1199,7 +1199,7 @@ function clientside_validation_settings_load_defaults() { ...@@ -1199,7 +1199,7 @@ function clientside_validation_settings_load_defaults() {
return $defaults; return $defaults;
} }
function clientside_validation_settings_load($cvs_type = NULL, $cvs_formid = NULL) { function clientside_validation_settings_load($cvs_type = NULL, $cvs_formid = NULL, $include_disabled = FALSE) {
if ($cvs_type == 'default') { if ($cvs_type == 'default') {
$default_settings = array( $default_settings = array(
'validate_options' => array( 'validate_options' => array(
...@@ -1238,6 +1238,9 @@ function clientside_validation_settings_load($cvs_type = NULL, $cvs_formid = NUL ...@@ -1238,6 +1238,9 @@ function clientside_validation_settings_load($cvs_type = NULL, $cvs_formid = NUL
if (!empty($cvs_formid)) { if (!empty($cvs_formid)) {
$query->condition('form_id', $cvs_formid); $query->condition('form_id', $cvs_formid);
} }
if (!$include_disabled) {
$query->condition('status', 1);
}
$result = $query->execute(); $result = $query->execute();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment