Всем привет! Есть проблема, бьюсь уже третий день. Есть у меня слайдер, картинки + текст поверху, текст сам по себе светлый и бывает так, что сливается с картинкой. Заказчик возжелал, чтобы при создании материала был чекбокс для "включения" темного цвета текста. Чекбокс создан, все значения указаны, только не могу теперь понять, как же отследить включен он или нет в шаблоне вьюхи. Ведь в нем выводиться уже сгенерированный код всего слайдера. Подсказали умные люди, что нужно в самой вьюхе переопределить шаблон для вывода строк, - переопределил, но что с ним делать дальше - ума не приложу. Ниже код шаблона для вывода строк вьюхи, а поле имеет имя field_color_text
<?php
/**
* file
* Default simple view template to all the fields as a row.
*
* - $view: The view in use.
* - $fields: an array of $field objects. Each one contains:
* - $field->content: The output of the field.
* - $field->raw: The raw data for the field, if it exists. This is NOT output safe.
* - $field->class: The safe class id to use.
* - $field->handler: The Views field handler object controlling this field. Do not use
* var_export to dump this object, as it can't handle the recursion.
* - $field->inline: Whether or not the field should be inline.
* - $field->inline_html: either div or span based on the above flag.
* - $field->wrapper_prefix: A complete wrapper containing the inline_html to use.
* - $field->wrapper_suffix: The closing tag for the wrapper.
* - $field->separator: an optional separator that may appear before a field.
* - $field->label: The wrap label text to use.
* - $field->label_html: The full HTML of the label to use including
* configured element type.
* - $row: The raw result object from the query, with all data it fetched.
*
* ingroup views_templates
*/
?>
<?php foreach ($fields as $id => $field): ?>
<?php if (!empty($field->separator)): ?>
<?php print $field->separator; ?>
<?php endif; ?>
<?php print $field->wrapper_prefix; ?>
<?php print $field->label_html; ?>
<?php print $field->content; ?>
<?php print $field->wrapper_suffix; ?>
<?php endforeach; ?>
Комментарии
<?php print $fields['field_color_text']->content;?>
нет. дает ошибки. одна из которых Cannot use object of type stdClass as array in
ссори, вы указали шаблон поля,
я обычно шаблон строки форматирую как мне нужно
http://c2n.me/3JcIjyq.jpg
http://c2n.me/3JcIo3K.jpg
вооот! именно то что мне нужно! спасибо!