class ViewsDataHelper (View source)

Defines a helper class for stuff related to views data.

Properties

protected ViewsData $data

The views data object, containing the cached information.

protected array $fields

A prepared list of all fields, keyed by base_table and handler type.

Methods

__construct(ViewsData $views_data)

Constructs a ViewsData object.

array
fetchFields(array|string $base, string $type, bool $grouping = FALSE, string $sub_type = NULL)

Fetches a list of all fields available for a given base type.

static int
fetchedFieldSort(array $a, array $b)

Sort function for fetched fields.

Details

__construct(ViewsData $views_data)

Constructs a ViewsData object.

Parameters

ViewsData $views_data

The views data object, containing the cached table information.

array fetchFields(array|string $base, string $type, bool $grouping = FALSE, string $sub_type = NULL)

Fetches a list of all fields available for a given base type.

Parameters

array|string $base

A list or a single base_table, for example node.

string $type

The handler type, for example field or filter.

bool $grouping

Should the result grouping by its 'group' label.

string $sub_type

An optional sub type. E.g. Allows making an area plugin available for header only, instead of header, footer, and empty regions.

Return Value

array

A keyed array of in the form of 'base_table' => 'Description'.

static protected int fetchedFieldSort(array $a, array $b)

Sort function for fetched fields.

Parameters

array $a

First item for comparison. The compared items should be associative arrays that include a 'group' and a 'title' key.

array $b

Second item for comparison.

Return Value

int

Returns -1 if $a comes before $b, 1 other way round and 0 if it cannot be decided.