本文整理汇总了PHP中Drupal\Core\Field\BaseFieldDefinition::getFieldStorageDefinition方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseFieldDefinition::getFieldStorageDefinition方法的具体用法?PHP BaseFieldDefinition::getFieldStorageDefinition怎么用?PHP BaseFieldDefinition::getFieldStorageDefinition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Field\BaseFieldDefinition
的用法示例。
在下文中一共展示了BaseFieldDefinition::getFieldStorageDefinition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRelatedPropertyLabel
/**
* Provides a label for a property by its relationship to a context.
*
* @param \Drupal\Core\Field\BaseFieldDefinition $property
* The property for which to generate a label.
* @param \Drupal\Core\Plugin\Context\ContextInterface $context
* The context to which the property is related.
* @param $context_id
* The context from the previous parameter's id in the contexts array.
*
* @return \Drupal\Core\StringTranslation\TranslatableMarkup
* A label for this property for use in user interfaces.
*/
protected function getRelatedPropertyLabel(BaseFieldDefinition $property, ContextInterface $context, $context_id)
{
/** @var \Drupal\Core\StringTranslation\TranslatableMarkup $label */
$label = $property->getFieldStorageDefinition()->getLabel();
$string = "@context_id: {$label->getUntranslatedString()}";
$args = $label->getArguments();
$args['@context_id'] = !empty($context->getContextDefinition()->getLabel()) ? $context->getContextDefinition()->getLabel() : "{$context_id}";
$options = $label->getOptions();
// @todo we need to really think about this label. It informs the UI extensively and should be as clear as possible.
return $this->translation->translate($string, $args, $options);
}