本文整理汇总了PHP中Drupal\views\Views::getPluginTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP Views::getPluginTypes方法的具体用法?PHP Views::getPluginTypes怎么用?PHP Views::getPluginTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\views\Views
的用法示例。
在下文中一共展示了Views::getPluginTypes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPluginTypes
/**
* Returns the valid types of plugins that can be used.
*
* @return array
* An array of plugin type strings.
*/
public static function getPluginTypes($type = NULL)
{
return Views::getPluginTypes($type);
}
示例2: calculateDependencies
/**
* {@inheritdoc}
*/
public function calculateDependencies()
{
parent::calculateDependencies();
// Ensure that the view is dependant on the module that implements the view.
$this->addDependency('module', $this->module);
// Ensure that the view is dependent on the module that provides the schema
// for the base table.
$schema = $this->drupalGetSchema($this->base_table);
// @todo Entity base tables are no longer registered in hook_schema(). Once
// we automate the views data for entity types add the entity type
// type provider as a dependency. See https://drupal.org/node/1740492.
if ($schema && $this->module != $schema['module']) {
$this->addDependency('module', $schema['module']);
}
$handler_types = array();
foreach (Views::getHandlerTypes() as $type) {
$handler_types[] = $type['plural'];
}
foreach ($this->get('display') as $display) {
// Collect all dependencies of all handlers.
foreach ($handler_types as $handler_type) {
if (!empty($display['display_options'][$handler_type])) {
foreach ($display['display_options'][$handler_type] as $handler) {
// Add the provider as dependency.
if (isset($handler['provider'])) {
$this->addDependency('module', $handler['provider']);
}
// Add the additional dependencies from the handler configuration.
if (!empty($handler['dependencies'])) {
$this->addDependencies($handler['dependencies']);
}
}
}
}
// Collect all dependencies of plugins.
foreach (Views::getPluginTypes('plugin') as $plugin_type) {
if (!empty($display['display_options'][$plugin_type]['options']['dependencies'])) {
$this->addDependencies($display['display_options'][$plugin_type]['options']['dependencies']);
}
}
}
return $this->dependencies;
}
示例3: calculateCacheMetadata
/**
* {@inheritdoc}
*/
public function calculateCacheMetadata()
{
$cache_metadata = new CacheableMetadata();
// Iterate over ordinary views plugins.
foreach (Views::getPluginTypes('plugin') as $plugin_type) {
$plugin = $this->getPlugin($plugin_type);
if ($plugin instanceof CacheableDependencyInterface) {
$cache_metadata = $cache_metadata->merge(CacheableMetadata::createFromObject($plugin));
}
}
// Iterate over all handlers. Note that at least the argument handler will
// need to ask all its subplugins.
foreach (array_keys(Views::getHandlerTypes()) as $handler_type) {
$handlers = $this->getHandlers($handler_type);
foreach ($handlers as $handler) {
if ($handler instanceof CacheableDependencyInterface) {
$cache_metadata = $cache_metadata->merge(CacheableMetadata::createFromObject($handler));
}
}
}
/** @var \Drupal\views\Plugin\views\cache\CachePluginBase $cache_plugin */
if ($cache_plugin = $this->getPlugin('cache')) {
$cache_plugin->alterCacheMetadata($cache_metadata);
}
return $cache_metadata;
}
示例4: calculateCacheMetadata
/**
* {@inheritdoc}
*/
public function calculateCacheMetadata()
{
$is_cacheable = TRUE;
$cache_contexts = [];
// Iterate over ordinary views plugins.
foreach (Views::getPluginTypes('plugin') as $plugin_type) {
$plugin = $this->getPlugin($plugin_type);
if ($plugin instanceof CacheablePluginInterface) {
$cache_contexts = array_merge($cache_contexts, $plugin->getCacheContexts());
$is_cacheable &= $plugin->isCacheable();
} else {
$is_cacheable = FALSE;
}
}
// Iterate over all handlers. Note that at least the argument handler will
// need to ask all its subplugins.
foreach (array_keys(Views::getHandlerTypes()) as $handler_type) {
$handlers = $this->getHandlers($handler_type);
foreach ($handlers as $handler) {
if ($handler instanceof CacheablePluginInterface) {
$cache_contexts = array_merge($cache_contexts, $handler->getCacheContexts());
$is_cacheable &= $handler->isCacheable();
}
}
}
/** @var \Drupal\views\Plugin\views\cache\CachePluginBase $cache_plugin */
if ($cache_plugin = $this->getPlugin('cache')) {
$cache_plugin->alterCacheMetadata($is_cacheable, $cache_contexts);
}
return [(bool) $is_cacheable, $cache_contexts];
}