本文整理汇总了PHP中Drupal\Core\Entity\EntityTypeInterface::hasHandlerClass方法的典型用法代码示例。如果您正苦于以下问题:PHP EntityTypeInterface::hasHandlerClass方法的具体用法?PHP EntityTypeInterface::hasHandlerClass怎么用?PHP EntityTypeInterface::hasHandlerClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Entity\EntityTypeInterface
的用法示例。
在下文中一共展示了EntityTypeInterface::hasHandlerClass方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
if ($this->entity && $this->entityTypeDefinition->hasHandlerClass('entity_clone')) {
$form['information'] = [
'#markup' => $this->stringTranslationManager->translate('<p>Do you want clone the <em>@entity_type</em> entity named <em>@title</em>?</p>', [
'@entity_type' => $this->entity->getEntityType()->getLabel(),
'@title' => $this->entity->label(),
]),
];
/** @var \Drupal\entity_clone\EntityClone\EntityCloneFormInterface $entity_clone_handler */
if ($this->entityTypeManager->hasHandler($this->entityTypeDefinition->id(), 'entity_clone_form')) {
$entity_clone_form_handler = $this->entityTypeManager->getHandler($this->entityTypeDefinition->id(), 'entity_clone_form');
$form = array_merge($form, $entity_clone_form_handler->formElement($this->entity));
}
$form['clone'] = [
'#type' => 'submit',
'#value' => 'Clone',
];
$form['abort'] = [
'#type' => 'submit',
'#value' => 'Abort',
'#submit' => '::cancelForm',
];
}
return $form;
}
示例2: canModerateEntitiesOfEntityType
/**
* {@inheritdoc}
*/
public function canModerateEntitiesOfEntityType(EntityTypeInterface $entity_type)
{
return $entity_type->hasHandlerClass('moderation');
}
示例3: isModeratableEntityType
/**
* {@inheritdoc}
*/
public function isModeratableEntityType(EntityTypeInterface $entity_type)
{
return $entity_type->hasHandlerClass('moderation');
}