本文整理汇总了PHP中Drupal\field\Entity\FieldStorageConfig::getTargetEntityTypeId方法的典型用法代码示例。如果您正苦于以下问题:PHP FieldStorageConfig::getTargetEntityTypeId方法的具体用法?PHP FieldStorageConfig::getTargetEntityTypeId怎么用?PHP FieldStorageConfig::getTargetEntityTypeId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\field\Entity\FieldStorageConfig
的用法示例。
在下文中一共展示了FieldStorageConfig::getTargetEntityTypeId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isValidFieldname
protected function isValidFieldname(FieldStorageConfig $field_storage, FieldableEntityInterface $entity)
{
$comment_field_name_ok = FALSE;
if ($field_storage->getTargetEntityTypeId() !== 'comment') {
return TRUE;
}
$field_name = $field_storage->get('field_name');
// Check if the 'comment' field name exists on the 'commented' entity type.
// @todo: Still not waterproof. You could have a field on a non-relevant entity_type.
foreach (_workflow_info_fields() as $key => $info) {
if ($info->getName() == $field_name && $info->getTargetEntityTypeId() !== 'comment') {
$comment_field_name_ok = TRUE;
}
}
return $comment_field_name_ok;
}
示例2: buildRow
/**
* XXXXX.
* @param \Drupal\field\Entity\FieldStorageConfig $field_storage.
* @return array
* xxx
*/
protected function buildRow(FieldStorageConfig $field_storage)
{
$row = [];
if ($field_storage->isLocked()) {
$row[0]['class'] = array('menu-disabled');
$row[0]['data']['id'] = $this->t('@field_name (Locked)', array('@field_name' => $field_storage->getName()));
} else {
$row[0]['data'] = $field_storage->getName();
}
$row[1]['data'] = $field_storage->getType();
$row[2]['data'] = $field_storage->getTargetEntityTypeId();
$row[3]['data'] = implode(",", $field_storage->getBundles());
$default_type = $this->fieldPermissions->fieldGetPermissionType($field_storage);
if ($default_type == FIELD_PERMISSIONS_PUBLIC) {
$row[4]['data'] = t("Public field (author and administrators can edit, everyone can view)");
$row[4]['colspan'] = 5;
} elseif ($default_type == FIELD_PERMISSIONS_PRIVATE) {
$row[4]['data'] = t("Private field (only author and administrators can edit and view)");
$row[4]['colspan'] = 5;
} elseif ($default_type == FIELD_PERMISSIONS_CUSTOM) {
$row[4]['data'] = t("Custom field Permission ()");
$row[4]['colspan'] = 5;
}
return $row;
}