本文整理匯總了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;
}