class Comment extends WizardPluginBase (View source)

Tests creating comment views with the wizard.

Traits

Wrapper methods for \Drupal\Core\StringTranslation\TranslationInterface.

Provides dependency injection friendly methods for serialization.

Provides a trait for the messenger service.

Constants

DERIVATIVE_SEPARATOR

A string which is used to separate base plugin IDs from the derivative ID.

INCLUDE_NEGOTIATED

Include negotiated languages when listing languages.

INCLUDE_ENTITY

Include entity row languages when listing languages.

VIEWS_QUERY_LANGUAGE_SITE_DEFAULT

Query string to indicate the site default language.

Properties

protected string $pluginId

The plugin_id.

from  PluginBase
protected array $pluginDefinition

The plugin implementation definition.

from  PluginBase
protected array $configuration

Configuration information passed into the plugin.

from  PluginBase
protected TranslationInterface $stringTranslation

The string translation service.

from  StringTranslationTrait
protected array $_serviceIds

An array of service IDs keyed by property name used for serialization.

from  DependencySerializationTrait
protected array $_entityStorages

An array of entity type IDs keyed by the property name of their storages.

from  DependencySerializationTrait
protected MessengerInterface $messenger

The messenger.

from  MessengerTrait
array $options

Options for this plugin will be held here.

from  PluginBase
ViewExecutable $view

The top object of a view.

from  PluginBase
DisplayPluginBase $displayHandler

The display object this plugin is for.

from  PluginBase
array $definition

Plugins's definition.

from  PluginBase
protected bool $usesOptions

Denotes whether the plugin has an additional options form.

from  PluginBase
protected RendererInterface $renderer

Stores the render API renderer.

from  PluginBase
protected string $base_table

The base table connected with the wizard.

from  WizardPluginBase
protected string $entityTypeId

The entity type connected with the wizard.

from  WizardPluginBase
protected EntityTypeInterface $entityType

Contains the information from entity_get_info of the $entity_type.

from  WizardPluginBase
protected array $validated_views

An array of validated view objects, keyed by a hash.

from  WizardPluginBase
protected string $createdColumn

Set the created column.

protected $filters

Set default values for the filters.

protected array $sorts

Views items configuration arrays for sorts added by the wizard.

from  WizardPluginBase
protected array $availableSorts

The available store criteria.

from  WizardPluginBase
protected array $filter_defaults

Default values for filters.

from  WizardPluginBase
protected EntityTypeBundleInfoInterface $bundleInfoService

The bundle info service.

from  WizardPluginBase
protected MenuParentFormSelectorInterface $parentFormSelector

The parent form selector service.

from  WizardPluginBase

Methods

__construct(array $configuration, string $plugin_id, mixed $plugin_definition, EntityTypeBundleInfoInterface $bundle_info_service, MenuParentFormSelectorInterface $parent_form_selector = NULL)

Constructs a WizardPluginBase object.

string
getPluginId()

Gets the plugin_id of the plugin instance.

string
getBaseId()

Gets the base_plugin_id of the plugin instance.

string|null
getDerivativeId()

Gets the derivative_id of the plugin instance.

array
getPluginDefinition()

Gets the definition of the plugin implementation.

bool
isConfigurable()

Determines if the plugin is configurable.

t(string $string, array $args = [], array $options = [])

Translates a string to the current language or to a given language.

formatPlural($count, $singular, $plural, array $args = [], array $options = [])

Formats a string containing a count of items.

getNumberOfPlurals($langcode = NULL)

Returns the number of plurals supported by a given language.

getStringTranslation()

Gets the string translation service.

$this
setStringTranslation(TranslationInterface $translation)

Sets the string translation service to use.

__sleep()

{@inheritdoc}

__wakeup()

{@inheritdoc}

setMessenger(MessengerInterface $messenger)

Sets the messenger.

messenger()

Gets the messenger.

create(ContainerInterface $container, array $configuration, string $plugin_id, mixed $plugin_definition)

Creates an instance of the plugin.

init(ViewExecutable $view, DisplayPluginBase $display, array $options = NULL)

Initialize the plugin.

array
defineOptions()

Information about options for all kinds of purposes will be held here.

setOptionDefaults(array $storage, array $options)

