Drupal 8  8.0.2
WizardPluginBase Class Reference
Inheritance diagram for WizardPluginBase:

Public Member Functions

 __construct (array $configuration, $plugin_id, $plugin_definition)
 
 getCreatedColumn ()
 
 getFilters ()
 
 getAvailableSorts ()
 
 getSorts ()
 
 buildForm (array $form, FormStateInterface $form_state)
 
 validateView (array $form, FormStateInterface $form_state)
 
 createView (array $form, FormStateInterface $form_state)
 
- Public Member Functions inherited from PluginBase
 __construct (array $configuration, $plugin_id, $plugin_definition)
 
 init (ViewExecutable $view, DisplayPluginBase $display, array &$options=NULL)
 
 filterByDefinedOptions (array &$storage)
 
 unpackOptions (&$storage, $options, $definition=NULL, $all=TRUE, $check=TRUE)
 
 destroy ()
 
 buildOptionsForm (&$form, FormStateInterface $form_state)
 
 validateOptionsForm (&$form, FormStateInterface $form_state)
 
 submitOptionsForm (&$form, FormStateInterface $form_state)
 
 query ()
 
 themeFunctions ()
 
 validate ()
 
 summaryTitle ()
 
 pluginTitle ()
 
 usesOptions ()
 
 globalTokenReplace ($string= '', array $options=array())
 
 getAvailableGlobalTokens ($prepared=FALSE, array $types=array())
 
 globalTokenForm (&$form, FormStateInterface $form_state)
 
 calculateDependencies ()
 
 getProvider ()
 
- Public Member Functions inherited from PluginInspectionInterface
 getPluginId ()
 
 getPluginDefinition ()
 
- Public Member Functions inherited from DerivativeInspectionInterface
 getBaseId ()
 
 getDerivativeId ()
 

Static Public Member Functions

static getSelected (FormStateInterface $form_state, $parents, $default_value, $element)
 
- Static Public Member Functions inherited from PluginBase
static create (ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition)
 
static preRenderAddFieldsetMarkup (array $form)
 
static preRenderFlattenData ($form)
 
static queryLanguageSubstitutions ()
 

Protected Member Functions

 buildFormStyle (array &$form, FormStateInterface $form_state, $type)
 
 rowStyleOptions ()
 
 buildFilters (&$form, FormStateInterface $form_state)
 
 buildSorts (&$form, FormStateInterface $form_state)
 
 instantiateView ($form, FormStateInterface $form_state)
 
 buildDisplayOptions ($form, FormStateInterface $form_state)
 
 alterDisplayOptions (&$display_options, $form, FormStateInterface $form_state)
 
 addDisplays (View $view, $display_options, $form, FormStateInterface $form_state)
 
 defaultDisplayOptions ()
 
 defaultDisplayFilters ($form, FormStateInterface $form_state)
 
 defaultDisplayFiltersUser (array $form, FormStateInterface $form_state)
 
 defaultDisplaySorts ($form, FormStateInterface $form_state)
 
 defaultDisplaySortsUser ($form, FormStateInterface $form_state)
 
 pageDisplayOptions (array $form, FormStateInterface $form_state)
 
 blockDisplayOptions (array $form, FormStateInterface $form_state)
 
 restExportDisplayOptions (array $form, FormStateInterface $form_state)
 
 pageFeedDisplayOptions ($form, FormStateInterface $form_state)
 
 setDefaultOptions ($options, DisplayPluginBase $display, DisplayPluginBase $default_display)
 
 setOverrideOptions (array $options, DisplayPluginBase $display, DisplayPluginBase $default_display)
 
 retrieveValidatedView (array $form, FormStateInterface $form_state, $unset=TRUE)
 
 setValidatedView (array $form, FormStateInterface $form_state, ViewUI $view)
 
