Révision d719f12f
Ajouté par Assos Assos il y a presque 9 ans
drupal7/sites/all/modules/views/handlers/views_handler_area_view.inc | ||
---|---|---|
51 | 51 |
* Render the area |
52 | 52 |
*/ |
53 | 53 |
function render($empty = FALSE) { |
54 |
if (!empty($this->options['view_to_insert'])) { |
|
55 |
list($view_name, $display_id) = explode(':', $this->options['view_to_insert']); |
|
56 |
|
|
57 |
$view = views_get_view($view_name); |
|
58 |
if (empty($view) || !$view->access($display_id)) { |
|
59 |
return; |
|
60 |
} |
|
61 |
$view->set_display($display_id); |
|
62 |
|
|
63 |
// Avoid recursion |
|
64 |
$view->parent_views += $this->view->parent_views; |
|
65 |
$view->parent_views[] = "$view_name:$display_id"; |
|
66 |
|
|
67 |
// Check if the view is part of the parent views of this view |
|
68 |
$search = "$view_name:$display_id"; |
|
69 |
if (in_array($search, $this->view->parent_views)) { |
|
70 |
drupal_set_message(t("Recursion detected in view @view display @display.", array('@view' => $view_name, '@display' => $display_id)), 'error'); |
|
54 |
if ($view = $this->loadView()) { |
|
55 |
if (!empty($this->options['inherit_arguments']) && !empty($this->view->args)) { |
|
56 |
return $view->preview(NULL, $this->view->args); |
|
71 | 57 |
} |
72 | 58 |
else { |
73 |
if (!empty($this->options['inherit_arguments']) && !empty($this->view->args)) { |
|
74 |
return $view->preview($display_id, $this->view->args); |
|
75 |
} |
|
76 |
else { |
|
77 |
return $view->preview($display_id); |
|
78 |
} |
|
59 |
return $view->preview(NULL); |
|
79 | 60 |
} |
80 | 61 |
} |
81 | 62 |
return ''; |
82 | 63 |
} |
64 |
|
|
65 |
/** |
|
66 |
* Loads the used view for rendering. |
|
67 |
* |
|
68 |
* @return \view|NULL |
|
69 |
* The loaded view or NULL, in case the view was not loadable / recursion |
|
70 |
* got detected / access got denied. |
|
71 |
*/ |
|
72 |
protected function loadView() { |
|
73 |
if (empty($this->options['view_to_insert'])) { |
|
74 |
return NULL; |
|
75 |
} |
|
76 |
list($view_name, $display_id) = explode(':', $this->options['view_to_insert']); |
|
77 |
|
|
78 |
$view = views_get_view($view_name); |
|
79 |
if (empty($view) || !$view->access($display_id)) { |
|
80 |
return NULL; |
|
81 |
} |
|
82 |
$view->set_display($display_id); |
|
83 |
|
|
84 |
// Avoid recursion. |
|
85 |
$view->parent_views += $this->view->parent_views; |
|
86 |
$view->parent_views[] = "$view_name:$display_id"; |
|
87 |
|
|
88 |
// Check if the view is part of the parent views of this view. |
|
89 |
$search = "$view_name:$display_id"; |
|
90 |
if (in_array($search, $this->view->parent_views)) { |
|
91 |
drupal_set_message(t("Recursion detected in view @view display @display.", array('@view' => $view_name, '@display' => $display_id)), 'error'); |
|
92 |
return NULL; |
|
93 |
} |
|
94 |
|
|
95 |
return $view; |
|
96 |
} |
|
97 |
|
|
83 | 98 |
} |
drupal7/sites/all/modules/views/handlers/views_handler_argument.inc | ||
---|---|---|
419 | 419 |
// Let the plugins do validation. |
420 | 420 |
$default_id = $form_state['values']['options']['default_argument_type']; |
421 | 421 |
$plugin = $this->get_plugin('argument default', $default_id); |
422 |
if ($plugin) { |
|
422 |
if ($plugin && isset($form['argument_default'][$default_id]) && isset($form_state['values']['options']['argument_default'][$default_id])) {
|
|
423 | 423 |
$plugin->options_validate($form['argument_default'][$default_id], $form_state, $form_state['values']['options']['argument_default'][$default_id]); |
424 | 424 |
} |
425 | 425 |
|
drupal7/sites/all/modules/views/handlers/views_handler_field_math.inc | ||
---|---|---|
26 | 26 |
$form['expression'] = array( |
27 | 27 |
'#type' => 'textarea', |
28 | 28 |
'#title' => t('Expression'), |
29 |
'#description' => t('Enter mathematical expressions such as 2 + 2 or sqrt(5). You may assign variables and create mathematical functions and evaluate them. Use the ; to separate these. For example: f(x) = x + 2; f(2).'),
|
|
29 |
'#description' => t("Enter mathematical expressions such as 2 + 2 or sqrt(5). You may assign variables and create mathematical functions and evaluate them. Use the ; to separate these. For example: f(x) = x + 2; f(2). The result of the previous row's mathematical expression can be accessed by using the [expression] token itself."),
|
|
30 | 30 |
'#default_value' => $this->options['expression'], |
31 | 31 |
); |
32 | 32 |
|
drupal7/sites/all/modules/views/handlers/views_handler_filter_combine.inc | ||
---|---|---|
54 | 54 |
$fields = array(); |
55 | 55 |
// Only add the fields if they have a proper field and table alias. |
56 | 56 |
foreach ($this->options['fields'] as $id) { |
57 |
// Field access checks may have removed this handler. |
|
58 |
if (!isset($this->view->field[$id])) { |
|
59 |
continue; |
|
60 |
} |
|
61 |
|
|
57 | 62 |
$field = $this->view->field[$id]; |
58 | 63 |
// Always add the table of the selected fields to be sure a table alias |
59 | 64 |
// exists. |
drupal7/sites/all/modules/views/includes/admin.inc | ||
---|---|---|
4961 | 4961 |
'#description' => t('Select a translation method to use for Views data like header, footer, and empty text.'), |
4962 | 4962 |
); |
4963 | 4963 |
|
4964 |
$form['locale']['views_localize_all'] = array( |
|
4965 |
'#type' => 'checkbox', |
|
4966 |
'#title' => t('Use same translation method for exported views'), |
|
4967 |
'#description' => t('Exported views will use Core translation by default. Enable this to always use the configured translation method.'), |
|
4968 |
'#default_value' => variable_get('views_localize_all', FALSE), |
|
4969 |
); |
|
4970 |
|
|
4964 | 4971 |
$regions = array(); |
4965 | 4972 |
$regions['watchdog'] = t('Watchdog'); |
4966 | 4973 |
if (module_exists('devel')) { |
drupal7/sites/all/modules/views/includes/ajax.inc | ||
---|---|---|
53 | 53 |
// Overwrite the destination. |
54 | 54 |
// @see drupal_get_destination() |
55 | 55 |
$origin_destination = $path; |
56 |
$query = drupal_http_build_query($_REQUEST);
|
|
56 |
$query = drupal_http_build_query(drupal_get_query_parameters());
|
|
57 | 57 |
if ($query != '') { |
58 | 58 |
$origin_destination .= '?' . $query; |
59 | 59 |
} |
drupal7/sites/all/modules/views/includes/handlers.inc | ||
---|---|---|
758 | 758 |
*/ |
759 | 759 |
public $placeholders = array(); |
760 | 760 |
|
761 |
function views_many_to_one_helper(&$handler) {
|
|
761 |
function __construct(&$handler) {
|
|
762 | 762 |
$this->handler = &$handler; |
763 | 763 |
} |
764 | 764 |
|
drupal7/sites/all/modules/views/includes/plugins.inc | ||
---|---|---|
408 | 408 |
*/ |
409 | 409 |
function views_discover_plugins() { |
410 | 410 |
$cache = array('display' => array(), 'style' => array(), 'row' => array(), 'argument default' => array(), 'argument validator' => array(), 'access' => array(), 'cache' => array(), 'exposed_form' => array()); |
411 |
// Get plugins from all mdoules.
|
|
411 |
// Get plugins from all modules.
|
|
412 | 412 |
foreach (module_implements('views_plugins') as $module) { |
413 | 413 |
$function = $module . '_views_plugins'; |
414 | 414 |
$result = $function(); |
... | ... | |
526 | 526 |
* Provide a full list of possible theme templates used by this style. |
527 | 527 |
*/ |
528 | 528 |
function theme_functions() { |
529 |
if (empty($this->definition['theme'])) { |
|
530 |
$this->definition['theme'] = 'views_view'; |
|
531 |
} |
|
529 | 532 |
return views_theme_functions($this->definition['theme'], $this->view, $this->display); |
530 | 533 |
} |
531 | 534 |
|
drupal7/sites/all/modules/views/includes/view.inc | ||
---|---|---|
1150 | 1150 |
$cache = $this->display_handler->get_plugin('cache'); |
1151 | 1151 |
} |
1152 | 1152 |
if ($cache && $cache->cache_get('results')) { |
1153 |
if($this->query->pager->use_pager()) { |
|
1153 |
if($this->query->pager->use_pager() || !empty($this->get_total_rows)) {
|
|
1154 | 1154 |
$this->query->pager->total_items = $this->total_rows; |
1155 | 1155 |
$this->query->pager->update_page_info(); |
1156 | 1156 |
} |
... | ... | |
2102 | 2102 |
* Determine whether a view supports admin string translation. |
2103 | 2103 |
*/ |
2104 | 2104 |
function is_translatable() { |
2105 |
// Use translation no matter what type of view. |
|
2106 |
if (variable_get('views_localize_all', FALSE)) { |
|
2107 |
return TRUE; |
|
2108 |
} |
|
2105 | 2109 |
// If the view is normal or overridden, use admin string translation. |
2106 | 2110 |
// A newly created view won't have a type. Accept this. |
2107 | 2111 |
return (!isset($this->type) || in_array($this->type, array(t('Normal'), t('Overridden')))) ? TRUE : FALSE; |
... | ... | |
2566 | 2570 |
var $display_options; |
2567 | 2571 |
|
2568 | 2572 |
var $db_table = 'views_display'; |
2569 |
function views_display($init = TRUE) {
|
|
2573 |
function __construct($init = TRUE) {
|
|
2570 | 2574 |
parent::init($init); |
2571 | 2575 |
} |
2572 | 2576 |
|
drupal7/sites/all/modules/views/js/ajax_view.js | ||
---|---|---|
57 | 57 |
this.settings = settings; |
58 | 58 |
|
59 | 59 |
// Add the ajax to exposed forms. |
60 |
this.$exposed_form = this.$view.children('.view-filters').children('form');
|
|
60 |
this.$exposed_form = $('#views-exposed-form-'+ settings.view_name.replace(/_/g, '-') + '-' + settings.view_display_id.replace(/_/g, '-'));
|
|
61 | 61 |
this.$exposed_form.once(jQuery.proxy(this.attachExposedFormAjax, this)); |
62 | 62 |
|
63 | 63 |
// Add the ajax to pagers. |
drupal7/sites/all/modules/views/modules/field/views_handler_field_field.inc | ||
---|---|---|
716 | 716 |
} |
717 | 717 |
|
718 | 718 |
function get_value($values, $field = NULL) { |
719 |
if (!isset($values->_field_data[$this->field_alias]['entity']) || !is_object($values->_field_data[$this->field_alias]['entity'])) { |
|
720 |
return array(); |
|
721 |
} |
|
722 |
|
|
719 | 723 |
// Go ahead and render and store in $this->items. |
720 | 724 |
$entity = clone $values->_field_data[$this->field_alias]['entity']; |
721 | 725 |
|
drupal7/sites/all/modules/views/modules/locale/views_handler_field_locale_link_edit.inc | ||
---|---|---|
52 | 52 |
$text = !empty($this->options['text']) ? $this->options['text'] : t('edit'); |
53 | 53 |
|
54 | 54 |
$this->options['alter']['make_link'] = TRUE; |
55 |
$this->options['alter']['path'] = 'admin/build/translate/edit/' . $data;
|
|
55 |
$this->options['alter']['path'] = 'admin/config/regional/translate/edit/' . $data;
|
|
56 | 56 |
$this->options['alter']['query'] = drupal_get_destination(); |
57 | 57 |
|
58 | 58 |
return $text; |
drupal7/sites/all/modules/views/modules/node.views.inc | ||
---|---|---|
413 | 413 |
// have a group defined will go into this field by default. |
414 | 414 |
$data['node_revisions']['moved to'] = 'node_revision'; |
415 | 415 |
$data['node_revision']['table']['entity type'] = 'node'; |
416 |
$data['node_revision']['table']['revision'] = TRUE; |
|
416 | 417 |
$data['node_revision']['table']['group'] = t('Content revision'); |
417 | 418 |
// Support the conversion of the field body |
418 | 419 |
$data['node_revisions']['body']['moved to'] = array('field_revision_data', 'body-revision_id'); |
drupal7/sites/all/modules/views/modules/node/views_handler_filter_node_access.inc | ||
---|---|---|
23 | 23 |
function query() { |
24 | 24 |
if (!user_access('administer nodes') && module_implements('node_grants')) { |
25 | 25 |
$table = $this->ensure_my_table(); |
26 |
$grants = db_or(); |
|
27 |
foreach (node_access_grants('view') as $realm => $gids) { |
|
28 |
foreach ($gids as $gid) { |
|
29 |
$grants->condition(db_and() |
|
30 |
->condition($table . '.gid', $gid) |
|
31 |
->condition($table . '.realm', $realm) |
|
32 |
); |
|
33 |
} |
|
34 |
} |
|
26 |
$grants = node_add_node_grants_to_query(node_access_grants('view')); |
|
35 | 27 |
|
36 | 28 |
$this->query->add_where('AND', $grants); |
37 | 29 |
$this->query->add_where('AND', $table . '.grant_view', 1, '>='); |
drupal7/sites/all/modules/views/modules/taxonomy/views_handler_filter_term_node_tid.inc | ||
---|---|---|
195 | 195 |
'#options' => $options, |
196 | 196 |
'#size' => min(9, count($options)), |
197 | 197 |
'#default_value' => $default_value, |
198 |
'#description' => t('Leave blank for all. Otherwise, the first selected term will be the default instead of "Any".'), |
|
198 | 199 |
); |
199 | 200 |
|
200 | 201 |
if (!empty($form_state['exposed']) && isset($identifier) && !isset($form_state['input'][$identifier])) { |
... | ... | |
228 | 229 |
return TRUE; |
229 | 230 |
} |
230 | 231 |
|
232 |
// We need to know the operator, which is normally set in |
|
233 |
// views_handler_filter::accept_exposed_input(), before we actually call |
|
234 |
// the parent version of ourselves. |
|
235 |
if (!empty($this->options['expose']['use_operator']) && !empty($this->options['expose']['operator_id']) && isset($input[$this->options['expose']['operator_id']])) { |
|
236 |
$this->operator = $input[$this->options['expose']['operator_id']]; |
|
237 |
} |
|
238 |
|
|
231 | 239 |
// If view is an attachment and is inheriting exposed filters, then assume |
232 | 240 |
// exposed input has already been validated |
233 | 241 |
if (!empty($this->view->is_attachment) && $this->view->display_handler->uses_exposed()) { |
234 | 242 |
$this->validated_exposed_input = (array) $this->view->exposed_raw_input[$this->options['expose']['identifier']]; |
235 | 243 |
} |
236 | 244 |
|
245 |
// If we're checking for EMPTY or NOT, we don't need any input, and we can |
|
246 |
// say that our input conditions are met by just having the right operator. |
|
247 |
if ($this->operator == 'empty' || $this->operator == 'not empty') { |
|
248 |
return TRUE; |
|
249 |
} |
|
250 |
|
|
237 | 251 |
// If it's non-required and there's no value don't bother filtering. |
238 | 252 |
if (!$this->options['expose']['required'] && empty($this->validated_exposed_input)) { |
239 | 253 |
return FALSE; |
drupal7/sites/all/modules/views/modules/translation.views.inc | ||
---|---|---|
51 | 51 |
), |
52 | 52 |
); |
53 | 53 |
|
54 |
// The source translation.
|
|
54 |
// All translations.
|
|
55 | 55 |
$data['node']['translation'] = array( |
56 | 56 |
'group' => t('Content translation'), |
57 | 57 |
'title' => t('Translations'), |
... | ... | |
62 | 62 |
'base' => 'node', |
63 | 63 |
'base field' => 'tnid', |
64 | 64 |
'relationship table' => 'node', |
65 |
'relationship field' => 'nid', |
|
65 |
'relationship field' => 'tnid',
|
|
66 | 66 |
'handler' => 'views_handler_relationship_translation', |
67 | 67 |
'label' => t('Translations'), |
68 | 68 |
), |
... | ... | |
78 | 78 |
), |
79 | 79 |
); |
80 | 80 |
|
81 |
// The source translation.
|
|
81 |
// Child translation.
|
|
82 | 82 |
$data['node']['child_translation'] = array( |
83 | 83 |
'group' => t('Node translation'), |
84 | 84 |
'title' => t('Child translation'), |
drupal7/sites/all/modules/views/plugins/views_plugin_argument_validate.inc | ||
---|---|---|
86 | 86 |
/** |
87 | 87 |
* Process the summary arguments for displaying. |
88 | 88 |
* |
89 |
* Some plugins alter the argument so it uses something else interal.
|
|
89 |
* Some plugins alter the argument so it uses something else internally.
|
|
90 | 90 |
* For example the user validation set's the argument to the uid, |
91 | 91 |
* for a faster query. But there are use cases where you want to use |
92 | 92 |
* the old value again, for example the summary. |
drupal7/sites/all/modules/views/plugins/views_plugin_display.inc | ||
---|---|---|
739 | 739 |
function uses_link_display() { return !$this->has_path(); } |
740 | 740 |
|
741 | 741 |
/** |
742 |
* Check to see if the display can put the exposed formin a block. |
|
742 |
* Check to see if the display can put the exposed form in a block.
|
|
743 | 743 |
* |
744 | 744 |
* By default, displays that do not have a path cannot disconnect |
745 | 745 |
* the exposed form and put it in a block, because the form has no |
... | ... | |
1150 | 1150 |
); |
1151 | 1151 |
} |
1152 | 1152 |
|
1153 |
$display_comment = check_plain(drupal_substr($this->get_option('display_comment'), 0, 10));
|
|
1153 |
$display_comment = check_plain(views_ui_truncate($this->get_option('display_comment'), 80));
|
|
1154 | 1154 |
$options['display_comment'] = array( |
1155 | 1155 |
'category' => 'other', |
1156 | 1156 |
'title' => t('Comment'), |
... | ... | |
1419 | 1419 |
} |
1420 | 1420 |
$form['#title'] = check_plain($this->display->display_title) . ': '; |
1421 | 1421 |
|
1422 |
// Set the 'section' to hilite on the form.
|
|
1422 |
// Set the 'section' to highlight on the form.
|
|
1423 | 1423 |
// If it's the item we're looking at is pulling from the default display, |
1424 | 1424 |
// reflect that. Don't use is_defaulted since we want it to show up even |
1425 | 1425 |
// on the default display. |
... | ... | |
1573 | 1573 |
$plugin = $this->get_plugin('access'); |
1574 | 1574 |
$form['#title'] .= t('Access options'); |
1575 | 1575 |
if ($plugin) { |
1576 |
$form['#help_topic'] = $plugin->definition['help topic']; |
|
1577 |
$form['#help_module'] = $plugin->definition['module']; |
|
1576 |
if (!empty($plugin->definition['help topic'])) { |
|
1577 |
$form['#help_topic'] = $plugin->definition['help topic']; |
|
1578 |
} |
|
1579 |
if (!empty($plugin->definition['module'])) { |
|
1580 |
$form['#help_module'] = $plugin->definition['module']; |
|
1581 |
} |
|
1578 | 1582 |
|
1579 | 1583 |
$form['access_options'] = array( |
1580 | 1584 |
'#tree' => TRUE, |
... | ... | |
1615 | 1619 |
$plugin = $this->get_plugin('cache'); |
1616 | 1620 |
$form['#title'] .= t('Caching options'); |
1617 | 1621 |
if ($plugin) { |
1618 |
$form['#help_topic'] = $plugin->definition['help topic']; |
|
1619 |
$form['#help_module'] = $plugin->definition['module']; |
|
1622 |
if (!empty($plugin->definition['help topic'])) { |
|
1623 |
$form['#help_topic'] = $plugin->definition['help topic']; |
|
1624 |
} |
|
1625 |
if (!empty($plugin->definition['module'])) { |
|
1626 |
$form['#help_module'] = $plugin->definition['module']; |
|
1627 |
} |
|
1620 | 1628 |
|
1621 | 1629 |
$form['cache_options'] = array( |
1622 | 1630 |
'#tree' => TRUE, |
... | ... | |
1635 | 1643 |
$form['#title'] .= t('Query options'); |
1636 | 1644 |
$this->view->init_query(); |
1637 | 1645 |
if ($this->view->query) { |
1638 |
if (isset($this->view->query->definition['help topic'])) {
|
|
1646 |
if (!empty($this->view->query->definition['help topic'])) {
|
|
1639 | 1647 |
$form['#help_topic'] = $this->view->query->definition['help topic']; |
1640 | 1648 |
} |
1641 |
|
|
1642 |
if (isset($this->view->query->definition['module'])) { |
|
1649 |
if (!empty($this->view->query->definition['module'])) { |
|
1643 | 1650 |
$form['#help_module'] = $this->view->query->definition['module']; |
1644 | 1651 |
} |
1645 | 1652 |
|
... | ... | |
1734 | 1741 |
} |
1735 | 1742 |
$plugin = $this->get_plugin(empty($style) ? 'row' : 'style'); |
1736 | 1743 |
if ($plugin) { |
1737 |
if (isset($plugin->definition['help topic'])) {
|
|
1744 |
if (!empty($plugin->definition['help topic'])) {
|
|
1738 | 1745 |
$form['#help_topic'] = $plugin->definition['help topic']; |
1746 |
} |
|
1747 |
if (!empty($plugin->definition['module'])) { |
|
1739 | 1748 |
$form['#help_module'] = $plugin->definition['module']; |
1740 | 1749 |
} |
1741 | 1750 |
$form[$form_state['section']] = array( |
... | ... | |
2117 | 2126 |
$plugin = $this->get_plugin('exposed_form'); |
2118 | 2127 |
$form['#title'] .= t('Exposed form options'); |
2119 | 2128 |
if ($plugin) { |
2120 |
$form['#help_topic'] = $plugin->definition['help topic']; |
|
2129 |
if (!empty($plugin->definition['help topic'])) { |
|
2130 |
$form['#help_topic'] = $plugin->definition['help topic']; |
|
2131 |
} |
|
2132 |
if (!empty($plugin->definition['module'])) { |
|
2133 |
$form['#help_module'] = $plugin->definition['module']; |
|
2134 |
} |
|
2121 | 2135 |
|
2122 | 2136 |
$form['exposed_form_options'] = array( |
2123 | 2137 |
'#tree' => TRUE, |
... | ... | |
2154 | 2168 |
$plugin = $this->get_plugin('pager'); |
2155 | 2169 |
$form['#title'] .= t('Pager options'); |
2156 | 2170 |
if ($plugin) { |
2157 |
$form['#help_topic'] = $plugin->definition['help topic']; |
|
2171 |
if (!empty($plugin->definition['help topic'])) { |
|
2172 |
$form['#help_topic'] = $plugin->definition['help topic']; |
|
2173 |
} |
|
2174 |
if (!empty($plugin->definition['module'])) { |
|
2175 |
$form['#help_module'] = $plugin->definition['module']; |
|
2176 |
} |
|
2158 | 2177 |
|
2159 | 2178 |
$form['pager_options'] = array( |
2160 | 2179 |
'#tree' => TRUE, |
drupal7/sites/all/modules/views/plugins/views_plugin_display_block.inc | ||
---|---|---|
222 | 222 |
} |
223 | 223 |
|
224 | 224 |
/** |
225 |
* Save the block cache setting in the blocks table if this block allready
|
|
226 |
* exists in the blocks table. Dirty fix untill http://drupal.org/node/235673 gets in.
|
|
225 |
* Save the block cache setting in the blocks table if this block already |
|
226 |
* exists in the blocks table. Dirty fix until http://drupal.org/node/235673 gets in. |
|
227 | 227 |
*/ |
228 | 228 |
function save_block_cache($delta, $cache_setting) { |
229 | 229 |
if (strlen($delta) >= 32) { |
drupal7/sites/all/modules/views/plugins/views_plugin_query_default.inc | ||
---|---|---|
143 | 143 |
); |
144 | 144 |
|
145 | 145 |
/** |
146 |
* -- we no longer want the base field to appear automatigically.
|
|
146 |
* -- we no longer want the base field to appear automatically. |
|
147 | 147 |
if ($base_field) { |
148 | 148 |
$this->fields[$base_field] = array( |
149 | 149 |
'table' => $base_table, |
... | ... | |
888 | 888 |
/** |
889 | 889 |
* Add a complex WHERE clause to the query. |
890 | 890 |
* |
891 |
* The caller is reponsible for ensuring that all fields are fully qualified |
|
891 |
* The caller is responsible for ensuring that all fields are fully qualified
|
|
892 | 892 |
* (TABLE.FIELD) and that the table already exists in the query. |
893 | 893 |
* Internally the dbtng method "where" is used. |
894 | 894 |
* |
... | ... | |
1620 | 1620 |
} |
1621 | 1621 |
$entity_type = $table_data['table']['entity type']; |
1622 | 1622 |
$info = entity_get_info($entity_type); |
1623 |
$id_alias = $this->get_field_alias($base_table_alias, $info['entity keys']['id']); |
|
1623 |
$is_revision = !empty($table_data['table']['revision']); |
|
1624 |
$id_alias = $this->get_field_alias($base_table_alias, $info['entity keys'][$is_revision ? 'revision' : 'id']); |
|
1624 | 1625 |
|
1625 | 1626 |
// Assemble the ids of the entities to load. |
1626 | 1627 |
$ids = array(); |
... | ... | |
1630 | 1631 |
} |
1631 | 1632 |
} |
1632 | 1633 |
|
1633 |
$entities = entity_load($entity_type, $ids); |
|
1634 |
// Re-key the array by row-index. |
|
1635 |
$result = array(); |
|
1636 |
foreach ($ids as $key => $id) { |
|
1637 |
$result[$key] = isset($entities[$id]) ? $entities[$id] : FALSE; |
|
1634 |
if (!$is_revision) { |
|
1635 |
$entities = entity_load($entity_type, $ids); |
|
1636 |
|
|
1637 |
// Re-key the array by row-index. |
|
1638 |
$result = array(); |
|
1639 |
foreach ($ids as $key => $id) { |
|
1640 |
$result[$key] = isset($entities[$id]) ? $entities[$id] : FALSE; |
|
1641 |
} |
|
1638 | 1642 |
} |
1643 |
else { |
|
1644 |
// There's no way in core to load revisions in bulk. |
|
1645 |
$result = array(); |
|
1646 |
foreach ($ids as $key => $id) { |
|
1647 |
// Nodes can be dealt with in core. |
|
1648 |
if ($entity_type == 'node') { |
|
1649 |
$result[$key] = node_load(NULL, $id); |
|
1650 |
} |
|
1651 |
// Otherwise see if entity is enabled. |
|
1652 |
elseif (module_exists('entity')) { |
|
1653 |
$result[$key] = entity_revision_load($entity_type, $id); |
|
1654 |
} |
|
1655 |
else { |
|
1656 |
// Otherwise this isn't supported. |
|
1657 |
watchdog('views', 'Attempt to load a revision on an unsupported entity type @entity_type.', array('@entity_type' => $entity_type), WATCHDOG_WARNING); |
|
1658 |
} |
|
1659 |
} |
|
1660 |
} |
|
1661 |
|
|
1639 | 1662 |
return array($entity_type, $result); |
1640 | 1663 |
} |
1641 | 1664 |
} |
drupal7/sites/all/modules/views/plugins/views_plugin_style.inc | ||
---|---|---|
182 | 182 |
function options_form(&$form, &$form_state) { |
183 | 183 |
parent::options_form($form, $form_state); |
184 | 184 |
// Only fields-based views can handle grouping. Style plugins can also exclude |
185 |
// themselves from being groupable by setting their "use grouping" definiton |
|
185 |
// themselves from being groupable by setting their "use grouping" definition
|
|
186 | 186 |
// key to FALSE. |
187 | 187 |
// @TODO: Document "uses grouping" in docs.php when docs.php is written. |
188 | 188 |
if ($this->uses_fields() && $this->definition['uses grouping']) { |
... | ... | |
191 | 191 |
$options += $field_labels; |
192 | 192 |
// If there are no fields, we can't group on them. |
193 | 193 |
if (count($options) > 1) { |
194 |
// This is for backward compability, when there was just a single select form. |
|
194 |
// This is for backward compatibility, when there was just a single select form.
|
|
195 | 195 |
if (is_string($this->options['grouping'])) { |
196 | 196 |
$grouping = $this->options['grouping']; |
197 | 197 |
$this->options['grouping'] = array(); |
... | ... | |
419 | 419 |
* @endcode |
420 | 420 |
*/ |
421 | 421 |
function render_grouping($records, $groupings = array(), $group_rendered = NULL) { |
422 |
// This is for backward compability, when $groupings was a string containing |
|
422 |
// This is for backward compatibility, when $groupings was a string containing
|
|
423 | 423 |
// the ID of a single field. |
424 | 424 |
if (is_string($groupings)) { |
425 | 425 |
$rendered = $group_rendered === NULL ? TRUE : $group_rendered; |
... | ... | |
486 | 486 |
); |
487 | 487 |
} |
488 | 488 |
|
489 |
// If this parameter isn't explicitely set modify the output to be fully
|
|
489 |
// If this parameter isn't explicitly set modify the output to be fully |
|
490 | 490 |
// backward compatible to code before Views 7.x-3.0-rc2. |
491 | 491 |
// @TODO Remove this as soon as possible e.g. October 2020 |
492 | 492 |
if ($group_rendered === NULL) { |
drupal7/sites/all/modules/views/plugins/views_plugin_style_rss.inc | ||
---|---|---|
71 | 71 |
return array(); |
72 | 72 |
} |
73 | 73 |
|
74 |
/** |
|
75 |
* Return an atom:link XHTML element to add to the channel to comply with |
|
76 |
* the RSS 2.0 specification. |
|
77 |
* |
|
78 |
* @see http://validator.w3.org/feed/docs/warning/MissingAtomSelfLink.html |
|
79 |
* |
|
80 |
* @return |
|
81 |
* An array that can be passed to format_xml_elements(). |
|
82 |
*/ |
|
83 |
function get_channel_elements_atom_link() { |
|
84 |
$url_options = array('absolute' => TRUE); |
|
85 |
$input = $this->view->get_exposed_input(); |
|
86 |
if ($input) { |
|
87 |
$url_options['query'] = $input; |
|
88 |
} |
|
89 |
$url = url($this->view->get_url(), $url_options); |
|
90 |
|
|
91 |
return array( |
|
92 |
array( |
|
93 |
'namespace' => array('xmlns:atom' => 'http://www.w3.org/2005/Atom'), |
|
94 |
'key' => 'atom:link', |
|
95 |
'attributes' => array( |
|
96 |
'href' => $url, |
|
97 |
'rel' => 'self', |
|
98 |
'type' => 'application/rss+xml', |
|
99 |
), |
|
100 |
), |
|
101 |
); |
|
102 |
} |
|
103 |
|
|
74 | 104 |
/** |
75 | 105 |
* Get RSS feed description. |
76 | 106 |
* |
... | ... | |
99 | 129 |
|
100 | 130 |
// Fetch any additional elements for the channel and merge in their |
101 | 131 |
// namespaces. |
102 |
$this->channel_elements = $this->get_channel_elements(); |
|
132 |
$this->channel_elements = array_merge( |
|
133 |
$this->get_channel_elements(), |
|
134 |
$this->get_channel_elements_atom_link() |
|
135 |
); |
|
103 | 136 |
foreach ($this->channel_elements as $element) { |
104 | 137 |
if (isset($element['namespace'])) { |
105 | 138 |
$this->namespaces = array_merge($this->namespaces, $element['namespace']); |
drupal7/sites/all/modules/views/test_templates/README.txt | ||
---|---|---|
1 |
Workaround for: |
|
2 |
|
|
3 |
- https://www.drupal.org/node/2450447 |
|
4 |
- https://www.drupal.org/node/2415991 |
|
5 |
|
|
6 |
|
|
7 |
Files of this folder cannot be included inside the views/tests directory because |
|
8 |
they are included as tests cases and make testbot crash. |
|
9 |
|
|
10 |
This files could be moved to tests/templates once |
|
11 |
https://www.drupal.org/node/2415991 be properly fixed. |
drupal7/sites/all/modules/views/tests/views_test.info | ||
---|---|---|
5 | 5 |
dependencies[] = views |
6 | 6 |
hidden = TRUE |
7 | 7 |
|
8 |
; Information added by Drupal.org packaging script on 2015-04-29
|
|
9 |
version = "7.x-3.11"
|
|
8 |
; Information added by Drupal.org packaging script on 2015-11-04
|
|
9 |
version = "7.x-3.12"
|
|
10 | 10 |
core = "7.x" |
11 | 11 |
project = "views" |
12 |
datestamp = "1430321048"
|
|
12 |
datestamp = "1446653346"
|
|
13 | 13 |
|
drupal7/sites/all/modules/views/tests/views_test.module | ||
---|---|---|
23 | 23 |
function views_test_views_api() { |
24 | 24 |
return array( |
25 | 25 |
'api' => 3.0, |
26 |
'template path' => drupal_get_path('module', 'views_test') . '/templates',
|
|
26 |
'template path' => drupal_get_path('module', 'views') . '/test_templates',
|
|
27 | 27 |
); |
28 | 28 |
} |
29 | 29 |
|
drupal7/sites/all/modules/views/theme/views-view-table.tpl.php | ||
---|---|---|
27 | 27 |
<thead> |
28 | 28 |
<tr> |
29 | 29 |
<?php foreach ($header as $field => $label): ?> |
30 |
<th <?php if ($header_classes[$field]) { print 'class="'. $header_classes[$field] . '" '; } ?>> |
|
30 |
<th <?php if ($header_classes[$field]) { print 'class="'. $header_classes[$field] . '" '; } ?> scope="col">
|
|
31 | 31 |
<?php print $label; ?> |
32 | 32 |
</th> |
33 | 33 |
<?php endforeach; ?> |
drupal7/sites/all/modules/views/views.api.php | ||
---|---|---|
143 | 143 |
* responsible for building the query. Instead, they are objects that are used |
144 | 144 |
* to display the view or make other modifications. |
145 | 145 |
* |
146 |
* There are 10 types of plugins in Views:
|
|
146 |
* There are several types of plugins in Views:
|
|
147 | 147 |
* - Display: Display plugins are responsible for controlling *where* a view |
148 | 148 |
* lives; that is, how they are being exposed to other parts of Drupal. Page |
149 | 149 |
* and block are the most common displays, as well as the ubiquitous 'master' |
... | ... | |
431 | 431 |
'label' => t('Published'), |
432 | 432 |
// This setting is used by the boolean filter handler, as possible option. |
433 | 433 |
'type' => 'yes-no', |
434 |
// use boolean_field = 1 instead of boolean_field <> 0 in WHERE statment. |
|
434 |
// use boolean_field = 1 instead of boolean_field <> 0 in WHERE statement.
|
|
435 | 435 |
'use equal' => TRUE, |
436 | 436 |
), |
437 | 437 |
'sort' => array( |
... | ... | |
602 | 602 |
* must be one of row, display, display_extender, style, argument default, |
603 | 603 |
* argument validator, access, query, cache, pager, exposed_form or |
604 | 604 |
* localization. The plugin name should be prefixed with your module name. |
605 |
* The value for each entry is an associateive array that may contain the
|
|
605 |
* The value for each entry is an associative array that may contain the |
|
606 | 606 |
* following entries: |
607 | 607 |
* - Used by all plugin types: |
608 | 608 |
* - title (required): The name of the plugin, as shown in Views. Wrap in |
... | ... | |
723 | 723 |
* - path: (optional) If includes are stored somewhere other than within the |
724 | 724 |
* root module directory, specify its path here. |
725 | 725 |
* - template path: (optional) A path where the module has stored it's views |
726 |
* template files. When you have specificed this key views automatically
|
|
726 |
* template files. When you have specified this key views automatically |
|
727 | 727 |
* uses the template files for the views. You can use the same naming |
728 | 728 |
* conventions like for normal views template files. |
729 | 729 |
*/ |
... | ... | |
859 | 859 |
* The View being executed. |
860 | 860 |
* @return |
861 | 861 |
* An array with keys being the strings to replace, and the values the strings |
862 |
* to replace them with. The strings to replace are ofted surrounded with
|
|
862 |
* to replace them with. The strings to replace are often surrounded with
|
|
863 | 863 |
* '***', as illustrated in the example implementation. |
864 | 864 |
*/ |
865 | 865 |
function hook_views_query_substitutions($view) { |
... | ... | |
924 | 924 |
* The view object about to be processed. |
925 | 925 |
*/ |
926 | 926 |
function hook_views_pre_build(&$view) { |
927 |
// Because of some unexplicable business logic, we should remove all
|
|
927 |
// Because of some inexplicable business logic, we should remove all
|
|
928 | 928 |
// attachments from all views on Mondays. |
929 | 929 |
// (This alter could be done later in the execution process as well.) |
930 | 930 |
if (date('D') == 'Mon') { |
... | ... | |
1153 | 1153 |
// Replace Views' method for scrolling to the top of the element with your |
1154 | 1154 |
// custom scrolling method. |
1155 | 1155 |
foreach ($commands as &$command) { |
1156 |
if ($command['method'] == 'viewsScrollTop') {
|
|
1157 |
$command['method'] .= 'myScrollTop';
|
|
1156 |
if ($command['command'] == 'viewsScrollTop') {
|
|
1157 |
$command['command'] .= 'myScrollTop';
|
|
1158 | 1158 |
} |
1159 | 1159 |
} |
1160 | 1160 |
} |
drupal7/sites/all/modules/views/views.info | ||
---|---|---|
318 | 318 |
files[] = tests/views_view.test |
319 | 319 |
files[] = tests/views_ui.test |
320 | 320 |
|
321 |
; Information added by Drupal.org packaging script on 2015-04-29
|
|
322 |
version = "7.x-3.11"
|
|
321 |
; Information added by Drupal.org packaging script on 2015-11-04
|
|
322 |
version = "7.x-3.12"
|
|
323 | 323 |
core = "7.x" |
324 | 324 |
project = "views" |
325 |
datestamp = "1430321048"
|
|
325 |
datestamp = "1446653346"
|
|
326 | 326 |
|
drupal7/sites/all/modules/views/views.install | ||
---|---|---|
402 | 402 |
} |
403 | 403 |
|
404 | 404 |
/** |
405 |
* Enlarge the views_display.display_options field to accomodate a larger set |
|
405 |
* Enlarge the views_display.display_options field to accommodate a larger set
|
|
406 | 406 |
* of configurations (e. g. fields, filters, etc.) on a display. |
407 | 407 |
*/ |
408 | 408 |
function views_schema_6009() { |
... | ... | |
631 | 631 |
); |
632 | 632 |
db_change_field('views_view', 'name', 'name', $new_field); |
633 | 633 |
} |
634 |
|
|
635 |
/** |
|
636 |
* Remove headers field from cache tables |
|
637 |
* |
|
638 |
* @see system_update_7054(). |
|
639 |
*/ |
|
640 |
function views_update_7302() { |
|
641 |
if (db_field_exists('cache_views', 'headers')) { |
|
642 |
db_drop_field('cache_views', 'headers'); |
|
643 |
} |
|
644 |
if (db_field_exists('cache_views_data', 'headers')) { |
|
645 |
db_drop_field('cache_views_data', 'headers'); |
|
646 |
} |
|
647 |
} |
drupal7/sites/all/modules/views/views.module | ||
---|---|---|
1020 | 1020 |
* permissions. If the $account argument is omitted, the current user |
1021 | 1021 |
* is used. |
1022 | 1022 |
*/ |
1023 |
function views_check_perm($perm, $account = NULL) { |
|
1024 |
return user_access($perm, $account) || user_access('access all views', $account); |
|
1023 |
function views_check_perm($perms, $account = NULL) { |
|
1024 |
// Backward compatibility to ensure also a single permission string is |
|
1025 |
// properly processed. |
|
1026 |
$perms = is_array($perms) ? $perms : array($perms); |
|
1027 |
if (user_access('access all views', $account)) { |
|
1028 |
return TRUE; |
|
1029 |
} |
|
1030 |
// Perms are handled as OR, as soon one permission allows access TRUE is |
|
1031 |
// returned. |
|
1032 |
foreach ($perms as $perm) { |
|
1033 |
if (user_access($perm, $account)) { |
|
1034 |
return TRUE; |
|
1035 |
} |
|
1036 |
} |
|
1037 |
return FALSE; |
|
1025 | 1038 |
} |
1026 | 1039 |
|
1027 | 1040 |
/** |
... | ... | |
1298 | 1311 |
* Either 'display', 'style' or 'row' |
1299 | 1312 |
* @param $key |
1300 | 1313 |
* For style plugins, this is an optional type to restrict to. May be 'normal', |
1301 |
* 'summary', 'feed' or others based on the neds of the display. |
|
1314 |
* 'summary', 'feed' or others based on the needs of the display.
|
|
1302 | 1315 |
* @param $base |
1303 | 1316 |
* An array of possible base tables. |
1304 | 1317 |
* |
... | ... | |
2413 | 2426 |
* Trim the field down to the specified length. |
2414 | 2427 |
* |
2415 | 2428 |
* @param $alter |
2416 |
* - max_length: Maximum lenght of the string, the rest gets truncated.
|
|
2429 |
* - max_length: Maximum length of the string, the rest gets truncated.
|
|
2417 | 2430 |
* - word_boundary: Trim only on a word boundary. |
2418 | 2431 |
* - ellipsis: Show an ellipsis (...) at the end of the trimmed string. |
2419 | 2432 |
* - html: Take sure that the html is correct. |
drupal7/sites/all/modules/views/views_ui.info | ||
---|---|---|
7 | 7 |
files[] = views_ui.module |
8 | 8 |
files[] = plugins/views_wizard/views_ui_base_views_wizard.class.php |
9 | 9 |
|
10 |
; Information added by Drupal.org packaging script on 2015-04-29
|
|
11 |
version = "7.x-3.11"
|
|
10 |
; Information added by Drupal.org packaging script on 2015-11-04
|
|
11 |
version = "7.x-3.12"
|
|
12 | 12 |
core = "7.x" |
13 | 13 |
project = "views" |
14 |
datestamp = "1430321048"
|
|
14 |
datestamp = "1446653346"
|
|
15 | 15 |
|
drupal7/sites/all/modules/views/views_ui.module | ||
---|---|---|
248 | 248 |
} |
249 | 249 |
|
250 | 250 |
/** |
251 |
* Impements hook_custom_theme()
|
|
251 |
* Implements hook_custom_theme().
|
|
252 | 252 |
*/ |
253 | 253 |
function views_ui_custom_theme() { |
254 | 254 |
$theme = variable_get('views_ui_custom_theme', '_default'); |
Formats disponibles : Unified diff
Weekly update of contrib modules