Fills up the options of the plugin with defaults.

filterByDefinedOptions(array $storage)

Filter out stored options depending on the defined options.

doFilterByDefinedOptions(array $storage, array $options)

Do the work to filter out stored options depending on the defined options.

unpackOptions($storage, $options, $definition = NULL, $all = TRUE, $check = TRUE)

Unpack options over our existing defaults, drilling down into arrays so that defaults don't get totally blown away.

destroy()

Clears a plugin.

buildOptionsForm($form, FormStateInterface $form_state)

Provide a form to edit options for this plugin.

static string[]
trustedCallbacks()

Lists the trusted callbacks provided by the implementing class.

validateOptionsForm($form, FormStateInterface $form_state)

Validate the options form.

submitOptionsForm($form, FormStateInterface $form_state)

Handle any special handling on the validate form.

query()

Add anything to the query that we might need to.

themeFunctions()

Provide a full list of possible theme templates used by this style.

An
validate()

Validate that the plugin is correct and can be saved.

summaryTitle()

Returns the summary of the settings in the display.

pluginTitle()

Return the human readable name of the display.

usesOptions()

Returns the usesOptions property.

string
globalTokenReplace(string $string = '', array $options = [])

Returns a string with any core tokens replaced.

string
viewsTokenReplace($text, $tokens)

Replaces Views' tokens in a given string. The resulting string will be sanitized with Xss::filterAdmin.

array
getAvailableGlobalTokens(bool $prepared = FALSE, array $types = [])

Returns an array of available token replacements.

globalTokenForm(array $form, FormStateInterface $form_state)

Adds elements for available core tokens to a form.

static array
preRenderAddFieldsetMarkup(array $form)

Moves form elements into fieldsets for presentation purposes.

static array
preRenderFlattenData(array $form)

Flattens the structure of form elements.

array
calculateDependencies()

Calculates dependencies for the configured plugin.

string
getProvider()

Returns the plugin provider.

array
listLanguages(int $flags = LanguageInterface::STATE_ALL, array $current_values = NULL)

Makes an array of languages, optionally including special languages.

static array
queryLanguageSubstitutions()

Returns substitutions for Views queries for languages.

getRenderer()

Returns the render API renderer.

string
getCreatedColumn()

Gets the createdColumn property.

array
getFilters()

Gets the filters property.

array
getAvailableSorts()

Gets the availableSorts property.

array
getSorts()

Gets the sorts property.

array
buildForm(array $form, FormStateInterface $form_state)

Form callback to build other elements in the "show" form.

static The
getSelected(FormStateInterface $form_state, $parents, $default_value, $element)

Gets the current value of a #select element, from within a form constructor function.

buildFormStyle(array $form, FormStateInterface $form_state, string $type)

Adds the style options to the wizard form.

array
rowStyleOptions()

Retrieves row style plugin names.

buildFilters($form, FormStateInterface $form_state)

Builds the form structure for selecting the view's filters.

buildSorts($form, FormStateInterface $form_state)

Builds the form structure for selecting the view's sort order.

instantiateView($form, FormStateInterface $form_state)

Instantiates a view object from form values.

array
buildDisplayOptions($form, FormStateInterface $form_state)

Builds an array of display options for the view.

alterDisplayOptions($display_options, $form, FormStateInterface $form_state)

Alters the full array of display options before they are added to the view.

addDisplays(View $view, $display_options, $form, FormStateInterface $form_state)

Adds the array of display options to the view, with appropriate overrides.

array
defaultDisplayOptions()

Assembles the default display options for the view.

array
defaultDisplayFilters(array $form, FormStateInterface $form_state)

Retrieves all filter information used by the default display.

array
defaultDisplayFiltersUser(array $form, FormStateInterface $form_state)

Retrieves filter information based on user input for the default display.

array
defaultDisplaySorts(array $form, FormStateInterface $form_state)

Retrieves all sort information used by the default display.

array
defaultDisplaySortsUser(array $form, FormStateInterface $form_state)

Retrieves sort information based on user input for the default display.

array
pageDisplayOptions(array $form, FormStateInterface $form_state)

Retrieves the page display options.

array
blockDisplayOptions(array $form, FormStateInterface $form_state)

