Drupal 8  8.0.2
Views Class Reference

Static Public Member Functions

static viewsData ()
 
static viewsDataHelper ()
 
static executableFactory ()
 
static analyzer ()
 
static pluginManager ($type)
 
static handlerManager ($type)
 
static getView ($id)
 
static fetchPluginNames ($type, $key=NULL, array $base=array())
 
static getPluginDefinitions ()
 
static getEnabledDisplayExtenders ()
 
static getApplicableViews ($type)
 
static getAllViews ()
 
static getEnabledViews ()
 
static getDisabledViews ()
 
static getViewsAsOptions ($views_only=FALSE, $filter= 'all', $exclude_view=NULL, $optgroup=FALSE, $sort=FALSE)
 
static pluginList ()
 
static getHandlerTypes ()
 
static getPluginTypes ($type=NULL)
 

Static Protected Member Functions

static t ($string, array $args=array(), array $options=array())
 

Static Protected Attributes

static $translationManager
 
static $handlerTypes
 
static $plugins
 

Detailed Description

Static service container wrapper for views.

Member Function Documentation

static analyzer ( )
static

Returns the view analyzer.

Returns
Returns a view analyzer object.

Referenced by Analyze\buildForm().

Here is the caller graph for this function:

static executableFactory ( )
static

Returns the view executable factory service.

Returns
Returns a views executable factory.

Referenced by ViewExecutable\attachDisplays(), and View\getExecutable().

Here is the caller graph for this function:

static fetchPluginNames (   $type,
  $key = NULL,
array  $base = array() 
)
static

Fetches a list of all base tables available

Parameters
string$typeEither 'display', 'style' or 'row'.
string$keyFor style plugins, this is an optional type to restrict to. May be 'normal', 'summary', 'feed' or others based on the needs of the display.
array$baseAn array of possible base tables.
Returns
A keyed array of in the form of 'base_table' => 'Description'.

Referenced by AdvancedSettingsForm\buildForm(), WizardPluginBase\buildForm(), DisplayPluginBase\buildOptionsForm(), ViewEditForm\getDisplayDetails(), Feed\newDisplay(), ViewEditForm\renderDisplayTop(), WizardPluginBase\rowStyleOptions(), and ModuleTest\testViewsFetchPluginNames().

Here is the caller graph for this function:

static getAllViews ( )
static

Returns an array of all views as fully loaded $view objects.

Returns
[] An array of loaded view entities.

Referenced by GroupwiseMax\buildOptionsForm(), ModuleTest\testLoadFunctions(), and CacheabilityMetadataUpdateTest\testUpdateHookN().

Here is the caller graph for this function:

static getApplicableViews (   $type)
static

Return a list of all view IDs and display IDs that have a particular setting in their display's plugin settings.

Parameters
string$typeA flag from the display plugin definitions (e.g, 'uses_menu_links').
Returns
array A list of arrays containing the $view_id and $display_id.
array(
array($view_id, $display_id),
array($view_id, $display_id),
);

References Drupal\entityManager(), and Drupal\service().

Referenced by ViewsSelection\buildConfigurationForm(), ViewsLocalTask\getApplicableMenuViews(), RouteSubscriber\getApplicableViews(), and ViewsTest\testGetApplicableViews().

Here is the call graph for this function:

Here is the caller graph for this function:

static getDisabledViews ( )
static

Returns an array of all disabled views.

Returns
[] An array of loaded disabled view entities.

References Drupal\entityQuery().

Referenced by ModuleTest\testLoadFunctions().

Here is the call graph for this function:

Here is the caller graph for this function:

static getEnabledDisplayExtenders ( )
static

Gets enabled display extenders.

References Drupal\config().

Referenced by DisplayExtenderTest\testDisplayExtenders().

Here is the call graph for this function:

Here is the caller graph for this function:

static getEnabledViews ( )
static

Returns an array of all enabled views.

