Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663

This commit is contained in:
Greg Anderson 2015-10-08 11:40:12 -07:00
parent eb34d130a8
commit f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions

View file

@ -38,6 +38,18 @@ function template_preprocess_views_view(&$variables) {
$variables['attributes']['class'][] = $variables['css_class'];
}
// contextual_preprocess() only works on render elements, and since this theme
// hook is not for a render element, contextual_preprocess() falls back to the
// first argument and checks if that is a render element. The first element is
// view_array. However, view_array does not get set anywhere, but since we do
// have access to the View object, we can also access the View object's
// element, which is a render element that does have #contextual_links set if
// the display supports it. Doing this allows contextual_preprocess() to
// access this theme hook's render element, and therefore allows this template
// to have contextual links.
// @see views_theme()
$variables['view_array'] = $variables['view']->element;
// Attachments are always updated with the outer view, never by themselves,
// so they do not have dom ids.
if (empty($view->is_attachment)) {
@ -148,6 +160,7 @@ function template_preprocess_views_view_fields(&$variables) {
if ($object->label) {
// Add a colon in a label suffix.
if ($object->handler->options['element_label_colon']) {
$object->label_suffix = ': ';
$object->has_label_colon = TRUE;
}
@ -162,6 +175,7 @@ function template_preprocess_views_view_fields(&$variables) {
$attributes['class'][] = 'views-label-' . $object->class;
}
// Set up field label.
$element_label_class = $object->handler->elementLabelClasses($row->index);
if ($element_label_class) {
$attributes['class'][] = $element_label_class;
@ -176,61 +190,6 @@ function template_preprocess_views_view_fields(&$variables) {
}
/**
* Returns HTML for multiple views fields.
*
* @param $variables
* An associative array containing:
* - fields: An array of field objects. Each field object contains:
* - separator: A string that separates the fields.
* - wrapper_suffix: A string added to the beginning of the fields.
* - label_html: An HTML string that labels the fields.
* - content: The fields.
* - wrapper_suffix: A string added to the end of the fields.
*
* @see template_preprocess_views_view_fields()
*
* @ingroup themeable
*/
function theme_views_view_fields($variables) {
$fields = $variables['fields'];
$output = '';
foreach ($fields as $field) {
if (!empty($field->separator)) {
$output .= $field->separator;
}
$wrapper_element = Html::escape($field->wrapper_element);
if ($wrapper_element) {
$output .= '<' . $wrapper_element . $field->wrapper_attributes . '>';
if (isset($field->label_element) && !empty($field->label_element)) {
$label_element = Html::escape($field->label_element);
$output .= '<' . $label_element . $field->label_attributes . '>';
}
$output .= Html::escape($field->label);
if ($field->has_label_colon) {
$output .= ': ';
}
if (isset($label_element)) {
$output .= '</' . $label_element . '>';
}
}
$element_type = Html::escape($field->element_type);
if ($element_type) {
$output .= '<' . $element_type . $field->element_attributes . '>';
}
$output .= $field->content;
if ($element_type) {
$output .= '</' . $element_type . '>';
}
if ($wrapper_element) {
$output .= '</' . $wrapper_element . '>';
}
}
return $output;
}
/**
* Prepares variables for views single grouping templates.
*
@ -249,19 +208,6 @@ function template_preprocess_views_view_grouping(&$variables) {
$variables['content'] = $variables['view']->style_plugin->renderGroupingSets($variables['rows'], $variables['grouping_level']);
}
/**
* Display a single views field.
*
* Interesting bits of info:
* $field->field_alias says what the raw value in $row will be. Reach it like
* this: @code { $row->{$field->field_alias} @endcode
*
* @ingroup themeable
*/
function theme_views_view_field($variables) {
return $variables['output'];
}
/**
* Prepares variables for views field templates.
*