本文整理汇总了PHP中Sonata\AdminBundle\Admin\FieldDescriptionInterface::getFieldMapping方法的典型用法代码示例。如果您正苦于以下问题:PHP FieldDescriptionInterface::getFieldMapping方法的具体用法?PHP FieldDescriptionInterface::getFieldMapping怎么用?PHP FieldDescriptionInterface::getFieldMapping使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sonata\AdminBundle\Admin\FieldDescriptionInterface
的用法示例。
在下文中一共展示了FieldDescriptionInterface::getFieldMapping方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFormTypeName
/**
* Returns the class associated to a FieldDescriptionInterface if any defined
*
* @throws RuntimeException
* @param \Sonata\AdminBundle\Admin\FieldDescriptionInterface $fieldDescription
* @return bool|string
*/
public function getFormTypeName(FieldDescriptionInterface $fieldDescription)
{
$typeName = false;
// the user redefined the mapping type, use the default built in definition
if (!$fieldDescription->getFieldMapping() || $fieldDescription->getType() != $fieldDescription->getMappingType()) {
$typeName = array_key_exists($fieldDescription->getType(), $this->formTypes) ? $this->formTypes[$fieldDescription->getType()] : false;
} else {
if ($fieldDescription->getOption('form_field_type', false)) {
$typeName = $fieldDescription->getOption('form_field_type', false);
} else {
if (array_key_exists($fieldDescription->getType(), $this->formTypes)) {
$typeName = $this->formTypes[$fieldDescription->getType()];
}
}
}
if (!$typeName) {
throw new \RuntimeException(sprintf('No known form type for field `%s` (`%s`) is implemented.', $fieldDescription->getFieldName(), $fieldDescription->getType()));
}
return $typeName;
}