@@ -1522,23 +1522,23 @@ discard block |
||
1522 | 1522 | foreach ($display->handler->option_definition() as $option => $definition) { |
1523 | 1523 | // Special handling for some items |
1524 | 1524 | switch ($option) { |
1525 | - case 'defaults': |
|
1526 | - // skip these |
|
1527 | - break; |
|
1528 | - default: |
|
1529 | - if (!$display->handler->is_defaulted($option)) { |
|
1530 | - $value = $display->handler->get_option($option); |
|
1531 | - if ($id == 'default') { |
|
1532 | - $default = isset($definition['default']) ? $definition['default'] : NULL; |
|
1533 | - } |
|
1534 | - else { |
|
1535 | - $default = $this->display['default']->handler->get_option($option); |
|
1536 | - } |
|
1537 | - |
|
1538 | - if ($value !== $default) { |
|
1539 | - $output .= $indent . '$handler->override_option(\'' . $option . '\', ' . views_var_export($value, $indent) . ");\n"; |
|
1540 | - } |
|
1525 | + case 'defaults': |
|
1526 | + // skip these |
|
1527 | + break; |
|
1528 | + default: |
|
1529 | + if (!$display->handler->is_defaulted($option)) { |
|
1530 | + $value = $display->handler->get_option($option); |
|
1531 | + if ($id == 'default') { |
|
1532 | + $default = isset($definition['default']) ? $definition['default'] : NULL; |
|
1533 | + } |
|
1534 | + else { |
|
1535 | + $default = $this->display['default']->handler->get_option($option); |
|
1541 | 1536 | } |
1537 | + |
|
1538 | + if ($value !== $default) { |
|
1539 | + $output .= $indent . '$handler->override_option(\'' . $option . '\', ' . views_var_export($value, $indent) . ");\n"; |
|
1540 | + } |
|
1541 | + } |
|
1542 | 1542 | } |
1543 | 1543 | } |
1544 | 1544 | } |
@@ -1735,18 +1735,18 @@ discard block |
||
1735 | 1735 | } |
1736 | 1736 | $fields[] = $field; |
1737 | 1737 | switch ($info['type']) { |
1738 | - case 'blob': |
|
1739 | - $defs[] = '%b'; |
|
1740 | - break; |
|
1741 | - case 'int': |
|
1742 | - $defs[] = '%d'; |
|
1743 | - break; |
|
1744 | - case 'float': |
|
1745 | - case 'numeric': |
|
1746 | - $defs[] = '%f'; |
|
1747 | - break; |
|
1748 | - default: |
|
1749 | - $defs[] = "'%s'"; |
|
1738 | + case 'blob': |
|
1739 | + $defs[] = '%b'; |
|
1740 | + break; |
|
1741 | + case 'int': |
|
1742 | + $defs[] = '%d'; |
|
1743 | + break; |
|
1744 | + case 'float': |
|
1745 | + case 'numeric': |
|
1746 | + $defs[] = '%f'; |
|
1747 | + break; |
|
1748 | + default: |
|
1749 | + $defs[] = "'%s'"; |
|
1750 | 1750 | } |
1751 | 1751 | if (empty($info['serialize'])) { |
1752 | 1752 | $values[] = $this->$field; |
@@ -881,27 +881,27 @@ discard block |
||
881 | 881 | $db_type = $GLOBALS['db_type']; |
882 | 882 | $offset = $set_offset !== NULL ? $set_offset : views_get_timezone(); |
883 | 883 | switch ($db_type) { |
884 | - case 'mysql': |
|
885 | - case 'mysqli': |
|
886 | - switch ($field_type) { |
|
887 | - case 'int': |
|
888 | - $field = "FROM_UNIXTIME($field)"; |
|
889 | - break; |
|
890 | - case 'datetime': |
|
891 | - break; |
|
892 | - } |
|
884 | + case 'mysql': |
|
885 | + case 'mysqli': |
|
886 | + switch ($field_type) { |
|
887 | + case 'int': |
|
888 | + $field = "FROM_UNIXTIME($field)"; |
|
889 | + break; |
|
890 | + case 'datetime': |
|
891 | + break; |
|
892 | + } |
|
893 | 893 | if (!empty($offset)) { |
894 | 894 | $field = "($field + INTERVAL $offset SECOND)"; |
895 | 895 | } |
896 | 896 | return $field; |
897 | - case 'pgsql': |
|
898 | - switch ($field_type) { |
|
899 | - case 'int': |
|
900 | - $field = "$field::ABSTIME"; |
|
901 | - break; |
|
902 | - case 'datetime': |
|
903 | - break; |
|
904 | - } |
|
897 | + case 'pgsql': |
|
898 | + switch ($field_type) { |
|
899 | + case 'int': |
|
900 | + $field = "$field::ABSTIME"; |
|
901 | + break; |
|
902 | + case 'datetime': |
|
903 | + break; |
|
904 | + } |
|
905 | 905 | if (!empty($offset)) { |
906 | 906 | $field = "($field + INTERVAL '$offset SECONDS')"; |
907 | 907 | } |
@@ -929,49 +929,49 @@ discard block |
||
929 | 929 | $db_type = $GLOBALS['db_type']; |
930 | 930 | $field = views_date_sql_field($field, $field_type, $set_offset); |
931 | 931 | switch ($db_type) { |
932 | - case 'mysql': |
|
933 | - case 'mysqli': |
|
934 | - $replace = array( |
|
935 | - 'Y' => '%Y', |
|
936 | - 'y' => '%y', |
|
937 | - 'M' => '%%b', |
|
938 | - 'm' => '%m', |
|
939 | - 'n' => '%c', |
|
940 | - 'F' => '%M', |
|
941 | - 'D' => '%a', |
|
942 | - 'd' => '%%d', |
|
943 | - 'l' => '%W', |
|
944 | - 'j' => '%e', |
|
945 | - 'W' => '%v', |
|
946 | - 'H' => '%H', |
|
947 | - 'h' => '%h', |
|
948 | - 'i' => '%i', |
|
949 | - 's' => '%%s', |
|
950 | - 'A' => '%p', |
|
951 | - ); |
|
952 | - $format = strtr($format, $replace); |
|
953 | - return "DATE_FORMAT($field, '$format')"; |
|
954 | - case 'pgsql': |
|
955 | - $replace = array( |
|
956 | - 'Y' => 'YYYY', |
|
957 | - 'y' => 'YY', |
|
958 | - 'M' => 'Mon', |
|
959 | - 'm' => 'MM', |
|
960 | - 'n' => 'MM', // no format for Numeric representation of a month, without leading zeros |
|
961 | - 'F' => 'Month', |
|
962 | - 'D' => 'Dy', |
|
963 | - 'd' => 'DD', |
|
964 | - 'l' => 'Day', |
|
965 | - 'j' => 'DD', // no format for Day of the month without leading zeros |
|
966 | - 'W' => 'WW', |
|
967 | - 'H' => 'HH24', |
|
968 | - 'h' => 'HH12', |
|
969 | - 'i' => 'MI', |
|
970 | - 's' => 'SS', |
|
971 | - 'A' => 'AM', |
|
972 | - ); |
|
973 | - $format = strtr($format, $replace); |
|
974 | - return "TO_CHAR($field, '$format')"; |
|
932 | + case 'mysql': |
|
933 | + case 'mysqli': |
|
934 | + $replace = array( |
|
935 | + 'Y' => '%Y', |
|
936 | + 'y' => '%y', |
|
937 | + 'M' => '%%b', |
|
938 | + 'm' => '%m', |
|
939 | + 'n' => '%c', |
|
940 | + 'F' => '%M', |
|
941 | + 'D' => '%a', |
|
942 | + 'd' => '%%d', |
|
943 | + 'l' => '%W', |
|
944 | + 'j' => '%e', |
|
945 | + 'W' => '%v', |
|
946 | + 'H' => '%H', |
|
947 | + 'h' => '%h', |
|
948 | + 'i' => '%i', |
|
949 | + 's' => '%%s', |
|
950 | + 'A' => '%p', |
|
951 | + ); |
|
952 | + $format = strtr($format, $replace); |
|
953 | + return "DATE_FORMAT($field, '$format')"; |
|
954 | + case 'pgsql': |
|
955 | + $replace = array( |
|
956 | + 'Y' => 'YYYY', |
|
957 | + 'y' => 'YY', |
|
958 | + 'M' => 'Mon', |
|
959 | + 'm' => 'MM', |
|
960 | + 'n' => 'MM', // no format for Numeric representation of a month, without leading zeros |
|
961 | + 'F' => 'Month', |
|
962 | + 'D' => 'Dy', |
|
963 | + 'd' => 'DD', |
|
964 | + 'l' => 'Day', |
|
965 | + 'j' => 'DD', // no format for Day of the month without leading zeros |
|
966 | + 'W' => 'WW', |
|
967 | + 'H' => 'HH24', |
|
968 | + 'h' => 'HH12', |
|
969 | + 'i' => 'MI', |
|
970 | + 's' => 'SS', |
|
971 | + 'A' => 'AM', |
|
972 | + ); |
|
973 | + $format = strtr($format, $replace); |
|
974 | + return "TO_CHAR($field, '$format')"; |
|
975 | 975 | } |
976 | 976 | } |
977 | 977 | |
@@ -1014,30 +1014,30 @@ discard block |
||
1014 | 1014 | return "EXTRACT(SECOND FROM($field))"; |
1015 | 1015 | case('WEEK'): // ISO week number for date |
1016 | 1016 | switch ($db_type) { |
1017 | - case('mysql'): |
|
1018 | - case('mysqli'): |
|
1019 | - // WEEK using arg 3 in mysql should return the same value as postgres EXTRACT |
|
1020 | - return "WEEK($field, 3)"; |
|
1021 | - case('pgsql'): |
|
1022 | - return "EXTRACT(WEEK FROM($field))"; |
|
1017 | + case('mysql'): |
|
1018 | + case('mysqli'): |
|
1019 | + // WEEK using arg 3 in mysql should return the same value as postgres EXTRACT |
|
1020 | + return "WEEK($field, 3)"; |
|
1021 | + case('pgsql'): |
|
1022 | + return "EXTRACT(WEEK FROM($field))"; |
|
1023 | 1023 | } |
1024 | 1024 | case('DOW'): |
1025 | 1025 | switch ($db_type) { |
1026 | - case('mysql'): |
|
1027 | - case('mysqli'): |
|
1028 | - // mysql returns 1 for Sunday through 7 for Saturday |
|
1029 | - // php date functions and postgres use 0 for Sunday and 6 for Saturday |
|
1030 | - return "INTEGER(DAYOFWEEK($field) - 1)"; |
|
1031 | - case('pgsql'): |
|
1032 | - return "EXTRACT(DOW FROM($field))"; |
|
1026 | + case('mysql'): |
|
1027 | + case('mysqli'): |
|
1028 | + // mysql returns 1 for Sunday through 7 for Saturday |
|
1029 | + // php date functions and postgres use 0 for Sunday and 6 for Saturday |
|
1030 | + return "INTEGER(DAYOFWEEK($field) - 1)"; |
|
1031 | + case('pgsql'): |
|
1032 | + return "EXTRACT(DOW FROM($field))"; |
|
1033 | 1033 | } |
1034 | 1034 | case('DOY'): |
1035 | 1035 | switch ($db_type) { |
1036 | - case('mysql'): |
|
1037 | - case('mysqli'): |
|
1038 | - return "DAYOFYEAR($field)"; |
|
1039 | - case('pgsql'): |
|
1040 | - return "EXTRACT(DOY FROM($field))"; |
|
1036 | + case('mysql'): |
|
1037 | + case('mysqli'): |
|
1038 | + return "DAYOFYEAR($field)"; |
|
1039 | + case('pgsql'): |
|
1040 | + return "EXTRACT(DOY FROM($field))"; |
|
1041 | 1041 | } |
1042 | 1042 | } |
1043 | 1043 | } |
@@ -41,13 +41,13 @@ discard block |
||
41 | 41 | |
42 | 42 | $ts = tablesort_init($header); |
43 | 43 | switch ($ts['sql']) { |
44 | - case 'name': |
|
45 | - default: |
|
46 | - $sorts[] = $item[0]; |
|
47 | - break; |
|
48 | - case 'title': |
|
49 | - $sorts[] = $item[1]; |
|
50 | - break; |
|
44 | + case 'name': |
|
45 | + default: |
|
46 | + $sorts[] = $item[0]; |
|
47 | + break; |
|
48 | + case 'title': |
|
49 | + $sorts[] = $item[1]; |
|
50 | + break; |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
@@ -226,10 +226,10 @@ discard block |
||
226 | 226 | if ($menu['type'] == 'default tab') { |
227 | 227 | $tab_options = array('type' => 'none'); |
228 | 228 | switch ($imported->menu_tab_default_parent_type) { |
229 | - case 'tab': |
|
230 | - case 'normal': |
|
231 | - $tab_options['type'] = $imported->menu_tab_default_parent_type; |
|
232 | - break; |
|
229 | + case 'tab': |
|
230 | + case 'normal': |
|
231 | + $tab_options['type'] = $imported->menu_tab_default_parent_type; |
|
232 | + break; |
|
233 | 233 | } |
234 | 234 | } |
235 | 235 | $tab_options['title'] = $imported->menu_parent_title; |
@@ -391,35 +391,35 @@ discard block |
||
391 | 391 | |
392 | 392 | function views1_convert_style(&$view, &$handler, $type) { |
393 | 393 | switch ($type) { |
394 | - case 'list': |
|
395 | - $handler->set_option('style_plugin', 'list'); |
|
396 | - $handler->set_option('style_options', array('type' => 'ul')); |
|
397 | - $handler->set_option('row_plugin', 'fields'); |
|
398 | - break; |
|
399 | - case 'node': |
|
400 | - $handler->set_option('row_plugin', 'node'); |
|
401 | - $handler->set_option('row_options', array('teaser' => FALSE, 'links' => TRUE)); |
|
402 | - break; |
|
403 | - case 'teaser': |
|
404 | - $handler->set_option('row_plugin', 'node'); |
|
405 | - $handler->set_option('row_options', array('teaser' => TRUE, 'links' => TRUE)); |
|
406 | - break; |
|
407 | - case 'table': |
|
408 | - $options = array(); |
|
409 | - $options['columns'] = array(); |
|
410 | - $options['default'] = ''; |
|
411 | - $options['info'] = array(); |
|
412 | - $options['override'] = FALSE; |
|
413 | - $options['order'] = 'asc'; |
|
414 | - |
|
415 | - $handler->set_option('style_plugin', 'table'); |
|
416 | - $handler->set_option('style_options', $options); |
|
417 | - break; |
|
418 | - default: |
|
419 | - // Ask around if anybody else knows. |
|
420 | - foreach (module_implements('views_convert') as $module) { |
|
421 | - module_invoke($module, 'views_convert', $handler->display->id, 'style', $view, $type); |
|
422 | - } |
|
394 | + case 'list': |
|
395 | + $handler->set_option('style_plugin', 'list'); |
|
396 | + $handler->set_option('style_options', array('type' => 'ul')); |
|
397 | + $handler->set_option('row_plugin', 'fields'); |
|
398 | + break; |
|
399 | + case 'node': |
|
400 | + $handler->set_option('row_plugin', 'node'); |
|
401 | + $handler->set_option('row_options', array('teaser' => FALSE, 'links' => TRUE)); |
|
402 | + break; |
|
403 | + case 'teaser': |
|
404 | + $handler->set_option('row_plugin', 'node'); |
|
405 | + $handler->set_option('row_options', array('teaser' => TRUE, 'links' => TRUE)); |
|
406 | + break; |
|
407 | + case 'table': |
|
408 | + $options = array(); |
|
409 | + $options['columns'] = array(); |
|
410 | + $options['default'] = ''; |
|
411 | + $options['info'] = array(); |
|
412 | + $options['override'] = FALSE; |
|
413 | + $options['order'] = 'asc'; |
|
414 | + |
|
415 | + $handler->set_option('style_plugin', 'table'); |
|
416 | + $handler->set_option('style_options', $options); |
|
417 | + break; |
|
418 | + default: |
|
419 | + // Ask around if anybody else knows. |
|
420 | + foreach (module_implements('views_convert') as $module) { |
|
421 | + module_invoke($module, 'views_convert', $handler->display->id, 'style', $view, $type); |
|
422 | + } |
|
423 | 423 | } |
424 | 424 | } |
425 | 425 | /** |
@@ -80,22 +80,22 @@ discard block |
||
80 | 80 | */ |
81 | 81 | function cache_set($type) { |
82 | 82 | switch ($type) { |
83 | - case 'query': |
|
84 | - // Not supported currently, but this is certainly where we'd put it. |
|
85 | - break; |
|
86 | - case 'results': |
|
87 | - $data = array( |
|
88 | - 'result' => $this->view->result, |
|
89 | - 'total_rows' => $this->view->total_rows, |
|
90 | - 'pager' => $this->view->pager, |
|
91 | - ); |
|
92 | - cache_set($this->get_results_key(), $data, $this->table, $this->cache_set_expire($type)); |
|
93 | - break; |
|
94 | - case 'output': |
|
95 | - $this->gather_headers(); |
|
96 | - $this->storage['output'] = $this->view->display_handler->output; |
|
97 | - cache_set($this->get_output_key(), $this->storage, $this->table, $this->cache_set_expire($type)); |
|
98 | - break; |
|
83 | + case 'query': |
|
84 | + // Not supported currently, but this is certainly where we'd put it. |
|
85 | + break; |
|
86 | + case 'results': |
|
87 | + $data = array( |
|
88 | + 'result' => $this->view->result, |
|
89 | + 'total_rows' => $this->view->total_rows, |
|
90 | + 'pager' => $this->view->pager, |
|
91 | + ); |
|
92 | + cache_set($this->get_results_key(), $data, $this->table, $this->cache_set_expire($type)); |
|
93 | + break; |
|
94 | + case 'output': |
|
95 | + $this->gather_headers(); |
|
96 | + $this->storage['output'] = $this->view->display_handler->output; |
|
97 | + cache_set($this->get_output_key(), $this->storage, $this->table, $this->cache_set_expire($type)); |
|
98 | + break; |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 | |
@@ -108,32 +108,32 @@ discard block |
||
108 | 108 | function cache_get($type) { |
109 | 109 | $cutoff = $this->cache_expire($type); |
110 | 110 | switch ($type) { |
111 | - case 'query': |
|
112 | - // Not supported currently, but this is certainly where we'd put it. |
|
113 | - return FALSE; |
|
114 | - case 'results': |
|
115 | - // Values to set: $view->result, $view->total_rows, $view->execute_time, |
|
116 | - // $view->pager['current_page']. |
|
117 | - if ($cache = cache_get($this->get_results_key(), $this->table)) { |
|
118 | - if (!$cutoff || $cache->created > $cutoff) { |
|
119 | - $this->view->result = $cache->data['result']; |
|
120 | - $this->view->total_rows = $cache->data['total_rows']; |
|
121 | - $this->view->pager = $cache->data['pager']; |
|
122 | - $this->view->execute_time = 0; |
|
123 | - return TRUE; |
|
124 | - } |
|
111 | + case 'query': |
|
112 | + // Not supported currently, but this is certainly where we'd put it. |
|
113 | + return FALSE; |
|
114 | + case 'results': |
|
115 | + // Values to set: $view->result, $view->total_rows, $view->execute_time, |
|
116 | + // $view->pager['current_page']. |
|
117 | + if ($cache = cache_get($this->get_results_key(), $this->table)) { |
|
118 | + if (!$cutoff || $cache->created > $cutoff) { |
|
119 | + $this->view->result = $cache->data['result']; |
|
120 | + $this->view->total_rows = $cache->data['total_rows']; |
|
121 | + $this->view->pager = $cache->data['pager']; |
|
122 | + $this->view->execute_time = 0; |
|
123 | + return TRUE; |
|
125 | 124 | } |
126 | - return FALSE; |
|
127 | - case 'output': |
|
128 | - if ($cache = cache_get($this->get_output_key(), $this->table)) { |
|
129 | - if (!$cutoff || $cache->created > $cutoff) { |
|
130 | - $this->storage = $cache->data; |
|
131 | - $this->view->display_handler->output = $cache->data['output']; |
|
132 | - $this->restore_headers(); |
|
133 | - return TRUE; |
|
134 | - } |
|
125 | + } |
|
126 | + return FALSE; |
|
127 | + case 'output': |
|
128 | + if ($cache = cache_get($this->get_output_key(), $this->table)) { |
|
129 | + if (!$cutoff || $cache->created > $cutoff) { |
|
130 | + $this->storage = $cache->data; |
|
131 | + $this->view->display_handler->output = $cache->data['output']; |
|
132 | + $this->restore_headers(); |
|
133 | + return TRUE; |
|
135 | 134 | } |
136 | - return FALSE; |
|
135 | + } |
|
136 | + return FALSE; |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
@@ -221,16 +221,16 @@ discard block |
||
221 | 221 | foreach ($types as $id => $info) { |
222 | 222 | if (!isset($start[$scope][$type][$id])) { |
223 | 223 | switch ($type) { |
224 | - case 'setting': |
|
225 | - $this->storage['js'][] = array($info, $type, $scope); |
|
226 | - break; |
|
224 | + case 'setting': |
|
225 | + $this->storage['js'][] = array($info, $type, $scope); |
|
226 | + break; |
|
227 | 227 | |
228 | - case 'inline': |
|
229 | - $this->storage['js'][] = array($info['code'], $type, $scope, $info['defer']); |
|
230 | - break; |
|
228 | + case 'inline': |
|
229 | + $this->storage['js'][] = array($info['code'], $type, $scope, $info['defer']); |
|
230 | + break; |
|
231 | 231 | |
232 | - default: |
|
233 | - $this->storage['js'][] = array($id, $type, $scope, $info['defer'], $info['cache']); |
|
232 | + default: |
|
233 | + $this->storage['js'][] = array($id, $type, $scope, $info['defer'], $info['cache']); |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 | } |
@@ -903,534 +903,534 @@ discard block |
||
903 | 903 | } |
904 | 904 | |
905 | 905 | switch ($form_state['section']) { |
906 | - case 'display_title': |
|
907 | - $form['#title'] .= t('The name of this display'); |
|
908 | - $form['display_title'] = array( |
|
909 | - '#type' => 'textfield', |
|
910 | - '#description' => t('This title will appear only in the administrative interface for the View.'), |
|
911 | - '#default_value' => $this->display->display_title, |
|
912 | - ); |
|
913 | - break; |
|
914 | - case 'title': |
|
915 | - $form['#title'] .= t('The title of this view'); |
|
916 | - $form['title'] = array( |
|
917 | - '#type' => 'textfield', |
|
918 | - '#description' => t('This title will be displayed with the view, wherever titles are normally displayed; i.e, as the page title, block title, etc.'), |
|
919 | - '#default_value' => $this->get_option('title'), |
|
920 | - ); |
|
921 | - break; |
|
922 | - case 'css_class': |
|
923 | - $form['#title'] .= t('CSS class'); |
|
924 | - $form['css_class'] = array( |
|
925 | - '#type' => 'textfield', |
|
926 | - '#description' => t('The CSS class names will be added to the view. This enables you to use specific CSS code for each view. You may define multiples classes separated by spaces.'), |
|
927 | - '#default_value' => $this->get_option('css_class'), |
|
928 | - ); |
|
929 | - break; |
|
930 | - case 'use_ajax': |
|
931 | - $form['#title'] .= t('Use AJAX when available to load this view'); |
|
932 | - $form['description'] = array( |
|
933 | - '#prefix' => '<div class="description form-item">', |
|
934 | - '#suffix' => '</div>', |
|
935 | - '#value' => t('If set, this view will use an AJAX mechanism for paging, table sorting and exposed filters. This means the entire page will not refresh. It is not recommended that you use this if this view is the main content of the page as it will prevent deep linking to specific pages, but it is very useful for side content.'), |
|
936 | - ); |
|
937 | - $form['use_ajax'] = array( |
|
938 | - '#type' => 'radios', |
|
939 | - '#options' => array(1 => t('Yes'), 0 => t('No')), |
|
940 | - '#default_value' => $this->get_option('use_ajax') ? 1 : 0, |
|
941 | - ); |
|
942 | - break; |
|
943 | - case 'use_pager': |
|
944 | - $form['#title'] .= t('Use a pager for this view'); |
|
945 | - $form['use_pager'] = array( |
|
946 | - '#type' => 'radios', |
|
947 | - '#options' => array(TRUE => t('Full pager'), 'mini' => t('Mini pager'), 0 => t('No')), |
|
948 | - '#default_value' => $this->get_option('use_pager'), |
|
949 | - ); |
|
950 | - $form['pager_element'] = array( |
|
951 | - '#type' => 'textfield', |
|
952 | - '#title' => t('Pager element'), |
|
953 | - '#description' => t("Unless you're experiencing problems with pagers related to this view, you should leave this at 0. If using multiple pagers on one page you may need to set this number to a higher value so as not to conflict within the ?page= array. Large values will add a lot of commas to your URLs, so avoid if possible."), |
|
954 | - '#default_value' => intval($this->get_option('pager_element')), |
|
955 | - ); |
|
956 | - break; |
|
957 | - case 'items_per_page': |
|
958 | - $form['#title'] .= $this->use_pager() ? t('Items per page') : t('Items to display'); |
|
959 | - |
|
960 | - $form['items_per_page'] = array( |
|
961 | - '#type' => 'textfield', |
|
962 | - '#description' => t('The number of items to display per page. Enter 0 for no limit.'), |
|
963 | - '#default_value' => intval($this->get_option('items_per_page')), |
|
964 | - ); |
|
965 | - $form['offset'] = array( |
|
966 | - '#type' => 'textfield', |
|
967 | - '#title' => t('Offset'), |
|
968 | - '#description' => t('The number of items to skip. For example, if this field is 3, the first 3 items will be skipped and not displayed. Offset can not be used if items to display is 0; instead use a very large number there.'), |
|
969 | - '#default_value' => intval($this->get_option('offset')), |
|
970 | - ); |
|
971 | - break; |
|
972 | - case 'use_more': |
|
973 | - $form['#title'] .= t('Add a more link to the bottom of the display.'); |
|
974 | - $form['use_more'] = array( |
|
975 | - '#type' => 'checkbox', |
|
976 | - '#title' => t('Create more link'), |
|
977 | - '#description' => t("This will add a more link to the bottom of this view, which will link to the page view. If you have more than one page view, the link will point to the display specified in 'Link display' above."), |
|
978 | - '#default_value' => $this->get_option('use_more'), |
|
979 | - ); |
|
980 | - $form['use_more_always'] = array( |
|
981 | - '#type' => 'checkbox', |
|
982 | - '#title' => t('Always display more link'), |
|
983 | - '#description' => t("This will display the more link even if there are no more items to display."), |
|
984 | - '#default_value' => $this->get_option('use_more_always'), |
|
985 | - ); |
|
986 | - $form['use_more_text'] = array( |
|
987 | - '#type' => 'textfield', |
|
988 | - '#title' => t('More link text'), |
|
989 | - '#description' => t("The text to display for the more link."), |
|
990 | - '#default_value' => $this->get_option('use_more_text'), |
|
991 | - ); |
|
992 | - break; |
|
993 | - case 'distinct': |
|
994 | - $form['#title'] .= t('Display only distinct items, without duplicates.'); |
|
995 | - $form['distinct'] = array( |
|
996 | - '#type' => 'checkbox', |
|
997 | - '#title' => t('Distinct'), |
|
998 | - '#description' => t('This will make the view display only distinct items. If there are multiple identical items, each will be displayed only once. You can use this to try and remove duplicates from a view, though it does not always work. Note that this can slow queries down, so use it with caution.'), |
|
999 | - '#default_value' => $this->get_option('distinct'), |
|
1000 | - ); |
|
1001 | - break; |
|
1002 | - case 'access': |
|
1003 | - $form['#title'] .= t('Access restrictions'); |
|
1004 | - $form['access'] = array( |
|
1005 | - '#prefix' => '<div class="clear-block">', |
|
1006 | - '#suffix' => '</div>', |
|
1007 | - '#tree' => TRUE, |
|
1008 | - ); |
|
1009 | - |
|
1010 | - $access = $this->get_option('access'); |
|
1011 | - $form['access']['type'] = array( |
|
1012 | - '#type' => 'radios', |
|
1013 | - '#options' => views_fetch_plugin_names('access'), |
|
1014 | - '#default_value' => $access['type'], |
|
1015 | - ); |
|
906 | + case 'display_title': |
|
907 | + $form['#title'] .= t('The name of this display'); |
|
908 | + $form['display_title'] = array( |
|
909 | + '#type' => 'textfield', |
|
910 | + '#description' => t('This title will appear only in the administrative interface for the View.'), |
|
911 | + '#default_value' => $this->display->display_title, |
|
912 | + ); |
|
913 | + break; |
|
914 | + case 'title': |
|
915 | + $form['#title'] .= t('The title of this view'); |
|
916 | + $form['title'] = array( |
|
917 | + '#type' => 'textfield', |
|
918 | + '#description' => t('This title will be displayed with the view, wherever titles are normally displayed; i.e, as the page title, block title, etc.'), |
|
919 | + '#default_value' => $this->get_option('title'), |
|
920 | + ); |
|
921 | + break; |
|
922 | + case 'css_class': |
|
923 | + $form['#title'] .= t('CSS class'); |
|
924 | + $form['css_class'] = array( |
|
925 | + '#type' => 'textfield', |
|
926 | + '#description' => t('The CSS class names will be added to the view. This enables you to use specific CSS code for each view. You may define multiples classes separated by spaces.'), |
|
927 | + '#default_value' => $this->get_option('css_class'), |
|
928 | + ); |
|
929 | + break; |
|
930 | + case 'use_ajax': |
|
931 | + $form['#title'] .= t('Use AJAX when available to load this view'); |
|
932 | + $form['description'] = array( |
|
933 | + '#prefix' => '<div class="description form-item">', |
|
934 | + '#suffix' => '</div>', |
|
935 | + '#value' => t('If set, this view will use an AJAX mechanism for paging, table sorting and exposed filters. This means the entire page will not refresh. It is not recommended that you use this if this view is the main content of the page as it will prevent deep linking to specific pages, but it is very useful for side content.'), |
|
936 | + ); |
|
937 | + $form['use_ajax'] = array( |
|
938 | + '#type' => 'radios', |
|
939 | + '#options' => array(1 => t('Yes'), 0 => t('No')), |
|
940 | + '#default_value' => $this->get_option('use_ajax') ? 1 : 0, |
|
941 | + ); |
|
942 | + break; |
|
943 | + case 'use_pager': |
|
944 | + $form['#title'] .= t('Use a pager for this view'); |
|
945 | + $form['use_pager'] = array( |
|
946 | + '#type' => 'radios', |
|
947 | + '#options' => array(TRUE => t('Full pager'), 'mini' => t('Mini pager'), 0 => t('No')), |
|
948 | + '#default_value' => $this->get_option('use_pager'), |
|
949 | + ); |
|
950 | + $form['pager_element'] = array( |
|
951 | + '#type' => 'textfield', |
|
952 | + '#title' => t('Pager element'), |
|
953 | + '#description' => t("Unless you're experiencing problems with pagers related to this view, you should leave this at 0. If using multiple pagers on one page you may need to set this number to a higher value so as not to conflict within the ?page= array. Large values will add a lot of commas to your URLs, so avoid if possible."), |
|
954 | + '#default_value' => intval($this->get_option('pager_element')), |
|
955 | + ); |
|
956 | + break; |
|
957 | + case 'items_per_page': |
|
958 | + $form['#title'] .= $this->use_pager() ? t('Items per page') : t('Items to display'); |
|
1016 | 959 | |
1017 | - $access_plugin = views_fetch_plugin_data('access', $access['type']); |
|
1018 | - if (!empty($access_plugin['uses options'])) { |
|
1019 | - $form['markup'] = array( |
|
1020 | - '#prefix' => '<div class="form-item description">', |
|
1021 | - '#suffix' => '</div>', |
|
1022 | - '#value' => t('You may also adjust the !settings for the currently selected access restriction by clicking on the icon.', array('!settings' => $this->option_link(t('settings'), 'access_options'))), |
|
1023 | - ); |
|
1024 | - } |
|
960 | + $form['items_per_page'] = array( |
|
961 | + '#type' => 'textfield', |
|
962 | + '#description' => t('The number of items to display per page. Enter 0 for no limit.'), |
|
963 | + '#default_value' => intval($this->get_option('items_per_page')), |
|
964 | + ); |
|
965 | + $form['offset'] = array( |
|
966 | + '#type' => 'textfield', |
|
967 | + '#title' => t('Offset'), |
|
968 | + '#description' => t('The number of items to skip. For example, if this field is 3, the first 3 items will be skipped and not displayed. Offset can not be used if items to display is 0; instead use a very large number there.'), |
|
969 | + '#default_value' => intval($this->get_option('offset')), |
|
970 | + ); |
|
971 | + break; |
|
972 | + case 'use_more': |
|
973 | + $form['#title'] .= t('Add a more link to the bottom of the display.'); |
|
974 | + $form['use_more'] = array( |
|
975 | + '#type' => 'checkbox', |
|
976 | + '#title' => t('Create more link'), |
|
977 | + '#description' => t("This will add a more link to the bottom of this view, which will link to the page view. If you have more than one page view, the link will point to the display specified in 'Link display' above."), |
|
978 | + '#default_value' => $this->get_option('use_more'), |
|
979 | + ); |
|
980 | + $form['use_more_always'] = array( |
|
981 | + '#type' => 'checkbox', |
|
982 | + '#title' => t('Always display more link'), |
|
983 | + '#description' => t("This will display the more link even if there are no more items to display."), |
|
984 | + '#default_value' => $this->get_option('use_more_always'), |
|
985 | + ); |
|
986 | + $form['use_more_text'] = array( |
|
987 | + '#type' => 'textfield', |
|
988 | + '#title' => t('More link text'), |
|
989 | + '#description' => t("The text to display for the more link."), |
|
990 | + '#default_value' => $this->get_option('use_more_text'), |
|
991 | + ); |
|
992 | + break; |
|
993 | + case 'distinct': |
|
994 | + $form['#title'] .= t('Display only distinct items, without duplicates.'); |
|
995 | + $form['distinct'] = array( |
|
996 | + '#type' => 'checkbox', |
|
997 | + '#title' => t('Distinct'), |
|
998 | + '#description' => t('This will make the view display only distinct items. If there are multiple identical items, each will be displayed only once. You can use this to try and remove duplicates from a view, though it does not always work. Note that this can slow queries down, so use it with caution.'), |
|
999 | + '#default_value' => $this->get_option('distinct'), |
|
1000 | + ); |
|
1001 | + break; |
|
1002 | + case 'access': |
|
1003 | + $form['#title'] .= t('Access restrictions'); |
|
1004 | + $form['access'] = array( |
|
1005 | + '#prefix' => '<div class="clear-block">', |
|
1006 | + '#suffix' => '</div>', |
|
1007 | + '#tree' => TRUE, |
|
1008 | + ); |
|
1025 | 1009 | |
1026 | - break; |
|
1027 | - case 'access_options': |
|
1028 | - $access = $this->get_option('access'); |
|
1029 | - $plugin = $this->get_access_plugin(); |
|
1030 | - $form['#title'] .= t('Access options'); |
|
1031 | - if ($plugin) { |
|
1032 | - $form['#help_topic'] = $plugin->definition['help topic']; |
|
1033 | - $form['#help_module'] = $plugin->definition['module']; |
|
1010 | + $access = $this->get_option('access'); |
|
1011 | + $form['access']['type'] = array( |
|
1012 | + '#type' => 'radios', |
|
1013 | + '#options' => views_fetch_plugin_names('access'), |
|
1014 | + '#default_value' => $access['type'], |
|
1015 | + ); |
|
1034 | 1016 | |
1035 | - $form['access_options'] = array( |
|
1036 | - '#tree' => TRUE, |
|
1037 | - ); |
|
1038 | - $form['access_options']['type'] = array( |
|
1039 | - '#type' => 'value', |
|
1040 | - '#value' => $access['type'], |
|
1041 | - ); |
|
1042 | - $plugin->options_form($form['access_options'], $form_state); |
|
1043 | - } |
|
1044 | - break; |
|
1045 | - case 'cache': |
|
1046 | - $form['#title'] .= t('Caching'); |
|
1047 | - $form['cache'] = array( |
|
1048 | - '#prefix' => '<div class="clear-block">', |
|
1017 | + $access_plugin = views_fetch_plugin_data('access', $access['type']); |
|
1018 | + if (!empty($access_plugin['uses options'])) { |
|
1019 | + $form['markup'] = array( |
|
1020 | + '#prefix' => '<div class="form-item description">', |
|
1049 | 1021 | '#suffix' => '</div>', |
1050 | - '#tree' => TRUE, |
|
1051 | - ); |
|
1052 | - |
|
1053 | - $cache = $this->get_option('cache'); |
|
1054 | - $form['cache']['type'] = array( |
|
1055 | - '#type' => 'radios', |
|
1056 | - '#options' => views_fetch_plugin_names('cache'), |
|
1057 | - '#default_value' => $cache['type'], |
|
1022 | + '#value' => t('You may also adjust the !settings for the currently selected access restriction by clicking on the icon.', array('!settings' => $this->option_link(t('settings'), 'access_options'))), |
|
1058 | 1023 | ); |
1024 | + } |
|
1059 | 1025 | |
1060 | - $cache_plugin = views_fetch_plugin_data('cache', $cache['type']); |
|
1061 | - if (!empty($cache_plugin['uses options'])) { |
|
1062 | - $form['markup'] = array( |
|
1063 | - '#prefix' => '<div class="form-item description">', |
|
1064 | - '#suffix' => '</div>', |
|
1065 | - '#value' => t('You may also adjust the !settings for the currently selected cache mechanism by clicking on the icon.', array('!settings' => $this->option_link(t('settings'), 'cache_options'))), |
|
1066 | - ); |
|
1067 | - } |
|
1068 | - break; |
|
1069 | - case 'cache_options': |
|
1070 | - $cache = $this->get_option('cache'); |
|
1071 | - $plugin = $this->get_cache_plugin(); |
|
1072 | - $form['#title'] .= t('Caching options'); |
|
1073 | - if ($plugin) { |
|
1074 | - $form['#help_topic'] = $plugin->definition['help topic']; |
|
1075 | - $form['#help_module'] = $plugin->definition['module']; |
|
1026 | + break; |
|
1027 | + case 'access_options': |
|
1028 | + $access = $this->get_option('access'); |
|
1029 | + $plugin = $this->get_access_plugin(); |
|
1030 | + $form['#title'] .= t('Access options'); |
|
1031 | + if ($plugin) { |
|
1032 | + $form['#help_topic'] = $plugin->definition['help topic']; |
|
1033 | + $form['#help_module'] = $plugin->definition['module']; |
|
1076 | 1034 | |
1077 | - $form['cache_options'] = array( |
|
1078 | - '#tree' => TRUE, |
|
1079 | - ); |
|
1080 | - $form['cache_options']['type'] = array( |
|
1081 | - '#type' => 'value', |
|
1082 | - '#value' => $cache['type'], |
|
1083 | - ); |
|
1084 | - $plugin->options_form($form['cache_options'], $form_state); |
|
1085 | - } |
|
1086 | - break; |
|
1087 | - case 'header': |
|
1088 | - $form['#title'] .= t('Header'); |
|
1089 | - $form['header_empty'] = array( |
|
1090 | - '#type' => 'checkbox', |
|
1091 | - '#title' => t('Display even if view has no result'), |
|
1092 | - '#default_value' => $this->get_option('header_empty'), |
|
1035 | + $form['access_options'] = array( |
|
1036 | + '#tree' => TRUE, |
|
1093 | 1037 | ); |
1094 | - $form['header'] = array( |
|
1095 | - '#type' => 'textarea', |
|
1096 | - '#default_value' => $this->get_option('header'), |
|
1097 | - '#rows' => 6, |
|
1098 | - '#description' => t('Text to display at the top of the view. May contain an explanation or links or whatever you like. Optional.'), |
|
1038 | + $form['access_options']['type'] = array( |
|
1039 | + '#type' => 'value', |
|
1040 | + '#value' => $access['type'], |
|
1099 | 1041 | ); |
1042 | + $plugin->options_form($form['access_options'], $form_state); |
|
1043 | + } |
|
1044 | + break; |
|
1045 | + case 'cache': |
|
1046 | + $form['#title'] .= t('Caching'); |
|
1047 | + $form['cache'] = array( |
|
1048 | + '#prefix' => '<div class="clear-block">', |
|
1049 | + '#suffix' => '</div>', |
|
1050 | + '#tree' => TRUE, |
|
1051 | + ); |
|
1100 | 1052 | |
1101 | - $form['header_format'] = filter_form($this->get_option('header_format'), NULL, array('header_format')); |
|
1102 | - break; |
|
1103 | - case 'footer': |
|
1104 | - $form['#title'] .= t('Footer'); |
|
1105 | - $form['footer_empty'] = array( |
|
1106 | - '#type' => 'checkbox', |
|
1107 | - '#title' => t('Display even if view has no result'), |
|
1108 | - '#default_value' => $this->get_option('footer_empty'), |
|
1109 | - ); |
|
1110 | - $form['footer'] = array( |
|
1111 | - '#type' => 'textarea', |
|
1112 | - '#default_value' => $this->get_option('footer'), |
|
1113 | - '#rows' => 6, |
|
1114 | - '#description' => t('Text to display beneath the view. May contain an explanation or links or whatever you like. Optional.'), |
|
1115 | - ); |
|
1053 | + $cache = $this->get_option('cache'); |
|
1054 | + $form['cache']['type'] = array( |
|
1055 | + '#type' => 'radios', |
|
1056 | + '#options' => views_fetch_plugin_names('cache'), |
|
1057 | + '#default_value' => $cache['type'], |
|
1058 | + ); |
|
1116 | 1059 | |
1117 | - $form['footer_format'] = filter_form($this->get_option('footer_format'), NULL, array('footer_format')); |
|
1118 | - break; |
|
1119 | - case 'empty': |
|
1120 | - $form['#title'] .= t('Empty text'); |
|
1121 | - $form['empty'] = array( |
|
1122 | - '#type' => 'textarea', |
|
1123 | - '#default_value' => $this->get_option('empty'), |
|
1124 | - '#rows' => 6, |
|
1125 | - '#description' => t('Text to display if the view has no results. Optional.'), |
|
1060 | + $cache_plugin = views_fetch_plugin_data('cache', $cache['type']); |
|
1061 | + if (!empty($cache_plugin['uses options'])) { |
|
1062 | + $form['markup'] = array( |
|
1063 | + '#prefix' => '<div class="form-item description">', |
|
1064 | + '#suffix' => '</div>', |
|
1065 | + '#value' => t('You may also adjust the !settings for the currently selected cache mechanism by clicking on the icon.', array('!settings' => $this->option_link(t('settings'), 'cache_options'))), |
|
1126 | 1066 | ); |
1067 | + } |
|
1068 | + break; |
|
1069 | + case 'cache_options': |
|
1070 | + $cache = $this->get_option('cache'); |
|
1071 | + $plugin = $this->get_cache_plugin(); |
|
1072 | + $form['#title'] .= t('Caching options'); |
|
1073 | + if ($plugin) { |
|
1074 | + $form['#help_topic'] = $plugin->definition['help topic']; |
|
1075 | + $form['#help_module'] = $plugin->definition['module']; |
|
1127 | 1076 | |
1128 | - $form['empty_format'] = filter_form($this->get_option('empty_format'), NULL, array('empty_format')); |
|
1129 | - break; |
|
1130 | - case 'style_plugin': |
|
1131 | - $form['#title'] .= t('How should this view be styled'); |
|
1132 | - $form['#help_topic'] = 'style'; |
|
1133 | - $form['style_plugin'] = array( |
|
1134 | - '#type' => 'radios', |
|
1135 | - '#options' => views_fetch_plugin_names('style', $this->get_style_type(), array($this->view->base_table)), |
|
1136 | - '#default_value' => $this->get_option('style_plugin'), |
|
1137 | - '#description' => t('If the style you choose has settings, be sure to click the settings button that will appear next to it in the View summary.'), |
|
1077 | + $form['cache_options'] = array( |
|
1078 | + '#tree' => TRUE, |
|
1138 | 1079 | ); |
1080 | + $form['cache_options']['type'] = array( |
|
1081 | + '#type' => 'value', |
|
1082 | + '#value' => $cache['type'], |
|
1083 | + ); |
|
1084 | + $plugin->options_form($form['cache_options'], $form_state); |
|
1085 | + } |
|
1086 | + break; |
|
1087 | + case 'header': |
|
1088 | + $form['#title'] .= t('Header'); |
|
1089 | + $form['header_empty'] = array( |
|
1090 | + '#type' => 'checkbox', |
|
1091 | + '#title' => t('Display even if view has no result'), |
|
1092 | + '#default_value' => $this->get_option('header_empty'), |
|
1093 | + ); |
|
1094 | + $form['header'] = array( |
|
1095 | + '#type' => 'textarea', |
|
1096 | + '#default_value' => $this->get_option('header'), |
|
1097 | + '#rows' => 6, |
|
1098 | + '#description' => t('Text to display at the top of the view. May contain an explanation or links or whatever you like. Optional.'), |
|
1099 | + ); |
|
1139 | 1100 | |
1140 | - $style_plugin = views_fetch_plugin_data('style', $this->get_option('style_plugin')); |
|
1141 | - if (!empty($style_plugin['uses options'])) { |
|
1142 | - $form['markup'] = array( |
|
1143 | - '#prefix' => '<div class="form-item description">', |
|
1144 | - '#suffix' => '</div>', |
|
1145 | - '#value' => t('You may also adjust the !settings for the currently selected style by clicking on the icon.', array('!settings' => $this->option_link(t('settings'), 'style_options'))), |
|
1146 | - ); |
|
1147 | - } |
|
1101 | + $form['header_format'] = filter_form($this->get_option('header_format'), NULL, array('header_format')); |
|
1102 | + break; |
|
1103 | + case 'footer': |
|
1104 | + $form['#title'] .= t('Footer'); |
|
1105 | + $form['footer_empty'] = array( |
|
1106 | + '#type' => 'checkbox', |
|
1107 | + '#title' => t('Display even if view has no result'), |
|
1108 | + '#default_value' => $this->get_option('footer_empty'), |
|
1109 | + ); |
|
1110 | + $form['footer'] = array( |
|
1111 | + '#type' => 'textarea', |
|
1112 | + '#default_value' => $this->get_option('footer'), |
|
1113 | + '#rows' => 6, |
|
1114 | + '#description' => t('Text to display beneath the view. May contain an explanation or links or whatever you like. Optional.'), |
|
1115 | + ); |
|
1148 | 1116 | |
1149 | - break; |
|
1150 | - case 'style_options': |
|
1151 | - $form['#title'] .= t('Style options'); |
|
1152 | - $style = TRUE; |
|
1153 | - $type = 'style_plugin'; |
|
1154 | - $name = $this->get_option('style_plugin'); |
|
1117 | + $form['footer_format'] = filter_form($this->get_option('footer_format'), NULL, array('footer_format')); |
|
1118 | + break; |
|
1119 | + case 'empty': |
|
1120 | + $form['#title'] .= t('Empty text'); |
|
1121 | + $form['empty'] = array( |
|
1122 | + '#type' => 'textarea', |
|
1123 | + '#default_value' => $this->get_option('empty'), |
|
1124 | + '#rows' => 6, |
|
1125 | + '#description' => t('Text to display if the view has no results. Optional.'), |
|
1126 | + ); |
|
1155 | 1127 | |
1156 | - case 'row_options': |
|
1157 | - if (!isset($name)) { |
|
1158 | - $name = $this->get_option('row_plugin'); |
|
1159 | - } |
|
1160 | - // if row, $style will be empty. |
|
1161 | - if (empty($style)) { |
|
1162 | - $form['#title'] .= t('Row style options'); |
|
1163 | - $type = 'row_plugin'; |
|
1164 | - } |
|
1165 | - $plugin = $this->get_plugin(empty($style) ? 'row' : 'style'); |
|
1166 | - if ($plugin) { |
|
1167 | - if (isset($plugin->definition['help topic'])) { |
|
1168 | - $form['#help_topic'] = $plugin->definition['help topic']; |
|
1169 | - $form['#help_module'] = $plugin->definition['module']; |
|
1170 | - } |
|
1171 | - $form[$form_state['section']] = array( |
|
1172 | - '#tree' => TRUE, |
|
1173 | - ); |
|
1174 | - $plugin->options_form($form[$form_state['section']], $form_state); |
|
1175 | - } |
|
1176 | - break; |
|
1177 | - case 'row_plugin': |
|
1178 | - $form['#title'] .= t('How should each row in this view be styled'); |
|
1179 | - $form['#help_topic'] = 'style-row'; |
|
1180 | - $form['row_plugin'] = array( |
|
1181 | - '#type' => 'radios', |
|
1182 | - '#options' => views_fetch_plugin_names('row', $this->get_style_type(), array($this->view->base_table)), |
|
1183 | - '#default_value' => $this->get_option('row_plugin'), |
|
1128 | + $form['empty_format'] = filter_form($this->get_option('empty_format'), NULL, array('empty_format')); |
|
1129 | + break; |
|
1130 | + case 'style_plugin': |
|
1131 | + $form['#title'] .= t('How should this view be styled'); |
|
1132 | + $form['#help_topic'] = 'style'; |
|
1133 | + $form['style_plugin'] = array( |
|
1134 | + '#type' => 'radios', |
|
1135 | + '#options' => views_fetch_plugin_names('style', $this->get_style_type(), array($this->view->base_table)), |
|
1136 | + '#default_value' => $this->get_option('style_plugin'), |
|
1137 | + '#description' => t('If the style you choose has settings, be sure to click the settings button that will appear next to it in the View summary.'), |
|
1138 | + ); |
|
1139 | + |
|
1140 | + $style_plugin = views_fetch_plugin_data('style', $this->get_option('style_plugin')); |
|
1141 | + if (!empty($style_plugin['uses options'])) { |
|
1142 | + $form['markup'] = array( |
|
1143 | + '#prefix' => '<div class="form-item description">', |
|
1144 | + '#suffix' => '</div>', |
|
1145 | + '#value' => t('You may also adjust the !settings for the currently selected style by clicking on the icon.', array('!settings' => $this->option_link(t('settings'), 'style_options'))), |
|
1184 | 1146 | ); |
1147 | + } |
|
1185 | 1148 | |
1186 | - $row_plugin = views_fetch_plugin_data('row', $this->get_option('row_plugin')); |
|
1187 | - if (!empty($row_plugin['uses options'])) { |
|
1188 | - $form['markup'] = array( |
|
1189 | - '#prefix' => '<div class="form-item description">', |
|
1190 | - '#suffix' => '</div>', |
|
1191 | - '#value' => t('You may also adjust the !settings for the currently selected row style by clicking on the icon.', array('!settings' => $this->option_link(t('settings'), 'row_options'))), |
|
1192 | - ); |
|
1149 | + break; |
|
1150 | + case 'style_options': |
|
1151 | + $form['#title'] .= t('Style options'); |
|
1152 | + $style = TRUE; |
|
1153 | + $type = 'style_plugin'; |
|
1154 | + $name = $this->get_option('style_plugin'); |
|
1155 | + |
|
1156 | + case 'row_options': |
|
1157 | + if (!isset($name)) { |
|
1158 | + $name = $this->get_option('row_plugin'); |
|
1159 | + } |
|
1160 | + // if row, $style will be empty. |
|
1161 | + if (empty($style)) { |
|
1162 | + $form['#title'] .= t('Row style options'); |
|
1163 | + $type = 'row_plugin'; |
|
1164 | + } |
|
1165 | + $plugin = $this->get_plugin(empty($style) ? 'row' : 'style'); |
|
1166 | + if ($plugin) { |
|
1167 | + if (isset($plugin->definition['help topic'])) { |
|
1168 | + $form['#help_topic'] = $plugin->definition['help topic']; |
|
1169 | + $form['#help_module'] = $plugin->definition['module']; |
|
1193 | 1170 | } |
1171 | + $form[$form_state['section']] = array( |
|
1172 | + '#tree' => TRUE, |
|
1173 | + ); |
|
1174 | + $plugin->options_form($form[$form_state['section']], $form_state); |
|
1175 | + } |
|
1176 | + break; |
|
1177 | + case 'row_plugin': |
|
1178 | + $form['#title'] .= t('How should each row in this view be styled'); |
|
1179 | + $form['#help_topic'] = 'style-row'; |
|
1180 | + $form['row_plugin'] = array( |
|
1181 | + '#type' => 'radios', |
|
1182 | + '#options' => views_fetch_plugin_names('row', $this->get_style_type(), array($this->view->base_table)), |
|
1183 | + '#default_value' => $this->get_option('row_plugin'), |
|
1184 | + ); |
|
1194 | 1185 | |
1195 | - break; |
|
1196 | - case 'link_display': |
|
1197 | - $form['#title'] .= t('Which display to use for path'); |
|
1198 | - foreach ($this->view->display as $display_id => $display) { |
|
1199 | - if ($display->handler->has_path()) { |
|
1200 | - $options[$display_id] = $display->display_title; |
|
1201 | - } |
|
1202 | - } |
|
1203 | - $form['link_display'] = array( |
|
1204 | - '#type' => 'radios', |
|
1205 | - '#options' => $options, |
|
1206 | - '#description' => t("Which display to use to get this display's path for things like summary links, rss feed links, more links, etc."), |
|
1207 | - '#default_value' => $this->get_link_display(), |
|
1186 | + $row_plugin = views_fetch_plugin_data('row', $this->get_option('row_plugin')); |
|
1187 | + if (!empty($row_plugin['uses options'])) { |
|
1188 | + $form['markup'] = array( |
|
1189 | + '#prefix' => '<div class="form-item description">', |
|
1190 | + '#suffix' => '</div>', |
|
1191 | + '#value' => t('You may also adjust the !settings for the currently selected row style by clicking on the icon.', array('!settings' => $this->option_link(t('settings'), 'row_options'))), |
|
1208 | 1192 | ); |
1209 | - break; |
|
1210 | - case 'analyze-theme': |
|
1211 | - $form['#title'] .= t('Theming information'); |
|
1212 | - $form['#help_topic'] = 'analyze-theme'; |
|
1193 | + } |
|
1213 | 1194 | |
1214 | - if (isset($_POST['theme'])) { |
|
1215 | - $this->view->theme = $_POST['theme']; |
|
1216 | - } |
|
1217 | - else if (empty($this->view->theme)) { |
|
1218 | - $this->view->theme = variable_get('theme_default', 'garland'); |
|
1195 | + break; |
|
1196 | + case 'link_display': |
|
1197 | + $form['#title'] .= t('Which display to use for path'); |
|
1198 | + foreach ($this->view->display as $display_id => $display) { |
|
1199 | + if ($display->handler->has_path()) { |
|
1200 | + $options[$display_id] = $display->display_title; |
|
1219 | 1201 | } |
1202 | + } |
|
1203 | + $form['link_display'] = array( |
|
1204 | + '#type' => 'radios', |
|
1205 | + '#options' => $options, |
|
1206 | + '#description' => t("Which display to use to get this display's path for things like summary links, rss feed links, more links, etc."), |
|
1207 | + '#default_value' => $this->get_link_display(), |
|
1208 | + ); |
|
1209 | + break; |
|
1210 | + case 'analyze-theme': |
|
1211 | + $form['#title'] .= t('Theming information'); |
|
1212 | + $form['#help_topic'] = 'analyze-theme'; |
|
1220 | 1213 | |
1221 | - global $custom_theme; |
|
1222 | - $custom_theme = $this->view->theme; |
|
1223 | - init_theme(); |
|
1224 | - |
|
1225 | - $funcs = array(); |
|
1226 | - // Get theme functions for the display. Note that some displays may |
|
1227 | - // not have themes. The 'feed' display, for example, completely |
|
1228 | - // delegates to the style. |
|
1229 | - if (!empty($this->definition['theme'])) { |
|
1230 | - $funcs[] = $this->option_link(t('Display output'), 'analyze-theme-display') . ': ' . $this->format_themes($this->theme_functions()); |
|
1231 | - $themes = $this->additional_theme_functions(); |
|
1232 | - if ($themes) { |
|
1233 | - foreach ($themes as $theme) { |
|
1234 | - $funcs[] = $this->option_link(t('Alternative display output'), 'analyze-theme-display') . ': ' . $this->format_themes($theme); |
|
1235 | - } |
|
1214 | + if (isset($_POST['theme'])) { |
|
1215 | + $this->view->theme = $_POST['theme']; |
|
1216 | + } |
|
1217 | + else if (empty($this->view->theme)) { |
|
1218 | + $this->view->theme = variable_get('theme_default', 'garland'); |
|
1219 | + } |
|
1220 | + |
|
1221 | + global $custom_theme; |
|
1222 | + $custom_theme = $this->view->theme; |
|
1223 | + init_theme(); |
|
1224 | + |
|
1225 | + $funcs = array(); |
|
1226 | + // Get theme functions for the display. Note that some displays may |
|
1227 | + // not have themes. The 'feed' display, for example, completely |
|
1228 | + // delegates to the style. |
|
1229 | + if (!empty($this->definition['theme'])) { |
|
1230 | + $funcs[] = $this->option_link(t('Display output'), 'analyze-theme-display') . ': ' . $this->format_themes($this->theme_functions()); |
|
1231 | + $themes = $this->additional_theme_functions(); |
|
1232 | + if ($themes) { |
|
1233 | + foreach ($themes as $theme) { |
|
1234 | + $funcs[] = $this->option_link(t('Alternative display output'), 'analyze-theme-display') . ': ' . $this->format_themes($theme); |
|
1236 | 1235 | } |
1237 | 1236 | } |
1237 | + } |
|
1238 | 1238 | |
1239 | - $plugin = $this->get_plugin(); |
|
1240 | - if ($plugin) { |
|
1241 | - $funcs[] = $this->option_link(t('Style output'), 'analyze-theme-style') . ': ' . $this->format_themes($plugin->theme_functions(), $plugin->additional_theme_functions()); |
|
1242 | - $themes = $plugin->additional_theme_functions(); |
|
1243 | - if ($themes) { |
|
1244 | - foreach ($themes as $theme) { |
|
1245 | - $funcs[] = $this->option_link(t('Alternative style'), 'analyze-theme-style') . ': ' . $this->format_themes($theme); |
|
1246 | - } |
|
1239 | + $plugin = $this->get_plugin(); |
|
1240 | + if ($plugin) { |
|
1241 | + $funcs[] = $this->option_link(t('Style output'), 'analyze-theme-style') . ': ' . $this->format_themes($plugin->theme_functions(), $plugin->additional_theme_functions()); |
|
1242 | + $themes = $plugin->additional_theme_functions(); |
|
1243 | + if ($themes) { |
|
1244 | + foreach ($themes as $theme) { |
|
1245 | + $funcs[] = $this->option_link(t('Alternative style'), 'analyze-theme-style') . ': ' . $this->format_themes($theme); |
|
1247 | 1246 | } |
1247 | + } |
|
1248 | 1248 | |
1249 | - if ($plugin->uses_row_plugin()) { |
|
1250 | - $row_plugin = $this->get_plugin('row'); |
|
1251 | - if ($row_plugin) { |
|
1252 | - $funcs[] = $this->option_link(t('Row style output'), 'analyze-theme-row') . ': ' . $this->format_themes($row_plugin->theme_functions()); |
|
1253 | - $themes = $row_plugin->additional_theme_functions(); |
|
1254 | - if ($themes) { |
|
1255 | - foreach ($themes as $theme) { |
|
1256 | - $funcs[] = $this->option_link(t('Alternative row style'), 'analyze-theme-row') . ': ' . $this->format_themes($theme); |
|
1257 | - } |
|
1249 | + if ($plugin->uses_row_plugin()) { |
|
1250 | + $row_plugin = $this->get_plugin('row'); |
|
1251 | + if ($row_plugin) { |
|
1252 | + $funcs[] = $this->option_link(t('Row style output'), 'analyze-theme-row') . ': ' . $this->format_themes($row_plugin->theme_functions()); |
|
1253 | + $themes = $row_plugin->additional_theme_functions(); |
|
1254 | + if ($themes) { |
|
1255 | + foreach ($themes as $theme) { |
|
1256 | + $funcs[] = $this->option_link(t('Alternative row style'), 'analyze-theme-row') . ': ' . $this->format_themes($theme); |
|
1258 | 1257 | } |
1259 | 1258 | } |
1260 | 1259 | } |
1260 | + } |
|
1261 | 1261 | |
1262 | - if ($plugin->uses_fields()) { |
|
1263 | - foreach ($this->get_handlers('field') as $id => $handler) { |
|
1264 | - $funcs[] = $this->option_link(t('Field @field (ID: @id)', array('@field' => $handler->ui_name(), '@id' => $id)), 'analyze-theme-field') . ': ' . $this->format_themes($handler->theme_functions()); |
|
1265 | - } |
|
1262 | + if ($plugin->uses_fields()) { |
|
1263 | + foreach ($this->get_handlers('field') as $id => $handler) { |
|
1264 | + $funcs[] = $this->option_link(t('Field @field (ID: @id)', array('@field' => $handler->ui_name(), '@id' => $id)), 'analyze-theme-field') . ': ' . $this->format_themes($handler->theme_functions()); |
|
1266 | 1265 | } |
1267 | 1266 | } |
1267 | + } |
|
1268 | 1268 | |
1269 | - $form['important'] = array( |
|
1270 | - '#prefix' => '<div class="form-item description">', |
|
1271 | - '#suffix' => '</div>', |
|
1272 | - '#value' => '<p>' . t('This section lists all possible templates for the display plugin and for the style plugins, ordered roughly from the least specific to the most specific. The active template for each plugin -- which is the most specific template found on the system -- is highlighted in bold.') . '</p>', |
|
1273 | - ); |
|
1269 | + $form['important'] = array( |
|
1270 | + '#prefix' => '<div class="form-item description">', |
|
1271 | + '#suffix' => '</div>', |
|
1272 | + '#value' => '<p>' . t('This section lists all possible templates for the display plugin and for the style plugins, ordered roughly from the least specific to the most specific. The active template for each plugin -- which is the most specific template found on the system -- is highlighted in bold.') . '</p>', |
|
1273 | + ); |
|
1274 | 1274 | |
1275 | - foreach (list_themes() as $key => $theme) { |
|
1276 | - $options[$key] = $theme->info['name']; |
|
1277 | - } |
|
1275 | + foreach (list_themes() as $key => $theme) { |
|
1276 | + $options[$key] = $theme->info['name']; |
|
1277 | + } |
|
1278 | 1278 | |
1279 | - $form['box'] = array( |
|
1280 | - '#prefix' => '<div class="container-inline">', |
|
1281 | - '#suffix' => '</div>', |
|
1282 | - ); |
|
1283 | - $form['box']['theme'] = array( |
|
1284 | - '#type' => 'select', |
|
1285 | - '#options' => $options, |
|
1286 | - '#default_value' => $this->view->theme, |
|
1287 | - ); |
|
1279 | + $form['box'] = array( |
|
1280 | + '#prefix' => '<div class="container-inline">', |
|
1281 | + '#suffix' => '</div>', |
|
1282 | + ); |
|
1283 | + $form['box']['theme'] = array( |
|
1284 | + '#type' => 'select', |
|
1285 | + '#options' => $options, |
|
1286 | + '#default_value' => $this->view->theme, |
|
1287 | + ); |
|
1288 | 1288 | |
1289 | - $form['box']['change'] = array( |
|
1290 | - '#type' => 'submit', |
|
1291 | - '#value' => t('Change theme'), |
|
1292 | - '#submit' => array('views_ui_edit_display_form_change_theme'), |
|
1293 | - ); |
|
1289 | + $form['box']['change'] = array( |
|
1290 | + '#type' => 'submit', |
|
1291 | + '#value' => t('Change theme'), |
|
1292 | + '#submit' => array('views_ui_edit_display_form_change_theme'), |
|
1293 | + ); |
|
1294 | 1294 | |
1295 | - $form['analysis'] = array( |
|
1296 | - '#prefix' => '<div class="form-item">', |
|
1297 | - '#suffix' => '</div>', |
|
1298 | - '#value' => theme('item_list', $funcs), |
|
1299 | - ); |
|
1295 | + $form['analysis'] = array( |
|
1296 | + '#prefix' => '<div class="form-item">', |
|
1297 | + '#suffix' => '</div>', |
|
1298 | + '#value' => theme('item_list', $funcs), |
|
1299 | + ); |
|
1300 | 1300 | |
1301 | - $form['rescan_button'] = array( |
|
1302 | - '#prefix' => '<div class="form-item">', |
|
1303 | - '#suffix' => '</div>', |
|
1304 | - ); |
|
1305 | - $form['rescan_button']['button'] = array( |
|
1306 | - '#type' => 'submit', |
|
1307 | - '#value' => t('Rescan template files'), |
|
1308 | - '#submit' => array('views_ui_config_item_form_rescan'), |
|
1309 | - ); |
|
1310 | - $form['rescan_button']['markup'] = array( |
|
1311 | - '#prefix' => '<div class="description">', |
|
1312 | - '#suffix' => '</div>', |
|
1313 | - '#value' => t("<strong>Important!</strong> When adding, removing, or renaming template files, it is necessary to make Drupal aware of the changes by making it rescan the files on your system. By clicking this button you clear Drupal's theme registry and thereby trigger this rescanning process. The highlighted templates above will then reflect the new state of your system."), |
|
1314 | - ); |
|
1301 | + $form['rescan_button'] = array( |
|
1302 | + '#prefix' => '<div class="form-item">', |
|
1303 | + '#suffix' => '</div>', |
|
1304 | + ); |
|
1305 | + $form['rescan_button']['button'] = array( |
|
1306 | + '#type' => 'submit', |
|
1307 | + '#value' => t('Rescan template files'), |
|
1308 | + '#submit' => array('views_ui_config_item_form_rescan'), |
|
1309 | + ); |
|
1310 | + $form['rescan_button']['markup'] = array( |
|
1311 | + '#prefix' => '<div class="description">', |
|
1312 | + '#suffix' => '</div>', |
|
1313 | + '#value' => t("<strong>Important!</strong> When adding, removing, or renaming template files, it is necessary to make Drupal aware of the changes by making it rescan the files on your system. By clicking this button you clear Drupal's theme registry and thereby trigger this rescanning process. The highlighted templates above will then reflect the new state of your system."), |
|
1314 | + ); |
|
1315 | 1315 | |
1316 | - $form_state['ok_button'] = TRUE; |
|
1317 | - break; |
|
1318 | - case 'analyze-theme-display': |
|
1319 | - $form['#title'] .= t('Theming information (display)'); |
|
1320 | - $output = '<p>' . t('Back to !info.', array('!info' => $this->option_link(t('theming information'), 'analyze-theme'))) . '</p>'; |
|
1316 | + $form_state['ok_button'] = TRUE; |
|
1317 | + break; |
|
1318 | + case 'analyze-theme-display': |
|
1319 | + $form['#title'] .= t('Theming information (display)'); |
|
1320 | + $output = '<p>' . t('Back to !info.', array('!info' => $this->option_link(t('theming information'), 'analyze-theme'))) . '</p>'; |
|
1321 | 1321 | |
1322 | - if (empty($this->definition['theme'])) { |
|
1323 | - $output .= t('This display has no theming information'); |
|
1324 | - } |
|
1325 | - else { |
|
1326 | - $output .= '<p>' . t('This is the default theme template used for this display.') . '</p>'; |
|
1327 | - $output .= '<pre>' . check_plain(file_get_contents('./' . $this->definition['theme path'] . '/' . strtr($this->definition['theme'], '_', '-') . '.tpl.php')) . '</pre>'; |
|
1328 | - } |
|
1322 | + if (empty($this->definition['theme'])) { |
|
1323 | + $output .= t('This display has no theming information'); |
|
1324 | + } |
|
1325 | + else { |
|
1326 | + $output .= '<p>' . t('This is the default theme template used for this display.') . '</p>'; |
|
1327 | + $output .= '<pre>' . check_plain(file_get_contents('./' . $this->definition['theme path'] . '/' . strtr($this->definition['theme'], '_', '-') . '.tpl.php')) . '</pre>'; |
|
1328 | + } |
|
1329 | 1329 | |
1330 | - if (!empty($this->definition['additional themes'])) { |
|
1331 | - foreach ($this->definition['additional themes'] as $theme => $type) { |
|
1332 | - $output .= '<p>' . t('This is an alternative template for this display.') . '</p>'; |
|
1333 | - $output .= '<pre>' . check_plain(file_get_contents('./' . $this->definition['theme path'] . '/' . strtr($theme, '_', '-') . '.tpl.php')) . '</pre>'; |
|
1334 | - } |
|
1330 | + if (!empty($this->definition['additional themes'])) { |
|
1331 | + foreach ($this->definition['additional themes'] as $theme => $type) { |
|
1332 | + $output .= '<p>' . t('This is an alternative template for this display.') . '</p>'; |
|
1333 | + $output .= '<pre>' . check_plain(file_get_contents('./' . $this->definition['theme path'] . '/' . strtr($theme, '_', '-') . '.tpl.php')) . '</pre>'; |
|
1335 | 1334 | } |
1335 | + } |
|
1336 | 1336 | |
1337 | - $form['analysis'] = array( |
|
1338 | - '#prefix' => '<div class="form-item">', |
|
1339 | - '#suffix' => '</div>', |
|
1340 | - '#value' => $output, |
|
1341 | - ); |
|
1337 | + $form['analysis'] = array( |
|
1338 | + '#prefix' => '<div class="form-item">', |
|
1339 | + '#suffix' => '</div>', |
|
1340 | + '#value' => $output, |
|
1341 | + ); |
|
1342 | 1342 | |
1343 | - $form_state['ok_button'] = TRUE; |
|
1344 | - break; |
|
1345 | - case 'analyze-theme-style': |
|
1346 | - $form['#title'] .= t('Theming information (style)'); |
|
1347 | - $output = '<p>' . t('Back to !info.', array('!info' => $this->option_link(t('theming information'), 'analyze-theme'))) . '</p>'; |
|
1343 | + $form_state['ok_button'] = TRUE; |
|
1344 | + break; |
|
1345 | + case 'analyze-theme-style': |
|
1346 | + $form['#title'] .= t('Theming information (style)'); |
|
1347 | + $output = '<p>' . t('Back to !info.', array('!info' => $this->option_link(t('theming information'), 'analyze-theme'))) . '</p>'; |
|
1348 | 1348 | |
1349 | - $plugin = $this->get_plugin(); |
|
1349 | + $plugin = $this->get_plugin(); |
|
1350 | 1350 | |
1351 | - if (empty($plugin->definition['theme'])) { |
|
1352 | - $output .= t('This display has no style theming information'); |
|
1353 | - } |
|
1354 | - else { |
|
1355 | - $output .= '<p>' . t('This is the default theme template used for this style.') . '</p>'; |
|
1356 | - $output .= '<pre>' . check_plain(file_get_contents('./' . $plugin->definition['theme path'] . '/' . strtr($plugin->definition['theme'], '_', '-') . '.tpl.php')) . '</pre>'; |
|
1357 | - } |
|
1351 | + if (empty($plugin->definition['theme'])) { |
|
1352 | + $output .= t('This display has no style theming information'); |
|
1353 | + } |
|
1354 | + else { |
|
1355 | + $output .= '<p>' . t('This is the default theme template used for this style.') . '</p>'; |
|
1356 | + $output .= '<pre>' . check_plain(file_get_contents('./' . $plugin->definition['theme path'] . '/' . strtr($plugin->definition['theme'], '_', '-') . '.tpl.php')) . '</pre>'; |
|
1357 | + } |
|
1358 | 1358 | |
1359 | - if (!empty($plugin->definition['additional themes'])) { |
|
1360 | - foreach ($plugin->definition['additional themes'] as $theme => $type) { |
|
1361 | - $output .= '<p>' . t('This is an alternative template for this style.') . '</p>'; |
|
1362 | - $output .= '<pre>' . check_plain(file_get_contents('./' . $plugin->definition['theme path'] . '/' . strtr($theme, '_', '-') . '.tpl.php')) . '</pre>'; |
|
1363 | - } |
|
1359 | + if (!empty($plugin->definition['additional themes'])) { |
|
1360 | + foreach ($plugin->definition['additional themes'] as $theme => $type) { |
|
1361 | + $output .= '<p>' . t('This is an alternative template for this style.') . '</p>'; |
|
1362 | + $output .= '<pre>' . check_plain(file_get_contents('./' . $plugin->definition['theme path'] . '/' . strtr($theme, '_', '-') . '.tpl.php')) . '</pre>'; |
|
1364 | 1363 | } |
1364 | + } |
|
1365 | 1365 | |
1366 | - $form['analysis'] = array( |
|
1367 | - '#prefix' => '<div class="form-item">', |
|
1368 | - '#suffix' => '</div>', |
|
1369 | - '#value' => $output, |
|
1370 | - ); |
|
1366 | + $form['analysis'] = array( |
|
1367 | + '#prefix' => '<div class="form-item">', |
|
1368 | + '#suffix' => '</div>', |
|
1369 | + '#value' => $output, |
|
1370 | + ); |
|
1371 | 1371 | |
1372 | - $form_state['ok_button'] = TRUE; |
|
1373 | - break; |
|
1374 | - case 'analyze-theme-row': |
|
1375 | - $form['#title'] .= t('Theming information (row style)'); |
|
1376 | - $output = '<p>' . t('Back to !info.', array('!info' => $this->option_link(t('theming information'), 'analyze-theme'))) . '</p>'; |
|
1372 | + $form_state['ok_button'] = TRUE; |
|
1373 | + break; |
|
1374 | + case 'analyze-theme-row': |
|
1375 | + $form['#title'] .= t('Theming information (row style)'); |
|
1376 | + $output = '<p>' . t('Back to !info.', array('!info' => $this->option_link(t('theming information'), 'analyze-theme'))) . '</p>'; |
|
1377 | 1377 | |
1378 | - $plugin = $this->get_plugin('row'); |
|
1378 | + $plugin = $this->get_plugin('row'); |
|
1379 | 1379 | |
1380 | - if (empty($plugin->definition['theme'])) { |
|
1381 | - $output .= t('This display has no row style theming information'); |
|
1382 | - } |
|
1383 | - else { |
|
1384 | - $output .= '<p>' . t('This is the default theme template used for this row style.') . '</p>'; |
|
1385 | - $output .= '<pre>' . check_plain(file_get_contents('./' . $plugin->definition['theme path'] . '/' . strtr($plugin->definition['theme'], '_', '-') . '.tpl.php')) . '</pre>'; |
|
1386 | - } |
|
1380 | + if (empty($plugin->definition['theme'])) { |
|
1381 | + $output .= t('This display has no row style theming information'); |
|
1382 | + } |
|
1383 | + else { |
|
1384 | + $output .= '<p>' . t('This is the default theme template used for this row style.') . '</p>'; |
|
1385 | + $output .= '<pre>' . check_plain(file_get_contents('./' . $plugin->definition['theme path'] . '/' . strtr($plugin->definition['theme'], '_', '-') . '.tpl.php')) . '</pre>'; |
|
1386 | + } |
|
1387 | 1387 | |
1388 | - if (!empty($plugin->definition['additional themes'])) { |
|
1389 | - foreach ($plugin->definition['additional themes'] as $theme => $type) { |
|
1390 | - $output .= '<p>' . t('This is an alternative template for this row style.') . '</p>'; |
|
1391 | - $output .= '<pre>' . check_plain(file_get_contents('./' . $plugin->definition['theme path'] . '/' . strtr($theme, '_', '-') . '.tpl.php')) . '</pre>'; |
|
1392 | - } |
|
1388 | + if (!empty($plugin->definition['additional themes'])) { |
|
1389 | + foreach ($plugin->definition['additional themes'] as $theme => $type) { |
|
1390 | + $output .= '<p>' . t('This is an alternative template for this row style.') . '</p>'; |
|
1391 | + $output .= '<pre>' . check_plain(file_get_contents('./' . $plugin->definition['theme path'] . '/' . strtr($theme, '_', '-') . '.tpl.php')) . '</pre>'; |
|
1393 | 1392 | } |
1393 | + } |
|
1394 | 1394 | |
1395 | - $form['analysis'] = array( |
|
1396 | - '#prefix' => '<div class="form-item">', |
|
1397 | - '#suffix' => '</div>', |
|
1398 | - '#value' => $output, |
|
1399 | - ); |
|
1395 | + $form['analysis'] = array( |
|
1396 | + '#prefix' => '<div class="form-item">', |
|
1397 | + '#suffix' => '</div>', |
|
1398 | + '#value' => $output, |
|
1399 | + ); |
|
1400 | 1400 | |
1401 | - $form_state['ok_button'] = TRUE; |
|
1402 | - break; |
|
1403 | - case 'analyze-theme-field': |
|
1404 | - $form['#title'] .= t('Theming information (row style)'); |
|
1405 | - $output = '<p>' . t('Back to !info.', array('!info' => $this->option_link(t('theming information'), 'analyze-theme'))) . '</p>'; |
|
1401 | + $form_state['ok_button'] = TRUE; |
|
1402 | + break; |
|
1403 | + case 'analyze-theme-field': |
|
1404 | + $form['#title'] .= t('Theming information (row style)'); |
|
1405 | + $output = '<p>' . t('Back to !info.', array('!info' => $this->option_link(t('theming information'), 'analyze-theme'))) . '</p>'; |
|
1406 | 1406 | |
1407 | - $output .= '<p>' . t('This is the default theme template used for this row style.') . '</p>'; |
|
1407 | + $output .= '<p>' . t('This is the default theme template used for this row style.') . '</p>'; |
|
1408 | 1408 | |
1409 | - // Field templates aren't registered the normal way...and they're always |
|
1410 | - // this one, anyhow. |
|
1411 | - $output .= '<pre>' . check_plain(file_get_contents(drupal_get_path('module', 'views') . '/theme/views-view-field.tpl.php')) . '</pre>'; |
|
1409 | + // Field templates aren't registered the normal way...and they're always |
|
1410 | + // this one, anyhow. |
|
1411 | + $output .= '<pre>' . check_plain(file_get_contents(drupal_get_path('module', 'views') . '/theme/views-view-field.tpl.php')) . '</pre>'; |
|
1412 | 1412 | |
1413 | - $form['analysis'] = array( |
|
1414 | - '#prefix' => '<div class="form-item">', |
|
1415 | - '#suffix' => '</div>', |
|
1416 | - '#value' => $output, |
|
1417 | - ); |
|
1418 | - $form_state['ok_button'] = TRUE; |
|
1419 | - break; |
|
1413 | + $form['analysis'] = array( |
|
1414 | + '#prefix' => '<div class="form-item">', |
|
1415 | + '#suffix' => '</div>', |
|
1416 | + '#value' => $output, |
|
1417 | + ); |
|
1418 | + $form_state['ok_button'] = TRUE; |
|
1419 | + break; |
|
1420 | 1420 | |
1421 | - case 'exposed_block': |
|
1422 | - $form['#title'] .= t('Put the exposed form in a block'); |
|
1423 | - $form['description'] = array( |
|
1424 | - '#prefix' => '<div class="description form-item">', |
|
1425 | - '#suffix' => '</div>', |
|
1426 | - '#value' => t('If set, any exposed widgets will not appear with this view. Instead, a block will be made available to the Drupal block administration system, and the exposed form will appear there. Note that this block must be enabled manually, Views will not enable it for you.'), |
|
1427 | - ); |
|
1428 | - $form['exposed_block'] = array( |
|
1429 | - '#type' => 'radios', |
|
1430 | - '#options' => array(1 => t('Yes'), 0 => t('No')), |
|
1431 | - '#default_value' => $this->get_option('exposed_block') ? 1 : 0, |
|
1432 | - ); |
|
1433 | - break; |
|
1421 | + case 'exposed_block': |
|
1422 | + $form['#title'] .= t('Put the exposed form in a block'); |
|
1423 | + $form['description'] = array( |
|
1424 | + '#prefix' => '<div class="description form-item">', |
|
1425 | + '#suffix' => '</div>', |
|
1426 | + '#value' => t('If set, any exposed widgets will not appear with this view. Instead, a block will be made available to the Drupal block administration system, and the exposed form will appear there. Note that this block must be enabled manually, Views will not enable it for you.'), |
|
1427 | + ); |
|
1428 | + $form['exposed_block'] = array( |
|
1429 | + '#type' => 'radios', |
|
1430 | + '#options' => array(1 => t('Yes'), 0 => t('No')), |
|
1431 | + '#default_value' => $this->get_option('exposed_block') ? 1 : 0, |
|
1432 | + ); |
|
1433 | + break; |
|
1434 | 1434 | } |
1435 | 1435 | } |
1436 | 1436 | |
@@ -1476,38 +1476,38 @@ discard block |
||
1476 | 1476 | */ |
1477 | 1477 | function options_validate(&$form, &$form_state) { |
1478 | 1478 | switch ($form_state['section']) { |
1479 | - case 'display_title': |
|
1480 | - if (empty($form_state['values']['display_title'])) { |
|
1481 | - form_error($form['display_title'], t('Display title may not be empty.')); |
|
1482 | - } |
|
1483 | - break; |
|
1484 | - case 'css_class': |
|
1485 | - $css_class = $form_state['values']['css_class']; |
|
1486 | - if (preg_match('/[^a-zA-Z0-9- ]/', $css_class)) { |
|
1487 | - form_error($form['css_class'], t('CSS classes must be alphanumeric or dashes only.')); |
|
1488 | - } |
|
1479 | + case 'display_title': |
|
1480 | + if (empty($form_state['values']['display_title'])) { |
|
1481 | + form_error($form['display_title'], t('Display title may not be empty.')); |
|
1482 | + } |
|
1483 | + break; |
|
1484 | + case 'css_class': |
|
1485 | + $css_class = $form_state['values']['css_class']; |
|
1486 | + if (preg_match('/[^a-zA-Z0-9- ]/', $css_class)) { |
|
1487 | + form_error($form['css_class'], t('CSS classes must be alphanumeric or dashes only.')); |
|
1488 | + } |
|
1489 | + break; |
|
1490 | + case 'style_options': |
|
1491 | + $style = TRUE; |
|
1492 | + case 'row_options': |
|
1493 | + // if row, $style will be empty. |
|
1494 | + $plugin = $this->get_plugin(empty($style) ? 'row' : 'style'); |
|
1495 | + if ($plugin) { |
|
1496 | + $plugin->options_validate($form[$form_state['section']], $form_state); |
|
1497 | + } |
|
1498 | + break; |
|
1499 | + case 'access_options': |
|
1500 | + $plugin = $this->get_access_plugin(); |
|
1501 | + if ($plugin) { |
|
1502 | + $plugin->options_validate($form['access_options'], $form_state); |
|
1503 | + } |
|
1504 | + break; |
|
1505 | + case 'cache_options': |
|
1506 | + $plugin = $this->get_cache_plugin(); |
|
1507 | + if ($plugin) { |
|
1508 | + $plugin->options_validate($form['cache_options'], $form_state); |
|
1509 | + } |
|
1489 | 1510 | break; |
1490 | - case 'style_options': |
|
1491 | - $style = TRUE; |
|
1492 | - case 'row_options': |
|
1493 | - // if row, $style will be empty. |
|
1494 | - $plugin = $this->get_plugin(empty($style) ? 'row' : 'style'); |
|
1495 | - if ($plugin) { |
|
1496 | - $plugin->options_validate($form[$form_state['section']], $form_state); |
|
1497 | - } |
|
1498 | - break; |
|
1499 | - case 'access_options': |
|
1500 | - $plugin = $this->get_access_plugin(); |
|
1501 | - if ($plugin) { |
|
1502 | - $plugin->options_validate($form['access_options'], $form_state); |
|
1503 | - } |
|
1504 | - break; |
|
1505 | - case 'cache_options': |
|
1506 | - $plugin = $this->get_cache_plugin(); |
|
1507 | - if ($plugin) { |
|
1508 | - $plugin->options_validate($form['cache_options'], $form_state); |
|
1509 | - } |
|
1510 | - break; |
|
1511 | 1511 | } |
1512 | 1512 | } |
1513 | 1513 | |
@@ -1524,129 +1524,129 @@ discard block |
||
1524 | 1524 | |
1525 | 1525 | $section = $form_state['section']; |
1526 | 1526 | switch ($section) { |
1527 | - case 'display_title': |
|
1528 | - $this->display->display_title = $form_state['values']['display_title']; |
|
1529 | - break; |
|
1530 | - case 'access': |
|
1531 | - $access = $this->get_option('access'); |
|
1532 | - if ($access['type'] != $form_state['values']['access']['type']) { |
|
1533 | - $plugin = views_get_plugin('access', $form_state['values']['access']['type']); |
|
1534 | - if ($plugin) { |
|
1535 | - $access = array('type' => $form_state['values']['access']['type']); |
|
1536 | - $plugin->option_defaults($access); |
|
1537 | - $this->set_option('access', $access); |
|
1538 | - if (!empty($plugin->definition['uses options'])) { |
|
1539 | - views_ui_add_form_to_stack('display', $this->view, $this->display->id, array('access_options')); |
|
1540 | - } |
|
1527 | + case 'display_title': |
|
1528 | + $this->display->display_title = $form_state['values']['display_title']; |
|
1529 | + break; |
|
1530 | + case 'access': |
|
1531 | + $access = $this->get_option('access'); |
|
1532 | + if ($access['type'] != $form_state['values']['access']['type']) { |
|
1533 | + $plugin = views_get_plugin('access', $form_state['values']['access']['type']); |
|
1534 | + if ($plugin) { |
|
1535 | + $access = array('type' => $form_state['values']['access']['type']); |
|
1536 | + $plugin->option_defaults($access); |
|
1537 | + $this->set_option('access', $access); |
|
1538 | + if (!empty($plugin->definition['uses options'])) { |
|
1539 | + views_ui_add_form_to_stack('display', $this->view, $this->display->id, array('access_options')); |
|
1541 | 1540 | } |
1542 | 1541 | } |
1542 | + } |
|
1543 | 1543 | |
1544 | - break; |
|
1545 | - case 'access_options': |
|
1546 | - $plugin = views_get_plugin('access', $form_state['values'][$section]['type']); |
|
1544 | + break; |
|
1545 | + case 'access_options': |
|
1546 | + $plugin = views_get_plugin('access', $form_state['values'][$section]['type']); |
|
1547 | + if ($plugin) { |
|
1548 | + $plugin->options_submit($form['access_options'], $form_state); |
|
1549 | + $this->set_option('access', $form_state['values'][$section]); |
|
1550 | + } |
|
1551 | + break; |
|
1552 | + case 'cache': |
|
1553 | + $cache = $this->get_option('cache'); |
|
1554 | + if ($cache['type'] != $form_state['values']['cache']['type']) { |
|
1555 | + $plugin = views_get_plugin('cache', $form_state['values']['cache']['type']); |
|
1547 | 1556 | if ($plugin) { |
1548 | - $plugin->options_submit($form['access_options'], $form_state); |
|
1549 | - $this->set_option('access', $form_state['values'][$section]); |
|
1550 | - } |
|
1551 | - break; |
|
1552 | - case 'cache': |
|
1553 | - $cache = $this->get_option('cache'); |
|
1554 | - if ($cache['type'] != $form_state['values']['cache']['type']) { |
|
1555 | - $plugin = views_get_plugin('cache', $form_state['values']['cache']['type']); |
|
1556 | - if ($plugin) { |
|
1557 | - $cache = array('type' => $form_state['values']['cache']['type']); |
|
1558 | - $plugin->option_defaults($cache); |
|
1559 | - $this->set_option('cache', $cache); |
|
1560 | - if (!empty($plugin->definition['uses options'])) { |
|
1561 | - views_ui_add_form_to_stack('display', $this->view, $this->display->id, array('cache_options')); |
|
1562 | - } |
|
1557 | + $cache = array('type' => $form_state['values']['cache']['type']); |
|
1558 | + $plugin->option_defaults($cache); |
|
1559 | + $this->set_option('cache', $cache); |
|
1560 | + if (!empty($plugin->definition['uses options'])) { |
|
1561 | + views_ui_add_form_to_stack('display', $this->view, $this->display->id, array('cache_options')); |
|
1563 | 1562 | } |
1564 | 1563 | } |
1564 | + } |
|
1565 | 1565 | |
1566 | - break; |
|
1567 | - case 'cache_options': |
|
1568 | - $plugin = views_get_plugin('cache', $form_state['values'][$section]['type']); |
|
1566 | + break; |
|
1567 | + case 'cache_options': |
|
1568 | + $plugin = views_get_plugin('cache', $form_state['values'][$section]['type']); |
|
1569 | + if ($plugin) { |
|
1570 | + $plugin->options_submit($form['cache_options'], $form_state); |
|
1571 | + $this->set_option('cache', $form_state['values'][$section]); |
|
1572 | + } |
|
1573 | + break; |
|
1574 | + case 'title': |
|
1575 | + case 'css_class': |
|
1576 | + case 'link_display': |
|
1577 | + $this->set_option($section, $form_state['values'][$section]); |
|
1578 | + break; |
|
1579 | + case 'use_ajax': |
|
1580 | + $this->set_option($section, (bool)$form_state['values'][$section]); |
|
1581 | + break; |
|
1582 | + case 'use_pager': |
|
1583 | + $this->set_option($section, $form_state['values'][$section]); |
|
1584 | + $this->set_option('pager_element', intval($form_state['values']['pager_element'])); |
|
1585 | + break; |
|
1586 | + case 'items_per_page': |
|
1587 | + $this->set_option($section, intval($form_state['values'][$section])); |
|
1588 | + $this->set_option('offset', intval($form_state['values']['offset'])); |
|
1589 | + break; |
|
1590 | + case 'use_more': |
|
1591 | + $this->set_option($section, intval($form_state['values'][$section])); |
|
1592 | + $this->set_option('use_more_always', intval($form_state['values']['use_more_always'])); |
|
1593 | + $this->set_option('use_more_text', $form_state['values']['use_more_text']); |
|
1594 | + case 'distinct': |
|
1595 | + $this->set_option($section, $form_state['values'][$section]); |
|
1596 | + break; |
|
1597 | + case 'row_plugin': |
|
1598 | + // This if prevents resetting options to default if they don't change |
|
1599 | + // the plugin. |
|
1600 | + if ($this->get_option($section) != $form_state['values'][$section]) { |
|
1601 | + $plugin = views_get_plugin('row', $form_state['values'][$section]); |
|
1569 | 1602 | if ($plugin) { |
1570 | - $plugin->options_submit($form['cache_options'], $form_state); |
|
1571 | - $this->set_option('cache', $form_state['values'][$section]); |
|
1572 | - } |
|
1573 | - break; |
|
1574 | - case 'title': |
|
1575 | - case 'css_class': |
|
1576 | - case 'link_display': |
|
1577 | - $this->set_option($section, $form_state['values'][$section]); |
|
1578 | - break; |
|
1579 | - case 'use_ajax': |
|
1580 | - $this->set_option($section, (bool)$form_state['values'][$section]); |
|
1581 | - break; |
|
1582 | - case 'use_pager': |
|
1583 | - $this->set_option($section, $form_state['values'][$section]); |
|
1584 | - $this->set_option('pager_element', intval($form_state['values']['pager_element'])); |
|
1585 | - break; |
|
1586 | - case 'items_per_page': |
|
1587 | - $this->set_option($section, intval($form_state['values'][$section])); |
|
1588 | - $this->set_option('offset', intval($form_state['values']['offset'])); |
|
1589 | - break; |
|
1590 | - case 'use_more': |
|
1591 | - $this->set_option($section, intval($form_state['values'][$section])); |
|
1592 | - $this->set_option('use_more_always', intval($form_state['values']['use_more_always'])); |
|
1593 | - $this->set_option('use_more_text', $form_state['values']['use_more_text']); |
|
1594 | - case 'distinct': |
|
1595 | - $this->set_option($section, $form_state['values'][$section]); |
|
1596 | - break; |
|
1597 | - case 'row_plugin': |
|
1598 | - // This if prevents resetting options to default if they don't change |
|
1599 | - // the plugin. |
|
1600 | - if ($this->get_option($section) != $form_state['values'][$section]) { |
|
1601 | - $plugin = views_get_plugin('row', $form_state['values'][$section]); |
|
1602 | - if ($plugin) { |
|
1603 | - $this->set_option($section, $form_state['values'][$section]); |
|
1604 | - $this->set_option('row_options', array()); |
|
1605 | - |
|
1606 | - // send ajax form to options page if we use it. |
|
1607 | - if (!empty($plugin->definition['uses options'])) { |
|
1608 | - views_ui_add_form_to_stack('display', $this->view, $this->display->id, array('row_options')); |
|
1609 | - } |
|
1610 | - } |
|
1611 | - } |
|
1612 | - break; |
|
1613 | - case 'style_plugin': |
|
1614 | - // This if prevents resetting options to default if they don't change |
|
1615 | - // the plugin. |
|
1616 | - if ($this->get_option($section) != $form_state['values'][$section]) { |
|
1617 | - $plugin = views_get_plugin('style', $form_state['values'][$section]); |
|
1618 | - if ($plugin) { |
|
1619 | - $this->set_option($section, $form_state['values'][$section]); |
|
1620 | - $this->set_option('style_options', array()); |
|
1621 | - // send ajax form to options page if we use it. |
|
1622 | - if (!empty($plugin->definition['uses options'])) { |
|
1623 | - views_ui_add_form_to_stack('display', $this->view, $this->display->id, array('style_options')); |
|
1624 | - } |
|
1603 | + $this->set_option($section, $form_state['values'][$section]); |
|
1604 | + $this->set_option('row_options', array()); |
|
1605 | + |
|
1606 | + // send ajax form to options page if we use it. |
|
1607 | + if (!empty($plugin->definition['uses options'])) { |
|
1608 | + views_ui_add_form_to_stack('display', $this->view, $this->display->id, array('row_options')); |
|
1625 | 1609 | } |
1626 | 1610 | } |
1627 | - break; |
|
1628 | - case 'style_options': |
|
1629 | - $style = TRUE; |
|
1630 | - case 'row_options': |
|
1631 | - // if row, $style will be empty. |
|
1632 | - $plugin = $this->get_plugin(empty($style) ? 'row' : 'style'); |
|
1611 | + } |
|
1612 | + break; |
|
1613 | + case 'style_plugin': |
|
1614 | + // This if prevents resetting options to default if they don't change |
|
1615 | + // the plugin. |
|
1616 | + if ($this->get_option($section) != $form_state['values'][$section]) { |
|
1617 | + $plugin = views_get_plugin('style', $form_state['values'][$section]); |
|
1633 | 1618 | if ($plugin) { |
1634 | - $plugin->options_submit($form[$section], $form_state); |
|
1635 | - } |
|
1636 | - $this->set_option($section, $form_state['values'][$section]); |
|
1637 | - break; |
|
1638 | - case 'header': |
|
1639 | - case 'footer': |
|
1640 | - case 'empty': |
|
1641 | - $this->set_option($section, $form_state['values'][$section]); |
|
1642 | - $this->set_option($section . '_format', $form_state['values'][$section . '_format']); |
|
1643 | - if ($section != 'empty') { |
|
1644 | - $this->set_option($section . '_empty', $form_state['values'][$section . '_empty']); |
|
1619 | + $this->set_option($section, $form_state['values'][$section]); |
|
1620 | + $this->set_option('style_options', array()); |
|
1621 | + // send ajax form to options page if we use it. |
|
1622 | + if (!empty($plugin->definition['uses options'])) { |
|
1623 | + views_ui_add_form_to_stack('display', $this->view, $this->display->id, array('style_options')); |
|
1624 | + } |
|
1645 | 1625 | } |
1646 | - break; |
|
1647 | - case 'exposed_block': |
|
1648 | - $this->set_option($section, (bool) $form_state['values'][$section]); |
|
1649 | - break; |
|
1626 | + } |
|
1627 | + break; |
|
1628 | + case 'style_options': |
|
1629 | + $style = TRUE; |
|
1630 | + case 'row_options': |
|
1631 | + // if row, $style will be empty. |
|
1632 | + $plugin = $this->get_plugin(empty($style) ? 'row' : 'style'); |
|
1633 | + if ($plugin) { |
|
1634 | + $plugin->options_submit($form[$section], $form_state); |
|
1635 | + } |
|
1636 | + $this->set_option($section, $form_state['values'][$section]); |
|
1637 | + break; |
|
1638 | + case 'header': |
|
1639 | + case 'footer': |
|
1640 | + case 'empty': |
|
1641 | + $this->set_option($section, $form_state['values'][$section]); |
|
1642 | + $this->set_option($section . '_format', $form_state['values'][$section . '_format']); |
|
1643 | + if ($section != 'empty') { |
|
1644 | + $this->set_option($section . '_empty', $form_state['values'][$section . '_empty']); |
|
1645 | + } |
|
1646 | + break; |
|
1647 | + case 'exposed_block': |
|
1648 | + $this->set_option($section, (bool) $form_state['values'][$section]); |
|
1649 | + break; |
|
1650 | 1650 | } |
1651 | 1651 | } |
1652 | 1652 |
@@ -125,36 +125,36 @@ discard block |
||
125 | 125 | parent::options_form($form, $form_state); |
126 | 126 | |
127 | 127 | switch ($form_state['section']) { |
128 | - case 'title': |
|
129 | - $title = $form['title']; |
|
130 | - // A little juggling to move the 'title' field beyond our checkbox. |
|
131 | - unset($form['title']); |
|
132 | - $form['sitename_title'] = array( |
|
133 | - '#type' => 'checkbox', |
|
134 | - '#title' => t('Use the site name for the title'), |
|
135 | - '#default_value' => $this->get_option('sitename_title'), |
|
136 | - ); |
|
137 | - $form['title'] = $title; |
|
138 | - $form['title']['#process'] = array('views_process_dependency'); |
|
139 | - $form['title']['#dependency'] = array('edit-sitename-title' => array(FALSE)); |
|
140 | - break; |
|
141 | - case 'displays': |
|
142 | - $form['#title'] .= t('Attach to'); |
|
143 | - $displays = array(); |
|
144 | - foreach ($this->view->display as $display_id => $display) { |
|
145 | - if (!empty($display->handler) && $display->handler->accept_attachments()) { |
|
146 | - $displays[$display_id] = $display->display_title; |
|
147 | - } |
|
128 | + case 'title': |
|
129 | + $title = $form['title']; |
|
130 | + // A little juggling to move the 'title' field beyond our checkbox. |
|
131 | + unset($form['title']); |
|
132 | + $form['sitename_title'] = array( |
|
133 | + '#type' => 'checkbox', |
|
134 | + '#title' => t('Use the site name for the title'), |
|
135 | + '#default_value' => $this->get_option('sitename_title'), |
|
136 | + ); |
|
137 | + $form['title'] = $title; |
|
138 | + $form['title']['#process'] = array('views_process_dependency'); |
|
139 | + $form['title']['#dependency'] = array('edit-sitename-title' => array(FALSE)); |
|
140 | + break; |
|
141 | + case 'displays': |
|
142 | + $form['#title'] .= t('Attach to'); |
|
143 | + $displays = array(); |
|
144 | + foreach ($this->view->display as $display_id => $display) { |
|
145 | + if (!empty($display->handler) && $display->handler->accept_attachments()) { |
|
146 | + $displays[$display_id] = $display->display_title; |
|
148 | 147 | } |
149 | - $form['displays'] = array( |
|
150 | - '#type' => 'checkboxes', |
|
151 | - '#description' => t('The feed icon will be available only to the selected displays.'), |
|
152 | - '#options' => $displays, |
|
153 | - '#default_value' => $this->get_option('displays'), |
|
154 | - ); |
|
155 | - break; |
|
156 | - case 'path': |
|
157 | - $form['path']['#description'] = t('This view will be displayed by visiting this path on your site. It is recommended that the path be something like "path/%/%/feed" or "path/%/%/rss.xml", putting one % in the path for each argument you have defined in the view.'); |
|
148 | + } |
|
149 | + $form['displays'] = array( |
|
150 | + '#type' => 'checkboxes', |
|
151 | + '#description' => t('The feed icon will be available only to the selected displays.'), |
|
152 | + '#options' => $displays, |
|
153 | + '#default_value' => $this->get_option('displays'), |
|
154 | + ); |
|
155 | + break; |
|
156 | + case 'path': |
|
157 | + $form['path']['#description'] = t('This view will be displayed by visiting this path on your site. It is recommended that the path be something like "path/%/%/feed" or "path/%/%/rss.xml", putting one % in the path for each argument you have defined in the view.'); |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | // It is very important to call the parent function here: |
167 | 167 | parent::options_submit($form, $form_state); |
168 | 168 | switch ($form_state['section']) { |
169 | - case 'title': |
|
170 | - $this->set_option('sitename_title', $form_state['values']['sitename_title']); |
|
171 | - break; |
|
172 | - case 'displays': |
|
173 | - $this->set_option($form_state['section'], $form_state['values'][$form_state['section']]); |
|
174 | - break; |
|
169 | + case 'title': |
|
170 | + $this->set_option('sitename_title', $form_state['values']['sitename_title']); |
|
171 | + break; |
|
172 | + case 'displays': |
|
173 | + $this->set_option($form_state['section'], $form_state['values'][$form_state['section']]); |
|
174 | + break; |
|
175 | 175 | } |
176 | 176 | } |
177 | 177 |
@@ -118,66 +118,66 @@ discard block |
||
118 | 118 | parent::options_form($form, $form_state); |
119 | 119 | |
120 | 120 | switch ($form_state['section']) { |
121 | - case 'inherit_arguments': |
|
122 | - $form['#title'] .= t('Inherit arguments'); |
|
123 | - $form['inherit_arguments'] = array( |
|
124 | - '#type' => 'checkbox', |
|
125 | - '#title' => t('Inherit'), |
|
126 | - '#description' => t('Should this display inherit its arguments from the parent display to which it is attached?'), |
|
127 | - '#default_value' => $this->get_option('inherit_arguments'), |
|
128 | - ); |
|
129 | - break; |
|
130 | - case 'inherit_exposed_filters': |
|
131 | - $form['#title'] .= t('Inherit exposed filters'); |
|
132 | - $form['inherit_exposed_filters'] = array( |
|
133 | - '#type' => 'checkbox', |
|
134 | - '#title' => t('Inherit'), |
|
135 | - '#description' => t('Should this display inherit its exposed filter values from the parent display to which it is attached?'), |
|
136 | - '#default_value' => $this->get_option('inherit_exposed_filters'), |
|
137 | - ); |
|
138 | - break; |
|
139 | - case 'inherit_pager': |
|
140 | - $form['#title'] .= t('Inherit pager'); |
|
141 | - $form['inherit_pager'] = array( |
|
142 | - '#type' => 'checkbox', |
|
143 | - '#title' => t('Inherit'), |
|
144 | - '#description' => t('Should this display inherit its paging values from the parent display to which it is attached? Note that this will provide unexpected results if the number of items to display do not match.'), |
|
145 | - '#default_value' => $this->get_option('inherit_pager'), |
|
146 | - ); |
|
147 | - break; |
|
148 | - case 'render_pager': |
|
149 | - $form['#title'] .= t('Render pager'); |
|
150 | - $form['render_pager'] = array( |
|
151 | - '#type' => 'checkbox', |
|
152 | - '#title' => t('Render'), |
|
153 | - '#description' => t('Should this display render the pager values? If not it can inherit from the parent...'), |
|
154 | - '#default_value' => $this->get_option('render_pager'), |
|
155 | - ); |
|
156 | - break; |
|
157 | - case 'attachment_position': |
|
158 | - $form['#title'] .= t('Position'); |
|
159 | - $form['attachment_position'] = array( |
|
160 | - '#type' => 'radios', |
|
161 | - '#description' => t('Attach before or after the parent display?'), |
|
162 | - '#options' => $this->attachment_positions(), |
|
163 | - '#default_value' => $this->get_option('attachment_position'), |
|
164 | - ); |
|
165 | - break; |
|
166 | - case 'displays': |
|
167 | - $form['#title'] .= t('Attach to'); |
|
168 | - $displays = array(); |
|
169 | - foreach ($this->view->display as $display_id => $display) { |
|
170 | - if (!empty($display->handler) && $display->handler->accept_attachments()) { |
|
171 | - $displays[$display_id] = $display->display_title; |
|
172 | - } |
|
121 | + case 'inherit_arguments': |
|
122 | + $form['#title'] .= t('Inherit arguments'); |
|
123 | + $form['inherit_arguments'] = array( |
|
124 | + '#type' => 'checkbox', |
|
125 | + '#title' => t('Inherit'), |
|
126 | + '#description' => t('Should this display inherit its arguments from the parent display to which it is attached?'), |
|
127 | + '#default_value' => $this->get_option('inherit_arguments'), |
|
128 | + ); |
|
129 | + break; |
|
130 | + case 'inherit_exposed_filters': |
|
131 | + $form['#title'] .= t('Inherit exposed filters'); |
|
132 | + $form['inherit_exposed_filters'] = array( |
|
133 | + '#type' => 'checkbox', |
|
134 | + '#title' => t('Inherit'), |
|
135 | + '#description' => t('Should this display inherit its exposed filter values from the parent display to which it is attached?'), |
|
136 | + '#default_value' => $this->get_option('inherit_exposed_filters'), |
|
137 | + ); |
|
138 | + break; |
|
139 | + case 'inherit_pager': |
|
140 | + $form['#title'] .= t('Inherit pager'); |
|
141 | + $form['inherit_pager'] = array( |
|
142 | + '#type' => 'checkbox', |
|
143 | + '#title' => t('Inherit'), |
|
144 | + '#description' => t('Should this display inherit its paging values from the parent display to which it is attached? Note that this will provide unexpected results if the number of items to display do not match.'), |
|
145 | + '#default_value' => $this->get_option('inherit_pager'), |
|
146 | + ); |
|
147 | + break; |
|
148 | + case 'render_pager': |
|
149 | + $form['#title'] .= t('Render pager'); |
|
150 | + $form['render_pager'] = array( |
|
151 | + '#type' => 'checkbox', |
|
152 | + '#title' => t('Render'), |
|
153 | + '#description' => t('Should this display render the pager values? If not it can inherit from the parent...'), |
|
154 | + '#default_value' => $this->get_option('render_pager'), |
|
155 | + ); |
|
156 | + break; |
|
157 | + case 'attachment_position': |
|
158 | + $form['#title'] .= t('Position'); |
|
159 | + $form['attachment_position'] = array( |
|
160 | + '#type' => 'radios', |
|
161 | + '#description' => t('Attach before or after the parent display?'), |
|
162 | + '#options' => $this->attachment_positions(), |
|
163 | + '#default_value' => $this->get_option('attachment_position'), |
|
164 | + ); |
|
165 | + break; |
|
166 | + case 'displays': |
|
167 | + $form['#title'] .= t('Attach to'); |
|
168 | + $displays = array(); |
|
169 | + foreach ($this->view->display as $display_id => $display) { |
|
170 | + if (!empty($display->handler) && $display->handler->accept_attachments()) { |
|
171 | + $displays[$display_id] = $display->display_title; |
|
173 | 172 | } |
174 | - $form['displays'] = array( |
|
175 | - '#type' => 'checkboxes', |
|
176 | - '#description' => t('Select which display or displays this should attach to.'), |
|
177 | - '#options' => $displays, |
|
178 | - '#default_value' => $this->get_option('displays'), |
|
179 | - ); |
|
180 | - break; |
|
173 | + } |
|
174 | + $form['displays'] = array( |
|
175 | + '#type' => 'checkboxes', |
|
176 | + '#description' => t('Select which display or displays this should attach to.'), |
|
177 | + '#options' => $displays, |
|
178 | + '#default_value' => $this->get_option('displays'), |
|
179 | + ); |
|
180 | + break; |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
@@ -189,14 +189,14 @@ discard block |
||
189 | 189 | // It is very important to call the parent function here: |
190 | 190 | parent::options_submit($form, $form_state); |
191 | 191 | switch ($form_state['section']) { |
192 | - case 'inherit_arguments': |
|
193 | - case 'inherit_pager': |
|
194 | - case 'render_pager': |
|
195 | - case 'inherit_exposed_filters': |
|
196 | - case 'attachment_position': |
|
197 | - case 'displays': |
|
198 | - $this->set_option($form_state['section'], $form_state['values'][$form_state['section']]); |
|
199 | - break; |
|
192 | + case 'inherit_arguments': |
|
193 | + case 'inherit_pager': |
|
194 | + case 'render_pager': |
|
195 | + case 'inherit_exposed_filters': |
|
196 | + case 'attachment_position': |
|
197 | + case 'displays': |
|
198 | + $this->set_option($form_state['section'], $form_state['values'][$form_state['section']]); |
|
199 | + break; |
|
200 | 200 | } |
201 | 201 | } |
202 | 202 | |
@@ -232,16 +232,16 @@ discard block |
||
232 | 232 | $attachment = $view->execute_display($this->display->id, $args); |
233 | 233 | |
234 | 234 | switch ($this->get_option('attachment_position')) { |
235 | - case 'before': |
|
236 | - $this->view->attachment_before .= $attachment; |
|
237 | - break; |
|
238 | - case 'after': |
|
239 | - $this->view->attachment_after .= $attachment; |
|
240 | - break; |
|
241 | - case 'both': |
|
242 | - $this->view->attachment_before .= $attachment; |
|
243 | - $this->view->attachment_after .= $attachment; |
|
244 | - break; |
|
235 | + case 'before': |
|
236 | + $this->view->attachment_before .= $attachment; |
|
237 | + break; |
|
238 | + case 'after': |
|
239 | + $this->view->attachment_after .= $attachment; |
|
240 | + break; |
|
241 | + case 'both': |
|
242 | + $this->view->attachment_before .= $attachment; |
|
243 | + $this->view->attachment_after .= $attachment; |
|
244 | + break; |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | $view->destroy(); |
@@ -130,24 +130,24 @@ discard block |
||
130 | 130 | parent::options_form($form, $form_state); |
131 | 131 | |
132 | 132 | switch ($form_state['section']) { |
133 | - case 'block_description': |
|
134 | - $form['#title'] .= t('Block admin description'); |
|
135 | - $form['block_description'] = array( |
|
136 | - '#type' => 'textfield', |
|
137 | - '#description' => t('This will appear as the name of this block in administer >> site building >> blocks.'), |
|
138 | - '#default_value' => $this->get_option('block_description'), |
|
139 | - ); |
|
140 | - break; |
|
141 | - case 'block_caching': |
|
142 | - $form['#title'] .= t('Block caching type'); |
|
143 | - |
|
144 | - $form['block_caching'] = array( |
|
145 | - '#type' => 'radios', |
|
146 | - '#description' => t("This sets the default status for Drupal's built-in block caching method; this requires that caching be turned on in block administration, and be careful because you have little control over when this cache is flushed."), |
|
147 | - '#options' => $this->block_caching_modes(), |
|
148 | - '#default_value' => $this->get_cache_type(), |
|
149 | - ); |
|
150 | - break; |
|
133 | + case 'block_description': |
|
134 | + $form['#title'] .= t('Block admin description'); |
|
135 | + $form['block_description'] = array( |
|
136 | + '#type' => 'textfield', |
|
137 | + '#description' => t('This will appear as the name of this block in administer >> site building >> blocks.'), |
|
138 | + '#default_value' => $this->get_option('block_description'), |
|
139 | + ); |
|
140 | + break; |
|
141 | + case 'block_caching': |
|
142 | + $form['#title'] .= t('Block caching type'); |
|
143 | + |
|
144 | + $form['block_caching'] = array( |
|
145 | + '#type' => 'radios', |
|
146 | + '#description' => t("This sets the default status for Drupal's built-in block caching method; this requires that caching be turned on in block administration, and be careful because you have little control over when this cache is flushed."), |
|
147 | + '#options' => $this->block_caching_modes(), |
|
148 | + '#default_value' => $this->get_cache_type(), |
|
149 | + ); |
|
150 | + break; |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
@@ -159,13 +159,13 @@ discard block |
||
159 | 159 | // It is very important to call the parent function here: |
160 | 160 | parent::options_submit($form, $form_state); |
161 | 161 | switch ($form_state['section']) { |
162 | - case 'block_description': |
|
163 | - $this->set_option('block_description', $form_state['values']['block_description']); |
|
164 | - break; |
|
165 | - case 'block_caching': |
|
166 | - $this->set_option('block_caching', $form_state['values']['block_caching']); |
|
167 | - $this->save_block_cache($form_state['view']->name.'-'.$form_state['display_id'], $form_state['values']['block_caching']); |
|
168 | - break; |
|
162 | + case 'block_description': |
|
163 | + $this->set_option('block_description', $form_state['values']['block_description']); |
|
164 | + break; |
|
165 | + case 'block_caching': |
|
166 | + $this->set_option('block_caching', $form_state['values']['block_caching']); |
|
167 | + $this->save_block_cache($form_state['view']->name.'-'.$form_state['display_id'], $form_state['values']['block_caching']); |
|
168 | + break; |
|
169 | 169 | } |
170 | 170 | } |
171 | 171 |
@@ -100,21 +100,21 @@ discard block |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | switch ($menu['type']) { |
103 | - case 'none': |
|
104 | - default: |
|
105 | - $items[$path]['type'] = MENU_CALLBACK; |
|
106 | - break; |
|
107 | - case 'normal': |
|
108 | - $items[$path]['type'] = MENU_NORMAL_ITEM; |
|
109 | - // Insert item into the proper menu |
|
110 | - $items[$path]['menu_name'] = $menu['name']; |
|
111 | - break; |
|
112 | - case 'tab': |
|
113 | - $items[$path]['type'] = MENU_LOCAL_TASK; |
|
114 | - break; |
|
115 | - case 'default tab': |
|
116 | - $items[$path]['type'] = MENU_DEFAULT_LOCAL_TASK; |
|
117 | - break; |
|
103 | + case 'none': |
|
104 | + default: |
|
105 | + $items[$path]['type'] = MENU_CALLBACK; |
|
106 | + break; |
|
107 | + case 'normal': |
|
108 | + $items[$path]['type'] = MENU_NORMAL_ITEM; |
|
109 | + // Insert item into the proper menu |
|
110 | + $items[$path]['menu_name'] = $menu['name']; |
|
111 | + break; |
|
112 | + case 'tab': |
|
113 | + $items[$path]['type'] = MENU_LOCAL_TASK; |
|
114 | + break; |
|
115 | + case 'default tab': |
|
116 | + $items[$path]['type'] = MENU_DEFAULT_LOCAL_TASK; |
|
117 | + break; |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | // If this is a 'default' tab, check to see if we have to create teh |
@@ -144,13 +144,13 @@ discard block |
||
144 | 144 | 'menu_name' => $tab_options['name'], |
145 | 145 | ); |
146 | 146 | switch ($tab_options['type']) { |
147 | - default: |
|
148 | - case 'normal': |
|
149 | - $items[$default_path]['type'] = MENU_NORMAL_ITEM; |
|
150 | - break; |
|
151 | - case 'tab': |
|
152 | - $items[$default_path]['type'] = MENU_LOCAL_TASK; |
|
153 | - break; |
|
147 | + default: |
|
148 | + case 'normal': |
|
149 | + $items[$default_path]['type'] = MENU_NORMAL_ITEM; |
|
150 | + break; |
|
151 | + case 'tab': |
|
152 | + $items[$default_path]['type'] = MENU_LOCAL_TASK; |
|
153 | + break; |
|
154 | 154 | } |
155 | 155 | if (isset($tab_options['weight'])) { |
156 | 156 | $items[$default_path]['weight'] = intval($tab_options['weight']); |
@@ -221,17 +221,17 @@ discard block |
||
221 | 221 | $menu = array('type' => 'none'); |
222 | 222 | } |
223 | 223 | switch($menu['type']) { |
224 | - case 'none': |
|
225 | - default: |
|
226 | - $menu_str = t('No menu'); |
|
227 | - break; |
|
228 | - case 'normal': |
|
229 | - $menu_str = t('Normal: @title', array('@title' => $menu['title'])); |
|
230 | - break; |
|
231 | - case 'tab': |
|
232 | - case 'default tab': |
|
233 | - $menu_str = t('Tab: @title', array('@title' => $menu['title'])); |
|
234 | - break; |
|
224 | + case 'none': |
|
225 | + default: |
|
226 | + $menu_str = t('No menu'); |
|
227 | + break; |
|
228 | + case 'normal': |
|
229 | + $menu_str = t('Normal: @title', array('@title' => $menu['title'])); |
|
230 | + break; |
|
231 | + case 'tab': |
|
232 | + case 'default tab': |
|
233 | + $menu_str = t('Tab: @title', array('@title' => $menu['title'])); |
|
234 | + break; |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | if (strlen($menu_str) > 16) { |
@@ -258,176 +258,176 @@ discard block |
||
258 | 258 | parent::options_form($form, $form_state); |
259 | 259 | |
260 | 260 | switch ($form_state['section']) { |
261 | - case 'path': |
|
262 | - $form['#title'] .= t('The menu path or URL of this view'); |
|
263 | - $form['#help_topic'] = 'path'; |
|
264 | - $form['path'] = array( |
|
265 | - '#type' => 'textfield', |
|
266 | - '#description' => t('This view will be displayed by visiting this path on your site. You may use "%" in your URL to represent values that will be used for arguments: For example, "node/%/feed".'), |
|
267 | - '#default_value' => $this->get_option('path'), |
|
261 | + case 'path': |
|
262 | + $form['#title'] .= t('The menu path or URL of this view'); |
|
263 | + $form['#help_topic'] = 'path'; |
|
264 | + $form['path'] = array( |
|
265 | + '#type' => 'textfield', |
|
266 | + '#description' => t('This view will be displayed by visiting this path on your site. You may use "%" in your URL to represent values that will be used for arguments: For example, "node/%/feed".'), |
|
267 | + '#default_value' => $this->get_option('path'), |
|
268 | 268 | '#field_prefix' => '<span dir="ltr">' . url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='), |
269 | 269 | '#field_suffix' => '</span>‎', |
270 | 270 | '#attributes' => array('dir'=>'ltr'), |
271 | - ); |
|
272 | - break; |
|
273 | - case 'menu': |
|
274 | - $form['#title'] .= t('Menu item entry'); |
|
275 | - $form['#help_topic'] = 'menu'; |
|
276 | - $form['menu'] = array( |
|
277 | - '#prefix' => '<div class="clear-block">', |
|
278 | - '#suffix' => '</div>', |
|
279 | - '#tree' => TRUE, |
|
280 | - ); |
|
281 | - $menu = $this->get_option('menu'); |
|
282 | - if (empty($menu)) { |
|
283 | - $menu = array('type' => 'none', 'title' => '', 'weight' => 0); |
|
284 | - } |
|
285 | - $form['menu']['type'] = array( |
|
286 | - '#prefix' => '<div class="views-left-30">', |
|
287 | - '#suffix' => '</div>', |
|
288 | - '#title' => t('Type'), |
|
289 | - '#type' => 'radios', |
|
290 | - '#options' => array( |
|
291 | - 'none' => t('No menu entry'), |
|
292 | - 'normal' => t('Normal menu entry'), |
|
293 | - 'tab' => t('Menu tab'), |
|
294 | - 'default tab' => t('Default menu tab') |
|
295 | - ), |
|
296 | - '#default_value' => $menu['type'], |
|
297 | - ); |
|
298 | - $form['menu']['title'] = array( |
|
299 | - '#prefix' => '<div class="views-left-50">', |
|
300 | - '#title' => t('Title'), |
|
301 | - '#type' => 'textfield', |
|
302 | - '#default_value' => $menu['title'], |
|
303 | - '#description' => t('If set to normal or tab, enter the text to use for the menu item.'), |
|
304 | - '#process' => array('views_process_dependency'), |
|
305 | - '#dependency' => array('radio:menu[type]' => array('normal', 'tab', 'default tab')), |
|
306 | - ); |
|
307 | - $form['menu']['description'] = array( |
|
308 | - '#title' => t('Description'), |
|
309 | - '#type' => 'textfield', |
|
310 | - '#default_value' => $menu['description'], |
|
311 | - '#description' => t("If set to normal or tab, enter the text to use for the menu item's description."), |
|
312 | - '#process' => array('views_process_dependency'), |
|
313 | - '#dependency' => array('radio:menu[type]' => array('normal', 'tab', 'default tab')), |
|
314 | - ); |
|
315 | - $form['menu']['name-warning'] = array( |
|
316 | - '#type' => 'markup', |
|
317 | - '#prefix' => '<div class="warning">', |
|
318 | - '#value' => t("Warning: Changing this item's menu will not work reliably in Drupal 6.4 or earlier. Please upgrade your copy of Drupal at !url.", array('!url' => l('drupal.org', 'http://drupal.org/project/Drupal+project'))), |
|
319 | - '#suffix' => '</div>', |
|
271 | + ); |
|
272 | + break; |
|
273 | + case 'menu': |
|
274 | + $form['#title'] .= t('Menu item entry'); |
|
275 | + $form['#help_topic'] = 'menu'; |
|
276 | + $form['menu'] = array( |
|
277 | + '#prefix' => '<div class="clear-block">', |
|
278 | + '#suffix' => '</div>', |
|
279 | + '#tree' => TRUE, |
|
280 | + ); |
|
281 | + $menu = $this->get_option('menu'); |
|
282 | + if (empty($menu)) { |
|
283 | + $menu = array('type' => 'none', 'title' => '', 'weight' => 0); |
|
284 | + } |
|
285 | + $form['menu']['type'] = array( |
|
286 | + '#prefix' => '<div class="views-left-30">', |
|
287 | + '#suffix' => '</div>', |
|
288 | + '#title' => t('Type'), |
|
289 | + '#type' => 'radios', |
|
290 | + '#options' => array( |
|
291 | + 'none' => t('No menu entry'), |
|
292 | + 'normal' => t('Normal menu entry'), |
|
293 | + 'tab' => t('Menu tab'), |
|
294 | + 'default tab' => t('Default menu tab') |
|
295 | + ), |
|
296 | + '#default_value' => $menu['type'], |
|
297 | + ); |
|
298 | + $form['menu']['title'] = array( |
|
299 | + '#prefix' => '<div class="views-left-50">', |
|
300 | + '#title' => t('Title'), |
|
301 | + '#type' => 'textfield', |
|
302 | + '#default_value' => $menu['title'], |
|
303 | + '#description' => t('If set to normal or tab, enter the text to use for the menu item.'), |
|
304 | + '#process' => array('views_process_dependency'), |
|
305 | + '#dependency' => array('radio:menu[type]' => array('normal', 'tab', 'default tab')), |
|
306 | + ); |
|
307 | + $form['menu']['description'] = array( |
|
308 | + '#title' => t('Description'), |
|
309 | + '#type' => 'textfield', |
|
310 | + '#default_value' => $menu['description'], |
|
311 | + '#description' => t("If set to normal or tab, enter the text to use for the menu item's description."), |
|
312 | + '#process' => array('views_process_dependency'), |
|
313 | + '#dependency' => array('radio:menu[type]' => array('normal', 'tab', 'default tab')), |
|
314 | + ); |
|
315 | + $form['menu']['name-warning'] = array( |
|
316 | + '#type' => 'markup', |
|
317 | + '#prefix' => '<div class="warning">', |
|
318 | + '#value' => t("Warning: Changing this item's menu will not work reliably in Drupal 6.4 or earlier. Please upgrade your copy of Drupal at !url.", array('!url' => l('drupal.org', 'http://drupal.org/project/Drupal+project'))), |
|
319 | + '#suffix' => '</div>', |
|
320 | + '#process' => array('views_process_dependency'), |
|
321 | + '#dependency' => array('radio:menu[type]' => array('normal')), |
|
322 | + '#access' => version_compare(VERSION, '6.5', '<'), |
|
323 | + ); |
|
324 | + |
|
325 | + // Only display the menu selector if menu module is enabled. |
|
326 | + if (module_exists('menu')) { |
|
327 | + $form['menu']['name'] = array( |
|
328 | + '#title' => t('Menu'), |
|
329 | + '#type' => 'select', |
|
330 | + '#options' => menu_get_menus(), |
|
331 | + '#default_value' => $menu['name'], |
|
332 | + '#description' => t('Insert item into an available menu.'), // |
|
320 | 333 | '#process' => array('views_process_dependency'), |
321 | 334 | '#dependency' => array('radio:menu[type]' => array('normal')), |
322 | - '#access' => version_compare(VERSION, '6.5', '<'), |
|
323 | 335 | ); |
324 | - |
|
325 | - // Only display the menu selector if menu module is enabled. |
|
326 | - if (module_exists('menu')) { |
|
327 | - $form['menu']['name'] = array( |
|
328 | - '#title' => t('Menu'), |
|
329 | - '#type' => 'select', |
|
330 | - '#options' => menu_get_menus(), |
|
331 | - '#default_value' => $menu['name'], |
|
332 | - '#description' => t('Insert item into an available menu.'), // |
|
333 | - '#process' => array('views_process_dependency'), |
|
334 | - '#dependency' => array('radio:menu[type]' => array('normal')), |
|
335 | - ); |
|
336 | - } |
|
337 | - else { |
|
338 | - $form['menu']['name'] = array( |
|
339 | - '#type' => 'value', |
|
340 | - '#value' => $menu['name'], |
|
341 | - ); |
|
342 | - $form['menu']['markup'] = array( |
|
343 | - '#value' => t('Menu selection requires the activation of menu module.'), |
|
344 | - ); |
|
345 | - } |
|
346 | - $form['menu']['weight'] = array( |
|
347 | - '#suffix' => '</div>', |
|
348 | - '#title' => t('Weight'), |
|
349 | - '#type' => 'textfield', |
|
350 | - '#default_value' => isset($menu['weight']) ? $menu['weight'] : 0, |
|
351 | - '#description' => t('The lower the weight the higher/further left it will appear.'), |
|
352 | - '#process' => array('views_process_dependency'), |
|
353 | - '#dependency' => array('radio:menu[type]' => array('normal', 'tab', 'default tab')), |
|
336 | + } |
|
337 | + else { |
|
338 | + $form['menu']['name'] = array( |
|
339 | + '#type' => 'value', |
|
340 | + '#value' => $menu['name'], |
|
354 | 341 | ); |
355 | - break; |
|
356 | - case 'tab_options': |
|
357 | - $form['#title'] .= t('Default tab options'); |
|
358 | - $tab_options = $this->get_option('tab_options'); |
|
359 | - if (empty($tab_options)) { |
|
360 | - $tab_options = array('type' => 'none', 'title' => '', 'weight' => 0); |
|
361 | - } |
|
362 | - |
|
363 | - $form['tab_markup'] = array( |
|
364 | - '#prefix' => '<div class="form-item description">', |
|
365 | - '#suffix' => '</div>', |
|
366 | - '#value' => t('When providing a menu item as a tab, Drupal needs to know what the parent menu item of that tab will be. Sometimes the parent will already exist, but other times you will need to have one created. The path of a parent item will always be the same path with the last part left off. i.e, if the path to this view is <em>foo/bar/baz</em>, the parent path would be <em>foo/bar</em>.'), |
|
342 | + $form['menu']['markup'] = array( |
|
343 | + '#value' => t('Menu selection requires the activation of menu module.'), |
|
367 | 344 | ); |
345 | + } |
|
346 | + $form['menu']['weight'] = array( |
|
347 | + '#suffix' => '</div>', |
|
348 | + '#title' => t('Weight'), |
|
349 | + '#type' => 'textfield', |
|
350 | + '#default_value' => isset($menu['weight']) ? $menu['weight'] : 0, |
|
351 | + '#description' => t('The lower the weight the higher/further left it will appear.'), |
|
352 | + '#process' => array('views_process_dependency'), |
|
353 | + '#dependency' => array('radio:menu[type]' => array('normal', 'tab', 'default tab')), |
|
354 | + ); |
|
355 | + break; |
|
356 | + case 'tab_options': |
|
357 | + $form['#title'] .= t('Default tab options'); |
|
358 | + $tab_options = $this->get_option('tab_options'); |
|
359 | + if (empty($tab_options)) { |
|
360 | + $tab_options = array('type' => 'none', 'title' => '', 'weight' => 0); |
|
361 | + } |
|
368 | 362 | |
369 | - $form['tab_options'] = array( |
|
370 | - '#prefix' => '<div class="clear-block">', |
|
371 | - '#suffix' => '</div>', |
|
372 | - '#tree' => TRUE, |
|
373 | - ); |
|
374 | - $form['tab_options']['type'] = array( |
|
375 | - '#prefix' => '<div class="views-left-25">', |
|
376 | - '#suffix' => '</div>', |
|
377 | - '#title' => t('Parent menu item'), |
|
378 | - '#type' => 'radios', |
|
379 | - '#options' => array('none' => t('Already exists'), 'normal' => t('Normal menu item'), 'tab' => t('Menu tab')), |
|
380 | - '#default_value' => $tab_options['type'], |
|
381 | - ); |
|
382 | - $form['tab_options']['title'] = array( |
|
383 | - '#prefix' => '<div class="views-left-75">', |
|
384 | - '#title' => t('Title'), |
|
385 | - '#type' => 'textfield', |
|
386 | - '#default_value' => $tab_options['title'], |
|
387 | - '#description' => t('If creating a parent menu item, enter the title of the item.'), |
|
363 | + $form['tab_markup'] = array( |
|
364 | + '#prefix' => '<div class="form-item description">', |
|
365 | + '#suffix' => '</div>', |
|
366 | + '#value' => t('When providing a menu item as a tab, Drupal needs to know what the parent menu item of that tab will be. Sometimes the parent will already exist, but other times you will need to have one created. The path of a parent item will always be the same path with the last part left off. i.e, if the path to this view is <em>foo/bar/baz</em>, the parent path would be <em>foo/bar</em>.'), |
|
367 | + ); |
|
368 | + |
|
369 | + $form['tab_options'] = array( |
|
370 | + '#prefix' => '<div class="clear-block">', |
|
371 | + '#suffix' => '</div>', |
|
372 | + '#tree' => TRUE, |
|
373 | + ); |
|
374 | + $form['tab_options']['type'] = array( |
|
375 | + '#prefix' => '<div class="views-left-25">', |
|
376 | + '#suffix' => '</div>', |
|
377 | + '#title' => t('Parent menu item'), |
|
378 | + '#type' => 'radios', |
|
379 | + '#options' => array('none' => t('Already exists'), 'normal' => t('Normal menu item'), 'tab' => t('Menu tab')), |
|
380 | + '#default_value' => $tab_options['type'], |
|
381 | + ); |
|
382 | + $form['tab_options']['title'] = array( |
|
383 | + '#prefix' => '<div class="views-left-75">', |
|
384 | + '#title' => t('Title'), |
|
385 | + '#type' => 'textfield', |
|
386 | + '#default_value' => $tab_options['title'], |
|
387 | + '#description' => t('If creating a parent menu item, enter the title of the item.'), |
|
388 | + '#process' => array('views_process_dependency'), |
|
389 | + '#dependency' => array('radio:tab_options[type]' => array('normal', 'tab')), |
|
390 | + ); |
|
391 | + $form['tab_options']['description'] = array( |
|
392 | + '#title' => t('Description'), |
|
393 | + '#type' => 'textfield', |
|
394 | + '#default_value' => $tab_options['description'], |
|
395 | + '#description' => t('If creating a parent menu item, enter the description of the item.'), |
|
396 | + '#process' => array('views_process_dependency'), |
|
397 | + '#dependency' => array('radio:tab_options[type]' => array('normal', 'tab')), |
|
398 | + ); |
|
399 | + // Only display the menu selector if menu module is enabled. |
|
400 | + if (module_exists('menu')) { |
|
401 | + $form['tab_options']['name'] = array( |
|
402 | + '#title' => t('Menu'), |
|
403 | + '#type' => 'select', |
|
404 | + '#options' => menu_get_menus(), |
|
405 | + '#default_value' => $tab_options['name'], |
|
406 | + '#description' => t('Insert item into an available menu.'), |
|
388 | 407 | '#process' => array('views_process_dependency'), |
389 | - '#dependency' => array('radio:tab_options[type]' => array('normal', 'tab')), |
|
408 | + '#dependency' => array('radio:tab_options[type]' => array('normal')), |
|
390 | 409 | ); |
391 | - $form['tab_options']['description'] = array( |
|
392 | - '#title' => t('Description'), |
|
393 | - '#type' => 'textfield', |
|
394 | - '#default_value' => $tab_options['description'], |
|
395 | - '#description' => t('If creating a parent menu item, enter the description of the item.'), |
|
396 | - '#process' => array('views_process_dependency'), |
|
397 | - '#dependency' => array('radio:tab_options[type]' => array('normal', 'tab')), |
|
410 | + } |
|
411 | + else { |
|
412 | + $form['tab_options']['name'] = array( |
|
413 | + '#type' => 'value', |
|
414 | + '#value' => $tab_options['name'], |
|
398 | 415 | ); |
399 | - // Only display the menu selector if menu module is enabled. |
|
400 | - if (module_exists('menu')) { |
|
401 | - $form['tab_options']['name'] = array( |
|
402 | - '#title' => t('Menu'), |
|
403 | - '#type' => 'select', |
|
404 | - '#options' => menu_get_menus(), |
|
405 | - '#default_value' => $tab_options['name'], |
|
406 | - '#description' => t('Insert item into an available menu.'), |
|
407 | - '#process' => array('views_process_dependency'), |
|
408 | - '#dependency' => array('radio:tab_options[type]' => array('normal')), |
|
409 | - ); |
|
410 | - } |
|
411 | - else { |
|
412 | - $form['tab_options']['name'] = array( |
|
413 | - '#type' => 'value', |
|
414 | - '#value' => $tab_options['name'], |
|
415 | - ); |
|
416 | - $form['tab_options']['markup'] = array( |
|
417 | - '#value' => t('Menu selection requires the activation of menu module.'), |
|
418 | - ); |
|
419 | - } |
|
420 | - $form['tab_options']['weight'] = array( |
|
421 | - '#suffix' => '</div>', |
|
422 | - '#title' => t('Tab weight'), |
|
423 | - '#type' => 'textfield', |
|
424 | - '#default_value' => $tab_options['weight'], |
|
425 | - '#size' => 5, |
|
426 | - '#description' => t('If the parent menu item is a tab, enter the weight of the tab. The lower the number, the more to the left it will be.'), |
|
427 | - '#process' => array('views_process_dependency'), |
|
428 | - '#dependency' => array('radio:tab_options[type]' => array('tab')), |
|
416 | + $form['tab_options']['markup'] = array( |
|
417 | + '#value' => t('Menu selection requires the activation of menu module.'), |
|
429 | 418 | ); |
430 | - break; |
|
419 | + } |
|
420 | + $form['tab_options']['weight'] = array( |
|
421 | + '#suffix' => '</div>', |
|
422 | + '#title' => t('Tab weight'), |
|
423 | + '#type' => 'textfield', |
|
424 | + '#default_value' => $tab_options['weight'], |
|
425 | + '#size' => 5, |
|
426 | + '#description' => t('If the parent menu item is a tab, enter the weight of the tab. The lower the number, the more to the left it will be.'), |
|
427 | + '#process' => array('views_process_dependency'), |
|
428 | + '#dependency' => array('radio:tab_options[type]' => array('tab')), |
|
429 | + ); |
|
430 | + break; |
|
431 | 431 | } |
432 | 432 | } |
433 | 433 | |
@@ -435,37 +435,37 @@ discard block |
||
435 | 435 | // It is very important to call the parent function here: |
436 | 436 | parent::options_validate($form, $form_state); |
437 | 437 | switch ($form_state['section']) { |
438 | - case 'path': |
|
439 | - if (strpos($form_state['values']['path'], '$arg') !== FALSE) { |
|
440 | - form_error($form['path'], t('"$arg" is no longer supported. Use % instead.')); |
|
441 | - } |
|
438 | + case 'path': |
|
439 | + if (strpos($form_state['values']['path'], '$arg') !== FALSE) { |
|
440 | + form_error($form['path'], t('"$arg" is no longer supported. Use % instead.')); |
|
441 | + } |
|
442 | 442 | |
443 | - if (strpos($form_state['values']['path'], '%') === 0) { |
|
444 | - form_error($form['path'], t('"%" may not be used for the first segment of a path.')); |
|
445 | - } |
|
443 | + if (strpos($form_state['values']['path'], '%') === 0) { |
|
444 | + form_error($form['path'], t('"%" may not be used for the first segment of a path.')); |
|
445 | + } |
|
446 | 446 | |
447 | - // automatically remove '/' from path. |
|
448 | - $form_state['values']['path'] = trim($form_state['values']['path'], '/'); |
|
447 | + // automatically remove '/' from path. |
|
448 | + $form_state['values']['path'] = trim($form_state['values']['path'], '/'); |
|
449 | 449 | |
450 | - break; |
|
451 | - case 'menu': |
|
452 | - $path = $this->get_option('path'); |
|
453 | - if ($form_state['values']['menu']['type'] == 'normal' && strpos($path, '%') !== FALSE) { |
|
454 | - form_error($form['menu']['type'], t('Views cannot create normal menu items for paths with a % in them.')); |
|
455 | - } |
|
450 | + break; |
|
451 | + case 'menu': |
|
452 | + $path = $this->get_option('path'); |
|
453 | + if ($form_state['values']['menu']['type'] == 'normal' && strpos($path, '%') !== FALSE) { |
|
454 | + form_error($form['menu']['type'], t('Views cannot create normal menu items for paths with a % in them.')); |
|
455 | + } |
|
456 | 456 | |
457 | - if ($form_state['values']['menu']['type'] == 'default tab' || $form_state['values']['menu']['type'] == 'tab') { |
|
458 | - $bits = explode('/', $path); |
|
459 | - $last = array_pop($bits); |
|
460 | - if ($last == '%') { |
|
461 | - form_error($form['menu']['type'], t('A display whose path ends with a % cannot be a tab.')); |
|
462 | - } |
|
457 | + if ($form_state['values']['menu']['type'] == 'default tab' || $form_state['values']['menu']['type'] == 'tab') { |
|
458 | + $bits = explode('/', $path); |
|
459 | + $last = array_pop($bits); |
|
460 | + if ($last == '%') { |
|
461 | + form_error($form['menu']['type'], t('A display whose path ends with a % cannot be a tab.')); |
|
463 | 462 | } |
463 | + } |
|
464 | 464 | |
465 | - if ($form_state['values']['menu']['type'] != 'none' && empty($form_state['values']['menu']['title'])) { |
|
466 | - form_error($form['menu']['title'], t('Title is required for this menu type.')); |
|
467 | - } |
|
468 | - break; |
|
465 | + if ($form_state['values']['menu']['type'] != 'none' && empty($form_state['values']['menu']['title'])) { |
|
466 | + form_error($form['menu']['title'], t('Title is required for this menu type.')); |
|
467 | + } |
|
468 | + break; |
|
469 | 469 | } |
470 | 470 | } |
471 | 471 | |
@@ -473,19 +473,19 @@ discard block |
||
473 | 473 | // It is very important to call the parent function here: |
474 | 474 | parent::options_submit($form, $form_state); |
475 | 475 | switch ($form_state['section']) { |
476 | - case 'path': |
|
477 | - $this->set_option('path', $form_state['values']['path']); |
|
478 | - break; |
|
479 | - case 'menu': |
|
480 | - $this->set_option('menu', $form_state['values']['menu']); |
|
481 | - // send ajax form to options page if we use it. |
|
482 | - if ($form_state['values']['menu']['type'] == 'default tab') { |
|
483 | - views_ui_add_form_to_stack('display', $this->view, $this->display->id, array('tab_options')); |
|
484 | - } |
|
485 | - break; |
|
486 | - case 'tab_options': |
|
487 | - $this->set_option('tab_options', $form_state['values']['tab_options']); |
|
488 | - break; |
|
476 | + case 'path': |
|
477 | + $this->set_option('path', $form_state['values']['path']); |
|
478 | + break; |
|
479 | + case 'menu': |
|
480 | + $this->set_option('menu', $form_state['values']['menu']); |
|
481 | + // send ajax form to options page if we use it. |
|
482 | + if ($form_state['values']['menu']['type'] == 'default tab') { |
|
483 | + views_ui_add_form_to_stack('display', $this->view, $this->display->id, array('tab_options')); |
|
484 | + } |
|
485 | + break; |
|
486 | + case 'tab_options': |
|
487 | + $this->set_option('tab_options', $form_state['values']['tab_options']); |
|
488 | + break; |
|
489 | 489 | } |
490 | 490 | } |
491 | 491 |