Returns
[] An array of loaded enabled view entities.

References Drupal\entityQuery().

Referenced by ModuleTest\testLoadFunctions(), and ViewsListTest\testViewsListLimit().

Here is the call graph for this function:

Here is the caller graph for this function:

static getHandlerTypes ( )
static

Provide a list of views handler types used in a view, with some information about them.

Returns
array An array of associative arrays containing:
  • title: The title of the handler type.
  • ltitle: The lowercase title of the handler type.
  • stitle: A singular title of the handler type.
  • lstitle: A singular lowercase title of the handler type.
  • plural: Plural version of the handler type.
  • (optional) type: The actual internal used handler type. This key is just used for header,footer,empty to link to the internal type: area.

References t().

Referenced by DisplayPluginBase\getAllHandlers(), ViewExecutable\getHandlerTypes(), and ViewsEntitySchemaSubscriber\processHandlers().

Here is the call graph for this function:

Here is the caller graph for this function:

static getPluginDefinitions ( )
static

Gets all the views plugin definitions.

Returns
array An array of plugin definitions for all types.

References ViewExecutable\getPluginTypes().

Here is the call graph for this function:

static getPluginTypes (   $type = NULL)
static

Returns a list of plugin types.

Parameters
string$type(optional) filter the list of plugins by type. Available options are 'plugin' or 'handler'.
Returns
array An array of plugin types.

Referenced by DisplayPluginBase\getAllPlugins(), and ViewExecutable\getPluginTypes().

Here is the caller graph for this function:

static getView (   $id)
static

Loads a view from configuration and returns its executable object.

Parameters
string$idThe view ID to load.
Returns
A view executable instance, from the loaded entity.

References Drupal\service().