- Protected Member Functions inherited from PluginBase
 defineOptions ()
 
 setOptionDefaults (array &$storage, array $options)
 
 doFilterByDefinedOptions (array &$storage, array $options)
 
 viewsTokenReplace ($text, $tokens)
 
 listLanguages ($flags=LanguageInterface::STATE_ALL, array $current_values=NULL)
 
 getRenderer ()
 

Protected Attributes

 $base_table
 
 $entityTypeId
 
 $entityType
 
 $validated_views = array()
 
 $createdColumn
 
 $filters = array()
 
 $sorts = array()
 
 $availableSorts = array()
 
 $filter_defaults
 
- Protected Attributes inherited from PluginBase
 $usesOptions = FALSE
 
 $renderer
 

Additional Inherited Members

- Data Fields inherited from PluginBase
const INCLUDE_NEGOTIATED = 16
 
const INCLUDE_ENTITY = 32
 
const VIEWS_QUERY_LANGUAGE_SITE_DEFAULT = '***LANGUAGE_site_default***'
 
 $options = array()
 
 $view = NULL
 
 $displayHandler
 
 $definition
 

Detailed Description

Base class for Views wizard plugins.

This is a very generic Views Wizard class that can be constructed for any base table.

Constructor & Destructor Documentation

__construct ( array  $configuration,
  $plugin_id,
  $plugin_definition 
)

Constructs a WizardPluginBase object.

References Drupal\entityManager().

Here is the call graph for this function:

Member Function Documentation

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

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

References View\getExecutable(), WizardPluginBase\setDefaultOptions(), and WizardPluginBase\setOverrideOptions().

Referenced by WizardPluginBase\instantiateView().

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

References Views\pluginManager().

Referenced by WizardPluginBase\instantiateView().

Here is the call graph for this function:

Here is the caller graph for this function:

blockDisplayOptions ( array  $form,
FormStateInterface  $form_state 
)
protected

Retrieves the block display options.

Parameters
array$formThe full wizard form array.
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the wizard form.
Returns
array Returns an array of display options.

References FormStateInterface\getValue().

Referenced by WizardPluginBase\buildDisplayOptions().

Here is the call graph for this function:

Here is the caller graph for this function:

buildDisplayOptions (   $form,
FormStateInterface  $form_state 
)
protected

Builds an array of display options for the view.

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

References WizardPluginBase\blockDisplayOptions(), WizardPluginBase\defaultDisplayFilters(), WizardPluginBase\defaultDisplayOptions(), WizardPluginBase\defaultDisplaySorts(), FormStateInterface\isValueEmpty(), WizardPluginBase\pageDisplayOptions(), WizardPluginBase\pageFeedDisplayOptions(), and WizardPluginBase\restExportDisplayOptions().

Referenced by WizardPluginBase\instantiateView().

Here is the call graph for this function:

Here is the caller graph for this function:

buildFilters ( $form,
FormStateInterface  $form_state 
)
protected

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

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

References t().

Referenced by WizardPluginBase\buildForm().

Here is the call graph for this function:

Here is the caller graph for this function:

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$formThe full wizard form array.
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the wizard form.
Returns
array Returns the changed wizard form.
}

Implements WizardInterface.

References WizardPluginBase\buildFilters(), WizardPluginBase\buildFormStyle(), WizardPluginBase\buildSorts(), Views\fetchPluginNames(), menu_list_system_menus(), Drupal\moduleHandler(), t(), and Drupal\url().

Here is the call graph for this function:

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

Adds the style options to the wizard form.

Parameters
array$formThe full wizard form array.
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the wizard form.
string$typeThe display ID (e.g. 'page' or 'block').

References Views\pluginManager(), WizardPluginBase\rowStyleOptions(), and t().

Referenced by WizardPluginBase\buildForm().

Here is the call graph for this function:

Here is the caller graph for this function:

buildSorts ( $form,
FormStateInterface  $form_state 
)
protected

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

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

