本文整理匯總了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;
}