本文整理汇总了PHP中Drupal\Component\Plugin\PluginManagerInterface::getAllEntityQueueHandlers方法的典型用法代码示例。如果您正苦于以下问题:PHP PluginManagerInterface::getAllEntityQueueHandlers方法的具体用法?PHP PluginManagerInterface::getAllEntityQueueHandlers怎么用?PHP PluginManagerInterface::getAllEntityQueueHandlers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Component\Plugin\PluginManagerInterface
的用法示例。
在下文中一共展示了PluginManagerInterface::getAllEntityQueueHandlers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: form
/**
* {@inheritdoc}
*/
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$queue = $this->entity;
$form['label'] = [
'#type' => 'textfield',
'#title' => $this->t('Label'),
'#maxlength' => 255,
'#default_value' => $queue->label(),
'#description' => $this->t("Label for the EntityQueue."),
'#required' => TRUE,
];
$form['id'] = [
'#type' => 'machine_name',
'#default_value' => $queue->id(),
'#machine_name' => [
'exists' => '\Drupal\entityqueue\Entity\EntityQueue::load',
],
'#disabled' => !$queue->isNew(),
];
$handlers = $this->entityQueueHandlerManager->getAllEntityQueueHandlers();
$form['handler'] = [
'#type' => 'radios',
'#title' => $this->t('Handler'),
'#options' => $handlers,
'#default_value' => $queue->getHandler(),
'#required' => TRUE,
'#disabled' => !$queue->isNew(),
];
// @todo It should be up to the queue handler to determine what entity types
// are queue-able.
$form['target_type'] = [
'#type' => 'select',
'#title' => $this->t('Type of items to queue'),
'#options' => \Drupal::entityManager()->getEntityTypeLabels(TRUE),
'#default_value' => $queue->getTargetEntityTypeId(),
'#required' => TRUE,
'#disabled' => !$queue->isNew(),
'#size' => 1,
];
$form['settings'] = [
'#type' => 'vertical_tabs',
];
$form['properties'] = [
'#type' => 'details',
'#title' => $this->t('Queue properties'),
'#open' => TRUE,
'#group' => 'settings',
];
$form['properties']['size'] = [
'#type' => 'container',
'#attributes' => ['class' => ['form--inline', 'clearfix']],
];
$form['properties']['size']['min_size'] = [
'#type' => 'number',
'#size' => 2,
'#default_value' => $queue->getMinimumSize(),
'#field_prefix' => $this->t('Restrict this queue to a minimum of'),
];
$form['properties']['size']['max_size'] = [
'#type' => 'number',
'#default_value' => $queue->getMaximumSize(),
'#field_prefix' => $this->t('and a maximum of'),
'#field_suffix' => $this->t('items.'),
];
$form['properties']['act_as_queue'] = [
'#type' => 'checkbox',
'#title' => t('Act as queue'),
'#default_value' => $queue->getActAsQueue(),
'#description' => $this->t('When enabled, adding more than the maximum number of items will remove extra items from the top of the queue.'),
'#states' => [
'invisible' => [
':input[name="max_size"]' => ['value' => 0],
],
],
];
return $form;
}