References WizardPluginBase\getAvailableSorts(), WizardPluginBase\getCreatedColumn(), and t().

Referenced by WizardPluginBase\buildForm().

Here is the call graph for this function:

Here is the caller graph for this function:

createView ( array  $form,
FormStateInterface  $form_state 
)

{Creates a view from values that have already been validated.

Parameters
array$formThe full wizard form array.
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the wizard form.
Returns
The created view object.
Exceptions
\Drupal\views\Plugin\views\wizard\WizardException
}

Implements WizardInterface.

References WizardPluginBase\retrieveValidatedView().

Here is the call graph for this function:

defaultDisplayFilters (   $form,
FormStateInterface  $form_state 
)
protected

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$formThe full wizard form array.
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the wizard form.
Returns
array An array of filter arrays keyed by ID. A sort array contains the options accepted by a filter handler.

References WizardPluginBase\defaultDisplayFiltersUser(), and WizardPluginBase\getFilters().

Referenced by WizardPluginBase\buildDisplayOptions().

Here is the call graph for this function:

Here is the caller graph for this function:

defaultDisplayFiltersUser ( array  $form,
FormStateInterface  $form_state 
)
protected

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

Parameters
array$formThe full wizard form array.
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the wizard form.
Returns
array An array of filter arrays keyed by ID. A sort array contains the options accepted by a filter handler.

References FormStateInterface\getValue(), Views\pluginManager(), Views\viewsData(), and Views\viewsDataHelper().

Referenced by WizardPluginBase\defaultDisplayFilters().

Here is the call graph for this function:

Here is the caller graph for this function:

defaultDisplayOptions ( )
protected

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.

Returns
array Returns an array of display options.

References Views\viewsData().

Referenced by WizardPluginBase\buildDisplayOptions().

Here is the call graph for this function:

Here is the caller graph for this function:

defaultDisplaySorts (   $form,
FormStateInterface  $form_state 
)
protected

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$formThe full wizard form array.
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the wizard form.
Returns
array An array of sort arrays keyed by ID. A sort array contains the options accepted by a sort handler.

References WizardPluginBase\defaultDisplaySortsUser(), and WizardPluginBase\getSorts().

Referenced by WizardPluginBase\buildDisplayOptions().

Here is the call graph for this function:

Here is the caller graph for this function:

defaultDisplaySortsUser (   $form,
FormStateInterface  $form_state 
)
protected

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

Parameters
array$formThe full wizard form array.
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the wizard form.
Returns
array An array of sort arrays keyed by ID. A sort array contains the options accepted by a sort handler.

References FormStateInterface\getValue(), and Views\viewsData().

Referenced by WizardPluginBase\defaultDisplaySorts().

Here is the call graph for this function:

Here is the caller graph for this function:

getAvailableSorts ( )

Gets the availableSorts property.

Returns
array

Referenced by WizardPluginBase\buildSorts().

Here is the caller graph for this function:

getCreatedColumn ( )

Gets the createdColumn property.

Returns
string The name of the column containing the created date.

Referenced by WizardPluginBase\buildSorts().

Here is the caller graph for this function:

getFilters ( )

Gets the filters property.

Returns
array

Referenced by WizardPluginBase\defaultDisplayFilters().

Here is the caller graph for this function:

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

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
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the form.
$parentsAn 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_valueThe default value to return if the #select element does not currently have a proper value set based on the submitted input.
$elementAn array representing the current version of the #select element within the form.
Returns
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.

References FormStateInterface\getUserInput(), NestedArray\getValue(), and FormStateInterface\isRebuilding().

Referenced by ViewAddForm\form(), and WizardPluginBaseTest\testGetSelected().

Here is the call graph for this function:

Here is the caller graph for this function:

getSorts ( )

Gets the sorts property.

Returns
array

Referenced by WizardPluginBase\defaultDisplaySorts().

Here is the caller graph for this function:

instantiateView (   $form,
FormStateInterface  $form_state 
)
protected