Retrieves the block display options.

array
restExportDisplayOptions(array $form, FormStateInterface $form_state)

Retrieves the REST export display options from the submitted form values.

array
pageFeedDisplayOptions(array $form, FormStateInterface $form_state)

Retrieves the feed display options.

setDefaultOptions(array $options, DisplayPluginBase $display, DisplayPluginBase $default_display)

Sets options for a display and makes them the default options if possible.

setOverrideOptions(array $options, DisplayPluginBase $display, DisplayPluginBase $default_display)

Sets options for a display, inheriting from the defaults when possible.

retrieveValidatedView(array $form, FormStateInterface $form_state, bool $unset = TRUE)

Retrieves a validated view for a form submission.

setValidatedView(array $form, FormStateInterface $form_state, ViewUI $view)

Stores a validated view from a form submission.

array
validateView(array $form, FormStateInterface $form_state)

Implements Drupal\views\Plugin\views\wizard\WizardInterface::validate().

createView(array $form, FormStateInterface $form_state)

Creates a view from values that have already been validated.

Details

__construct(array $configuration, string $plugin_id, mixed $plugin_definition, EntityTypeBundleInfoInterface $bundle_info_service, MenuParentFormSelectorInterface $parent_form_selector = NULL)

Constructs a WizardPluginBase object.

Parameters

array $configuration

A configuration array containing information about the plugin instance.

string $plugin_id

The plugin_id for the plugin instance.

mixed $plugin_definition

The plugin implementation definition.

EntityTypeBundleInfoInterface $bundle_info_service
MenuParentFormSelectorInterface $parent_form_selector

string getPluginId()

Gets the plugin_id of the plugin instance.

Return Value

string

The plugin_id of the plugin instance.

string getBaseId()

Gets the base_plugin_id of the plugin instance.

Return Value

string

The base_plugin_id of the plugin instance.

string|null getDerivativeId()

Gets the derivative_id of the plugin instance.

Return Value

string|null

The derivative_id of the plugin instance NULL otherwise.

array getPluginDefinition()

Gets the definition of the plugin implementation.

Return Value

array

The plugin definition, as returned by the discovery object used by the plugin manager.

bool isConfigurable()

Determines if the plugin is configurable.

Return Value

bool

A boolean indicating whether the plugin is configurable.

protected TranslatableMarkup t(string $string, array $args = [], array $options = [])

Translates a string to the current language or to a given language.

See \Drupal\Core\StringTranslation\TranslatableMarkup::__construct() for important security information and usage guidelines.

In order for strings to be localized, make them available in one of the ways supported by the

Parameters

string $string

A string containing the English text to translate.

array $args

(optional) An associative array of replacements to make after translation. Based on the first character of the key, the value is escaped and/or themed. See \Drupal\Component\Render\FormattableMarkup::placeholderFormat() for details.

array $options

(optional) An associative array of additional options, with the following elements:

  • 'langcode' (defaults to the current language): A language code, to translate to a language other than what is used to display the page.
  • 'context' (defaults to the empty context): The context the source string belongs to. See the @link i18n Internationalization topic @endlink for more information about string contexts.

Return Value

TranslatableMarkup

An object that, when cast to a string, returns the translated string.

See also

FormattableMarkup::placeholderFormat
TranslatableMarkup::__construct

protected formatPlural($count, $singular, $plural, array $args = [], array $options = [])

Formats a string containing a count of items.

Parameters

$count
$singular
$plural
array $args
array $options

See also

TranslationInterface::formatPlural

protected getNumberOfPlurals($langcode = NULL)

Returns the number of plurals supported by a given language.

Parameters

$langcode

See also

PluralFormulaInterface::getNumberOfPlurals

protected TranslationInterface getStringTranslation()

Gets the string translation service.

Return Value

TranslationInterface

The string translation service.

$this setStringTranslation(TranslationInterface $translation)

Sets the string translation service to use.

Parameters

TranslationInterface $translation

The string translation service.

Return Value

$this

__sleep()

{@inheritdoc}

__wakeup()

{@inheritdoc}

setMessenger(MessengerInterface $messenger)

Sets the messenger.

Parameters

MessengerInterface $messenger

The messenger.