Referenced by FilterDateTest\_testBetween(), FilterDateTimeTest\_testBetween(), FilterDateTimeTest\_testExact(), HandlerFieldFieldTest\_testFormatterSimpleFieldRender(), StyleTest\_testGrouping(), QueryTest\_testInitQuery(), FilterDateTest\_testOffset(), FilterDateTimeTest\_testOffset(), DisplayPageWebTest\assertPagePath(), RowEntityRenderersTest\assertTranslations(), FieldEntityLinkTest\doTestEntityLink(), FrontPageTest\doTestFrontPageViewCacheTags(), FilterStringTest\getBasicPageView(), SortRandomTest\getBasicRandomView(), RearrangeFieldsTest\getViewFields(), QueryGroupByTest\groupByTestHelper(), ViewsSelection\initializeView(), GroupwiseMax\leftQuery(), ViewStorageTest\loadTests(), View\preRenderViewElement(), QueryTest\queryMethodsTests(), ViewEditForm\save(), TaxonomyTermFilterDepthTest\setUp(), BulkFormTest\setUp(), HandlerTest\testAccess(), AccessTest\testAccessNone(), AccessPermissionTest\testAccessPerm(), QueryGroupByTest\testAggregateCount(), DefaultViewsTest\testArchiveView(), AreaTest\testAreaAccess(), ArgumentLanguageTest\testArgument(), ArgumentDefaultTest\testArgumentDefaultFixed(), ArgumentDefaultTest\testArgumentDefaultPlugin(), HandlerArgumentUserUidTest\testArgumentTitle(), ArgumentValidateTest\testArgumentValidateUserName(), ArgumentValidateTest\testArgumentValidateUserUid(), ArgumentValidatorTest\testArgumentValidatorPlugin(), ArgumentValidatorTermTest\testArgumentValidatorTerm(), FieldFieldTest\testAttachedRender(), DisplayAttachmentTest\testAttachmentUI(), JoinTest\testBasePlugin(), RevisionRelationshipsTest\testBlockContentRevisionRelationship(), DefaultViewRecentCommentsTest\testBlockDisplay(), BulkFormTest\testBulkForm(), BulkFormTest\testBulkFormCombineFilter(), CacheTest\testCacheContextIntegration(), CacheTest\testCacheData(), FrontPageTest\testCacheTagsWithCachePluginTag(), FrontPageTest\testCacheTagsWithCachePluginTime(), WizardTest\testCommentWizard(), FieldFieldTest\testComplexExecute(), FieldFieldTest\testComplexRender(), ViewExecutableTest\testConstructing(), ArgumentDateTest\testCreatedFullDateHandler(), ViewStorageTest\testCreateDuplicate(), FieldCustomTest\testCustomFieldXss(), CustomBooleanTest\testCustomOption(), CustomBooleanTest\testCustomOptionTemplate(), StyleTest\testCustomRowClasses(), UserDataTest\testDataField(), FilterDateTest\testDateOffsets(), SortDateTest\testDateOrdering(), ArgumentDateTimeTest\testDatetimeArgumentAll(), ArgumentDateTimeTest\testDatetimeArgumentDay(), ArgumentDateTimeTest\testDatetimeArgumentMonth(), ArgumentDateTimeTest\testDatetimeArgumentYear(), SortDateTimeTest\testDateTimeSort(), ArgumentDateTest\testDayHandler(), DisplayKernelTest\testDefaultOptions(), StyleUnformattedTest\testDefaultRowClasses(), StyleHtmlListTest\testDefaultRowClasses(), DisplayBlockTest\testDeleteBlockDisplay(), HandlerFilterRolesTest\testDependencies(), DisplayPageTest\testDependencies(), ViewExecutableTest\testDestroy(), StorageTest\testDetails(), DisplayAttachmentTest\testDisabledAttachments(), DisplayFeedTest\testDisabledFeed(), DisplayTest\testDisplayAreas(), DisplayExtenderTest\testDisplayExtenders(), DisplayExtenderUITest\testDisplayExtenderUI(), ViewExecutableTest\testDisplays(), DisplayCRUDTest\testDuplicateDisplay(), RowEntityTest\testEntityRow(), JoinTest\testExamplePlugin(), ExposedFormTest\testExposedBlock(), ExposedFormTest\testExposedFormRender(), FieldLanguageTest\testField(), FieldFieldTest\testFieldAlias(), FieldFieldTest\testFieldAliasRender(), StyleSerializerTest\testFieldapiField(), FieldCustomTest\testFieldCustom(), FieldDateTest\testFieldDate(), FieldUITest\testFieldLabel(), HandlerFieldPermissionTest\testFieldPermission(), StyleSerializerTest\testFieldRawOutput(), FilterUidRevisionTest\testFilter(), FilterLanguageTest\testFilter(), FilterBooleanOperatorTest\testFilterBooleanOperator(), FilterBooleanOperatorStringTest\testFilterBooleanOperatorString(), FilterCombineTest\testFilterCombineContainsFieldsOverwritten(), FilterEntityBundleTest\testFilterEntity(), FilterBooleanOperatorTest\testFilterGroupedExposed(), FilterBooleanOperatorStringTest\testFilterGroupedExposed(), DisplayTest\testFilterGroupsOverriding(), HandlerFilterPermissionTest\testFilterPermission(), FilterTest\testFilterQuery(), ForumIntegrationTest\testForumIntegration(), FrontPageTest\testFrontPage(), DisplayTest\testGetAttachedDisplays(), ViewEntityDependenciesTest\testGetDependencies(), FieldEntityTest\testGetEntity(), ViewExecutableTest\testGetHandlers(), DisplayKernelTest\testGetPlugin(), ViewsTest\testGetView(), ArgumentStringTest\testGlossary(), GlossaryTest\testGlossaryView(), StyleGridTest\testGrid(), QueryGroupByTest\testGroupByBaseField(), QueryGroupByTest\testGroupByCountOnlyFilters(), QueryGroupByTest\testGroupByFieldWithCardinality(), HistoryTimestampTest\testHandlers(), FieldUITest\testHandlerUI(), HandlerTest\testHandlerWeights(), ViewsHooksTest\testHooks(), AreaHTTPStatusCodeTest\testHTTPStatusCodeHandler(), ViewExecutableTest\testInitMethods(), ViewsIntegrationTest\testIntegration(), PagerTest\testLimit(), CommentLinksTest\testLinkApprove(), CommentLinksTest\testLinkReply(), StyleMappingTest\testMappedOutput(), AreaMessagesTest\testMessageText(), MiniPagerTest\testMiniPagerRender(), FieldFieldTest\testMissingBundleFieldRender(), ArgumentDateTest\testMonthHandler(), NidArgumentTest\testNidArgument(), TaxonomyDefaultArgumentTest\testNodePath(), RevisionRelationshipsTest\testNodeRevisionRelationship(), PagerTest\testNoLimit(), CacheTest\testNoneResultCaching(), PagerTest\testNormalPager(), SortTest\testNumericOrdering(), DisplayTest\testOutputIsEmpty(), PagerTest\testPagerApi(), PagerTest\testPagerConfigTranslation(), DisplayPageTest\testPageResponses(), HandlerTest\testPlaceholder(), ViewExecutableTest\testProperties(), ViewExecutableTest\testPropertyMethods(), FieldKernelTest\testQuery(), QueryTest\testQueryUI(), SortRandomTest\testRandomOrdering(), DisplayTest\testReadMoreNoDisplay(), RelationshipRepresentativeNodeTest\testRelationship(), RelationshipTest\testRelationshipQuery(), RelationshipTest\testRelationshipRender(), ViewRenderTest\testRender(), AreaTest\testRenderArea(), AreaTest\testRenderAreaToken(), AreaTest\testRenderEmptyHeaderFooter(), PagerTest\testRenderNullPager(), DisplayTest\testReorderDisplay(), ExposedFormTest\testResetButton(), FieldFieldTest\testRevisionComplexExecute(), FieldFieldTest\testRevisionComplexRender(), FieldFieldTest\testRevisionExecute(), FieldFieldTest\testRevisionRender(), RowUITest\testRowUI(), SelectionTest\testSelectionHandlerRelationship(), PagerKernelTest\testSetPagerMethods(), HandlerTest\testSetRelationship(), BasicTest\testSimpleArgument(), FieldFieldTest\testSimpleExecute(), BasicTest\testSimpleFiltering(), FieldFieldTest\testSimpleRender(), BasicTest\testSimpleResultSet(), ArgumentValidatorTest\testSpecifyValidation(), ViewsSqlExceptionTest\testSqlException(), AccessTest\testStaticAccessPlugin(), ModuleTest\testStatusFunctions(), PagerTest\testStorePagerSettings(), SortTest\testStringOrdering(), StyleUITest\testStyleUI(), ExposedFormTest\testSubmitButton(), CacheTest\testSubqueryStringCache(), StyleTableUnitTest\testTable(), RssTest\testTaxonomyRss(), ViewsTemplateTest\testTemplate(), TermNameFieldTest\testTermNameField(), ExposedFormTest\testTextInputRequired(), CacheTest\testTimeResultCaching(), CacheTest\testTimeResultCachingWithFilter(), CacheTest\testTimeResultCachingWithPager(), AreaTest\testTitleArea(), DisplayPageWebTest\testTitleOutput(), AreaTitleTest\testTitleText(), TokenReplaceTest\testTokenReplacement(), StyleSerializerTest\testUIFieldAlias(), CommentUserNameTest\testUsername(), HandlerFilterUserNameTest\testUserNameApi(), TrackerUserUidTest\testUserUid(), ViewExecutableTest\testValidate(), TaxonomyFieldAllTermsTest\testViewsHandlerAllTermsField(), TaxonomyFieldAllTermsTest\testViewsHandlerAllTermsWithTokens(), RelationshipUserFileDataTest\testViewsHandlerRelationshipUserFileData(), RelationshipUserImageDataTest\testViewsHandlerRelationshipUserImageData(), ModuleTest\testViewsPreview(), DisplayTest\testViewStatus(), OptionsListArgumentTest\testViewsTestOptionsListArgument(), OptionsListFilterTest\testViewsTestOptionsListFilter(), ArgumentDateTest\testWeekHandler(), StyleTableTest\testWizard(), BasicTest\testWizardDefaultValues(), ArgumentDateTest\testYearHandler(), and ArgumentDateTest\testYearMonthHandler().

Here is the call graph for this function:

static getViewsAsOptions (   $views_only = FALSE,
  $filter = 'all',
  $exclude_view = NULL,
  $optgroup = FALSE,
  $sort = FALSE 
)
static

Returns an array of view as options array, that can be used by select, checkboxes and radios as #options.

Parameters
bool$views_onlyIf TRUE, only return views, not displays.
string$filterFilters the views on status. Can either be 'all' (default), 'enabled' or 'disabled'
mixed$exclude_viewview or current display to exclude either a
  • views object (containing $exclude_view->storage->name and $exclude_view->current_display)
  • views name as string: e.g. my_view
  • views name and display id (separated by ':'): e.g. my_view:default
bool$optgroupIf TRUE, returns an array with optgroups for each view (will be ignored for $views_only = TRUE). Can be used by select
bool$sortIf TRUE, the list of views is sorted ascending.
Returns
array an associative array for use in select.
  • key: view name and display id separated by ':', or the view name only

References Views\t().

Referenced by View\buildOptionsForm(), and ModuleTest\testLoadFunctions().

Here is the call graph for this function:

Here is the caller graph for this function:

static handlerManager (   $type)
static

Returns the plugin manager for a certain views handler type.

Returns

Referenced by RowPluginBase\buildOptionsForm(), DisplayPluginBase\getHandlers(), GroupByNumeric\init(), ConfigHandlerGroup\submitForm(), ConfigHandler\submitForm(), ViewUI\submitItemAdd(), and HandlerBase\submitTemporaryForm().

Here is the caller graph for this function:

static pluginList ( )
static

Returns a list of plugins and metadata about them.

Returns
array An array keyed by PLUGIN_TYPE:PLUGIN_NAME, like 'display:page' or 'pager:full', containing an array with the following keys:
  • title: The plugin's title.
  • type: The plugin type.
  • module: The module providing the plugin.
  • views: An array of enabled Views that are currently using this plugin, keyed by machine name.

Referenced by ViewsUIController\reportPlugins(), and ModuleTest\testViewsPluginList().

Here is the caller graph for this function:

static pluginManager (   $type)
static
static t (   $string,
array  $args = array(),
array  $options = array() 
)
staticprotected

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

See the t() documentation for details.

References Drupal\service().

Referenced by Views\getViewsAsOptions().

Here is the call graph for this function:

Here is the caller graph for this function:

static viewsDataHelper ( )
static

Returns the views data helper service.

Returns
Returns a views data helper object.

Referenced by AddHandler\buildForm(), GroupwiseMax\buildOptionsForm(), and WizardPluginBase\defaultDisplayFiltersUser().

Here is the caller graph for this function:

Field Documentation

$plugins
staticprotected
Initial value:
= array(
'access' => 'plugin',
'area' => 'handler',
'argument' => 'handler',
'argument_default' => 'plugin',
'argument_validator' => 'plugin',
'cache' => 'plugin',
'display_extender' => 'plugin',
'display' => 'plugin',
'exposed_form' => 'plugin',
'field' => 'handler',
'filter' => 'handler',
'join' => 'plugin',
'pager' => 'plugin',
'query' => 'plugin',
'relationship' => 'handler',
'row' => 'plugin',
'sort' => 'handler',
'style' => 'plugin',
'wizard' => 'plugin',
)

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