本文整理汇总了PHP中Drupal\Core\Config\Entity\ConfigEntityInterface::bundle方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigEntityInterface::bundle方法的具体用法?PHP ConfigEntityInterface::bundle怎么用?PHP ConfigEntityInterface::bundle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Config\Entity\ConfigEntityInterface
的用法示例。
在下文中一共展示了ConfigEntityInterface::bundle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: overviewRow
/**
* Builds a table row for overview form.
*
* @param \Drupal\Core\Config\Entity\ConfigEntityInterface $entity
* Data needed to build the list row.
*
* @return array
* A single table row for the overview.
*/
public function overviewRow(ConfigEntityInterface $entity)
{
$label = $entity->label() ?: $this->t('@type: @id', array('@type' => $entity->getEntityTypeId(), '@id' => $entity->id()));
// Get current job items for the entity to determine translation statuses.
$source_lang = $entity->language()->getId();
$current_job_items = tmgmt_job_item_load_latest('config', $entity->getEntityTypeId(), $entity->getConfigDependencyName(), $source_lang);
$row['id'] = $entity->id();
$definition = \Drupal::entityTypeManager()->getDefinition($entity->bundle());
$row['config_id'] = $definition->getConfigPrefix() . '.' . $entity->id();
if ($entity->hasLinkTemplate('edit-form')) {
$row['title'] = $entity->toLink($label, 'edit-form');
} else {
// If the entity doesn't have a link we display a label.
$row['title'] = $label;
}
// Load entity translation specific data.
foreach (\Drupal::languageManager()->getLanguages() as $langcode => $language) {
$translation_status = 'current';
if ($langcode == $source_lang) {
$translation_status = 'original';
} elseif (!$this->isTranslated($langcode, $entity->getConfigDependencyName())) {
$translation_status = 'missing';
}
// @todo Find a way to support marking configuration translations as outdated.
$build = $this->buildTranslationStatus($translation_status, isset($current_job_items[$langcode]) ? $current_job_items[$langcode] : NULL);
$row['langcode-' . $langcode] = ['data' => \Drupal::service('renderer')->render($build), 'class' => array('langstatus-' . $langcode)];
}
return $row;
}