MessengerInterface messenger()

Gets the messenger.

Return Value

MessengerInterface

The messenger.

static ContainerFactoryPluginInterface create(ContainerInterface $container, array $configuration, string $plugin_id, mixed $plugin_definition)

Creates an instance of the plugin.

Parameters

ContainerInterface $container

The container to pull out services used in the plugin.

array $configuration

A configuration array containing information about the plugin instance.

string $plugin_id

The plugin ID for the plugin instance.

mixed $plugin_definition

The plugin implementation definition.

Return Value

ContainerFactoryPluginInterface

Returns an instance of this plugin.

init(ViewExecutable $view, DisplayPluginBase $display, array $options = NULL)

Initialize the plugin.

Parameters

ViewExecutable $view

The view object.

DisplayPluginBase $display

The display handler.

array $options

The options configured for this plugin.

protected array defineOptions()

Information about options for all kinds of purposes will be held here.

Return Value

array

Returns the options of this handler/plugin.

protected setOptionDefaults(array $storage, array $options)

Fills up the options of the plugin with defaults.

Parameters

array $storage

An array which stores the actual option values of the plugin.

array $options

An array which describes the options of a plugin. Each element is an associative array containing:

  • default: The default value of one option. Should be translated to the interface text language selected for page if translatable.
  • (optional) contains: An array which describes the available options under the key. If contains is set, the default will be ignored and assumed to be an empty array.
  • (optional) 'bool': TRUE if the value is boolean, else FALSE.

filterByDefinedOptions(array $storage)

Filter out stored options depending on the defined options.

Parameters

array $storage

The stored options.

protected doFilterByDefinedOptions(array $storage, array $options)

Do the work to filter out stored options depending on the defined options.

Parameters

array $storage

The stored options.

array $options

The defined options.

unpackOptions($storage, $options, $definition = NULL, $all = TRUE, $check = TRUE)

Unpack options over our existing defaults, drilling down into arrays so that defaults don't get totally blown away.

Parameters

$storage
$options
$definition
$all
$check

destroy()

Clears a plugin.

buildOptionsForm($form, FormStateInterface $form_state)

Provide a form to edit options for this plugin.

Parameters

$form
FormStateInterface $form_state

static string[] trustedCallbacks()

Lists the trusted callbacks provided by the implementing class.

Trusted callbacks are public methods on the implementing class and can be invoked via \Drupal\Core\Security\DoTrustedCallbackTrait::doTrustedCallback().

Return Value

string[]

List of method names implemented by the class that can be used as trusted callbacks.

validateOptionsForm($form, FormStateInterface $form_state)

Validate the options form.

Parameters

$form
FormStateInterface $form_state

submitOptionsForm($form, FormStateInterface $form_state)

Handle any special handling on the validate form.

Parameters

$form
FormStateInterface $form_state

query()

Add anything to the query that we might need to.

themeFunctions()

Provide a full list of possible theme templates used by this style.

An validate()

Validate that the plugin is correct and can be saved.

Return Value

An

array of error strings to tell the user what is wrong with this plugin.

summaryTitle()

Returns the summary of the settings in the display.

pluginTitle()

Return the human readable name of the display.

This appears on the ui beside each plugin and beside the settings link.

usesOptions()

Returns the usesOptions property.

string globalTokenReplace(string $string = '', array $options = [])

Returns a string with any core tokens replaced.

Parameters

string $string

The string to preform the token replacement on.

array $options

An array of options, as passed to \Drupal\Core\Utility\Token::replace().

Return Value

string

The tokenized string.

protected string viewsTokenReplace($text, $tokens)

Replaces Views' tokens in a given string. The resulting string will be sanitized with Xss::filterAdmin.

Parameters

$text

Unsanitized string with possible tokens.

$tokens

Array of token => replacement_value items.

Return Value

string

array getAvailableGlobalTokens(bool $prepared = FALSE, array $types = [])

Returns an array of available token replacements.

Parameters

bool $prepared

Whether to return the raw token info for each token or an array of prepared tokens for each type. E.g. "[view:name]".

array $types

An array of additional token types to return, defaults to 'site' and 'view'.

Return Value

array

An array of available token replacement info or tokens, grouped by type.

globalTokenForm(array $form, FormStateInterface $form_state)

Adds elements for available core tokens to a form.

Parameters

array $form

The form array to alter, passed by reference.

FormStateInterface $form_state

The current state of the form.

static array preRenderAddFieldsetMarkup(array $form)

Moves form elements into fieldsets for presentation purposes.

Many views forms use #tree = TRUE to keep their values in a hierarchy for easier storage. Moving the form elements into fieldsets during form building would break up that hierarchy. Therefore, we wait until the pre_render stage, where any changes we make affect presentation only and aren't reflected in $form_state->getValues().

Parameters

array $form

The form build array to alter.

Return Value

array

The form build array.

static array preRenderFlattenData(array $form)

Flattens the structure of form elements.

If a form element has #flatten = TRUE, then all of its children get moved to the same level as the element itself. So $form['to_be_flattened'][$key] becomes $form[$key], and $form['to_be_flattened'] gets unset.

Parameters

array $form

The form build array to alter.

Return Value

array

The form build array.

array calculateDependencies()

Calculates dependencies for the configured plugin.

Dependencies are saved in the plugin's configuration entity and are used to determine configuration synchronization order. For example, if the plugin integrates with specific user roles, this method should return an array of dependencies listing the specified roles.

Return Value

array

An array of dependencies grouped by type (config, content, module, theme). For example: @code array( 'config' => array('user.role.anonymous', 'user.role.authenticated'), 'content' => array('node:article:f0a189e6-55fb-47fb-8005-5bef81c44d6d'), 'module' => array('node', 'user'), 'theme' => array('seven'), ); @endcode

string getProvider()

Returns the plugin provider.

Return Value

string

protected array listLanguages(int $flags = LanguageInterface::STATE_ALL, array $current_values = NULL)

Makes an array of languages, optionally including special languages.

Parameters

int $flags

(optional) Flags for which languages to return (additive). Options:

  • \Drupal\Core\Language::STATE_ALL (default): All languages (configurable and default).
  • \Drupal\Core\Language::STATE_CONFIGURABLE: Configurable languages.
  • \Drupal\Core\Language::STATE_LOCKED: Locked languages.
  • \Drupal\Core\Language::STATE_SITE_DEFAULT: Add site default language; note that this is not included in STATE_ALL.
  • \Drupal\views\Plugin\views\PluginBase::INCLUDE_NEGOTIATED: Add negotiated language types.
  • \Drupal\views\Plugin\views\PluginBase::INCLUDE_ENTITY: Add entity row language types. Note that these are only supported for display options, not substituted in queries.
array $current_values

The currently-selected options in the list, if available.

Return Value

array

An array of language names, keyed by the language code. Negotiated and special languages have special codes that are substituted in queries by PluginBase::queryLanguageSubstitutions(). Only configurable languages and languages that are in $current_values are included in the list.

static array queryLanguageSubstitutions()

Returns substitutions for Views queries for languages.

This is needed so that the language options returned by PluginBase::listLanguages() are able to be used in queries. It is called by the Views module implementation of hook_views_query_substitutions() to get the language-related substitutions.

Return Value

array

An array in the format of hook_views_query_substitutions() that gives the query substitutions needed for the special language types.

protected RendererInterface getRenderer()

Returns the render API renderer.

Return Value

RendererInterface

string getCreatedColumn()

Gets the createdColumn property.

Return Value

string

The name of the column containing the created date.

array getFilters()

Gets the filters property.

Return Value

array

array getAvailableSorts()

Gets the availableSorts property.

Return Value

array

array getSorts()

Gets the sorts property.

Return Value

array

array buildForm(array $form, FormStateInterface $form_state)

Form callback to build other elements in the "show" form.

This method builds all form elements beside of the selection of the base table.

Parameters

array $form

The full wizard form array.

FormStateInterface $form_state

The current state of the wizard form.

Return Value

array

Returns the changed wizard form.

static The getSelected(FormStateInterface $form_state, $parents, $default_value, $element)

Gets the current value of a #select element, from within a form constructor function.

This function is intended for use in highly dynamic forms (in particular the add view wizard) which are rebuilt in different ways depending on which triggering element (AJAX or otherwise) was most recently fired. For example, sometimes it is necessary to decide how to build one dynamic form element based on the value of a different dynamic form element that may not have even been present on the form the last time it was submitted. This function takes care of resolving those conflicts and gives you the proper current value of the requested #select element.

By necessity, this function sometimes uses non-validated user input from FormState::$input in making its determination. Although it performs some minor validation of its own, it is not complete. The intention is that the return value of this function should only be used to help decide how to build the current form the next time it is reloaded, not to be saved as if it had gone through the normal, final form validation process. Do NOT use the results of this function for any other purpose besides deciding how to build the next version of the form.

Parameters

FormStateInterface $form_state

The current state of the form.

$parents

An array of parent keys that point to the part of the submitted form values that are expected to contain the element's value (in the case where this form element was actually submitted). In a simple case (assuming

tree is TRUE throughout the form), if the select element is located in

$form['wrapper']['select'], so that the submitted form values would normally be found in $form_state->getValue(array('wrapper', 'select')), you would pass array('wrapper', 'select') for this parameter.

$default_value

The default value to return if the #select element does not currently have a proper value set based on the submitted input.

$element

An array representing the current version of the #select element within the form.

Return Value

The

current value of the #select element. A common use for this is to feed it back into $element['#default_value'] so that the form will be rendered with the correct value selected.

protected buildFormStyle(array $form, FormStateInterface $form_state, string $type)

Adds the style options to the wizard form.

Parameters

array $form

The full wizard form array.

FormStateInterface $form_state

The current state of the wizard form.

string $type

The display ID (e.g. 'page' or 'block').

protected array rowStyleOptions()

Retrieves row style plugin names.

Return Value

array

Returns the plugin names available for the base table of the wizard.

protected buildFilters($form, FormStateInterface $form_state)

Builds the form structure for selecting the view's filters.

By default, this adds "of type" and "tagged with" filters (when they are available).

Parameters

$form
FormStateInterface $form_state

protected buildSorts($form, FormStateInterface $form_state)

Builds the form structure for selecting the view's sort order.

By default, this adds a "sorted by [date]" filter (when it is available).

Parameters

$form
FormStateInterface $form_state

protected ViewUI instantiateView($form, FormStateInterface $form_state)

Instantiates a view object from form values.

Parameters

$form
FormStateInterface $form_state

Return Value

ViewUI

The instantiated view UI object.

protected array buildDisplayOptions($form, FormStateInterface $form_state)

Builds an array of display options for the view.

Parameters

$form
FormStateInterface $form_state

Return Value

array

An array whose keys are the names of each display and whose values are arrays of options for that display.

protected alterDisplayOptions($display_options, $form, FormStateInterface $form_state)

Alters the full array of display options before they are added to the view.

Parameters

$display_options
$form
FormStateInterface $form_state

protected addDisplays(View $view, $display_options, $form, FormStateInterface $form_state)

Adds the array of display options to the view, with appropriate overrides.

Parameters

View $view
$display_options
$form
FormStateInterface $form_state

protected array defaultDisplayOptions()

Assembles the default display options for the view.

Most wizards will need to override this method to provide some fields or a different row plugin.

Return Value

array

Returns an array of display options.

protected array defaultDisplayFilters(array $form, FormStateInterface $form_state)

Retrieves all filter information used by the default display.

Additional to the one provided by the plugin this method takes care about adding additional filters based on user input.

Parameters

array $form

The full wizard form array.

FormStateInterface $form_state

The current state of the wizard form.

Return Value

array

An array of filter arrays keyed by ID. A sort array contains the options accepted by a filter handler.

protected array defaultDisplayFiltersUser(array $form, FormStateInterface $form_state)

Retrieves filter information based on user input for the default display.

Parameters

array $form

The full wizard form array.

FormStateInterface $form_state

The current state of the wizard form.

Return Value

array

An array of filter arrays keyed by ID. A sort array contains the options accepted by a filter handler.

protected array defaultDisplaySorts(array $form, FormStateInterface $form_state)

Retrieves all sort information used by the default display.

Additional to the one provided by the plugin this method takes care about adding additional sorts based on user input.

Parameters

array $form

The full wizard form array.

FormStateInterface $form_state

The current state of the wizard form.

Return Value

array

An array of sort arrays keyed by ID. A sort array contains the options accepted by a sort handler.

protected array defaultDisplaySortsUser(array $form, FormStateInterface $form_state)

Retrieves sort information based on user input for the default display.

Parameters

array $form

The full wizard form array.

FormStateInterface $form_state

The current state of the wizard form.

Return Value

array

An array of sort arrays keyed by ID. A sort array contains the options accepted by a sort handler.

protected array pageDisplayOptions(array $form, FormStateInterface $form_state)

Retrieves the page display options.

Parameters

array $form

The full wizard form array.

FormStateInterface $form_state

The current state of the wizard form.

Return Value

array

Returns an array of display options.

protected array blockDisplayOptions(array $form, FormStateInterface $form_state)

Retrieves the block display options.

Parameters

array $form

The full wizard form array.

FormStateInterface $form_state

The current state of the wizard form.

Return Value

array

Returns an array of display options.

protected array restExportDisplayOptions(array $form, FormStateInterface $form_state)

Retrieves the REST export display options from the submitted form values.

Parameters

array $form

The full wizard form array.

FormStateInterface $form_state

The current state of the wizard form.

Return Value

array

Returns an array of display options.

protected array pageFeedDisplayOptions(array $form, FormStateInterface $form_state)

Retrieves the feed display options.

Parameters

array $form

The full wizard form array.

FormStateInterface $form_state

The current state of the wizard form.

Return Value

array

Returns an array of display options.

protected setDefaultOptions(array $options, DisplayPluginBase $display, DisplayPluginBase $default_display)

Sets options for a display and makes them the default options if possible.

This function can be used to set options for a display when it is desired that the options also become the defaults for the view whenever possible. This should be done for the "primary" display created in the view wizard, so that new displays which the user adds later will be similar to this one.

Parameters

array $options

An array whose keys are the name of each option and whose values are the desired values to set.

DisplayPluginBase $display

The display handler which the options will be applied to. The default display will actually be assigned the options (and this display will inherit them) when possible.

DisplayPluginBase $default_display

The default display handler, which will store the options when possible.

protected setOverrideOptions(array $options, DisplayPluginBase $display, DisplayPluginBase $default_display)

Sets options for a display, inheriting from the defaults when possible.

This function can be used to set options for a display when it is desired that the options inherit from the default display whenever possible. This avoids setting too many options as overrides, which will be harder for the user to modify later. For example, if $this->setDefaultOptions() was previously called on a page display and then this function is called on a block display, and if the user entered the same title for both displays in the views wizard, then the view will wind up with the title stored as the default (with the page and block both inheriting from it).

Parameters

array $options

An array whose keys are the name of each option and whose values are the desired values to set.

DisplayPluginBase $display

The display handler which the options will be applied to. The default display will actually be assigned the options (and this display will inherit them) when possible.

DisplayPluginBase $default_display

The default display handler, which will store the options when possible.

protected ViewUI retrieveValidatedView(array $form, FormStateInterface $form_state, bool $unset = TRUE)

Retrieves a validated view for a form submission.

Parameters

array $form

The full wizard form array.

FormStateInterface $form_state

The current state of the wizard form.

bool $unset

Should the view be removed from the list of validated views.

Return Value

ViewUI

The validated view object.

protected setValidatedView(array $form, FormStateInterface $form_state, ViewUI $view)

Stores a validated view from a form submission.

Parameters

array $form

The full wizard form array.

FormStateInterface $form_state

The current state of the wizard form.

ViewUI $view

The validated view object.

array validateView(array $form, FormStateInterface $form_state)

Implements Drupal\views\Plugin\views\wizard\WizardInterface::validate().

Instantiates the view from the form submission and validates its values.

Parameters

array $form

The full wizard form array.

FormStateInterface $form_state

The current state of the wizard form.

Return Value

array

An empty array if the view is valid; an array of error strings if it is not.

ViewEntityInterface createView(array $form, FormStateInterface $form_state)

Creates a view from values that have already been validated.

Parameters

array $form

The full wizard form array.

FormStateInterface $form_state

The current state of the wizard form.

Return Value

ViewEntityInterface

The created view object.

Exceptions

WizardException