You are here

public function Pattern::isFieldVisible in UI Patterns 8

Helper function: check for all conditions that make a field visible.

Parameters

\Drupal\views\Plugin\views\field\FieldPluginBase $field: Field object.

\Drupal\Component\Render\MarkupInterface|null $field_output: Field output.

Return value

bool TRUE if a field should be visible, FALSE otherwise.

See also

template_preprocess_pattern_views_row()

File

modules/ui_patterns_views/src/Plugin/views/row/Pattern.php, line 145

Class

Pattern
Pattern Views row plugin.

Namespace

Drupal\ui_patterns_views\Plugin\views\row

Code

public function isFieldVisible(FieldPluginBase $field, $field_output) {
  $empty_value = $field
    ->isValueEmpty($field_output, $field->options['empty_zero']);
  $hide_field = !$empty_value || empty($field->options['hide_empty']) && empty($this->options['hide_empty']);
  $empty = empty($field->options['exclude']) && $hide_field;
  return $empty && $this
    ->hasMappingDestination('views_row', $field->field, $this->options);
}