Instantiates a view object from form values.

Returns
The instantiated view UI object.

References WizardPluginBase\addDisplays(), WizardPluginBase\alterDisplayOptions(), WizardPluginBase\buildDisplayOptions(), FormStateInterface\getValue(), and Drupal\languageManager().

Referenced by WizardPluginBase\validateView().

Here is the call graph for this function:

Here is the caller graph for this function:

pageDisplayOptions ( array  $form,
FormStateInterface  $form_state 
)
protected

Retrieves the page display options.

Parameters
array$formThe full wizard form array.
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the wizard form.
Returns
array Returns an array of display options.

References FormStateInterface\getValue(), and WizardPluginBase\rowStyleOptions().

Referenced by WizardPluginBase\buildDisplayOptions().

Here is the call graph for this function:

Here is the caller graph for this function:

pageFeedDisplayOptions (   $form,
FormStateInterface  $form_state 
)
protected

Retrieves the feed display options.

Parameters
array$formThe full wizard form array.
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the wizard form.
Returns
array Returns an array of display options.

References FormStateInterface\getValue().

Referenced by WizardPluginBase\buildDisplayOptions().

Here is the call graph for this function:

Here is the caller graph for this function:

restExportDisplayOptions ( array  $form,
FormStateInterface  $form_state 
)
protected

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

Parameters
array$formThe full wizard form array.
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the wizard form.
Returns
array Returns an array of display options.

References FormStateInterface\getValue().

Referenced by WizardPluginBase\buildDisplayOptions().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Retrieves a validated view for a form submission.

Parameters
array$formThe full wizard form array.
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the wizard form.
bool$unsetShould the view be removed from the list of validated views.
Returns
$view The validated view object.

References FormStateInterface\getValues().

Referenced by WizardPluginBase\createView().

Here is the call graph for this function:

Here is the caller graph for this function:

rowStyleOptions ( )
protected

Retrieves row style plugin names.

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

References Views\fetchPluginNames().

Referenced by WizardPluginBase\buildFormStyle(), and WizardPluginBase\pageDisplayOptions().

Here is the call graph for this function:

Here is the caller graph for this function:

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

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$optionsAn array whose keys are the name of each option and whose values are the desired values to set.
\Drupal\views\Plugin\views\display\DisplayPluginBase$displayThe 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.
\Drupal\views\Plugin\views\display\DisplayPluginBase$default_displayThe default display handler, which will store the options when possible.

References DisplayPluginBase\getOption(), and DisplayPluginBase\setOption().

Referenced by WizardPluginBase\addDisplays().

Here is the call graph for this function:

Here is the caller graph for this function:

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

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$optionsAn array whose keys are the name of each option and whose values are the desired values to set.
\Drupal\views\Plugin\views\display\DisplayPluginBase$displayThe 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.
\Drupal\views\Plugin\views\display\DisplayPluginBase$default_displayThe default display handler, which will store the options when possible.

References DisplayPluginBase\getOption(), DisplayPluginBase\overrideOption(), and DisplayPluginBase\setOption().

Referenced by WizardPluginBase\addDisplays().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Stores a validated view from a form submission.

Parameters
array$formThe full wizard form array.
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the wizard form.
\Drupal\views_ui\ViewUI$viewThe validated view object.

References FormStateInterface\getValues().

Referenced by WizardPluginBase\validateView().

Here is the call graph for this function:

Here is the caller graph for this function:

validateView ( array  $form,
FormStateInterface  $form_state 
)

Implements Drupal::validate().

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

Implements WizardInterface.

References WizardPluginBase\instantiateView(), and WizardPluginBase\setValidatedView().

Here is the call graph for this function:

Field Documentation

$filter_defaults
protected
Initial value:
= array(
'id' => NULL,
'expose' => array('operator' => FALSE),
'group' => 1,
)

The documentation for this class was generated from the following file: