本文整理汇总了PHP中Drupal\Core\Plugin\DefaultPluginManager::getDefinitions方法的典型用法代码示例。如果您正苦于以下问题:PHP DefaultPluginManager::getDefinitions方法的具体用法?PHP DefaultPluginManager::getDefinitions怎么用?PHP DefaultPluginManager::getDefinitions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Plugin\DefaultPluginManager
的用法示例。
在下文中一共展示了DefaultPluginManager::getDefinitions方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDefinitions
/**
* {@inheritdoc}
*/
public function getDefinitions()
{
$definitions = parent::getDefinitions();
if (!\Drupal::moduleHandler()->moduleExists('imce') || !imce_access()) {
unset($definitions['imce']);
}
return $definitions;
}
示例2: getDefinitions
/**
* Gets the definition of all or filtered plugins for this type.
*
* @param mixed $type
* A string or an array of types to filter on.
*
* @return mixed
* An array of plugin definitions. Keys are plugin IDs.
*/
public function getDefinitions($type = NULL)
{
$definitions = parent::getDefinitions();
// Filter widgets to keep only required types.
if (!empty($type)) {
foreach ($definitions as $widgetId => $widgetInfo) {
if (is_array($type) && !in_array($widgetInfo['type'], $type) || is_string($type) && $widgetInfo['type'] !== $type) {
unset($definitions[$widgetId]);
}
}
}
return $definitions;
}
示例3: getDefinitions
/**
* {@inheritdoc}
*/
public function getDefinitions()
{
$definitions = parent::getDefinitions();
$count = 0;
foreach ($definitions as &$definition) {
if (isset($definition['weight'])) {
// Add some micro weight.
$definition['weight'] += $count++ * 1.0E-6;
}
}
return $definitions;
}
示例4: getDefinitions
/**
* {@inheritdoc}
*/
public function getDefinitions()
{
$methods = parent::getDefinitions();
uasort($methods, 'Drupal\\Component\\Utility\\SortArray::sortByWeightElement');
return $methods;
}
示例5: getDefinitions
/**
* {@inheritdoc}
*/
public function getDefinitions($sorted = TRUE)
{
$definitions = parent::getDefinitions();
if ($sorted) {
uasort($definitions, ['\\Drupal\\Component\\Utility\\SortArray', 'sortByWeightElement']);
}
return $definitions;
}