本文整理汇总了PHP中AdminHelper::firstParamIsParent方法的典型用法代码示例。如果您正苦于以下问题:PHP AdminHelper::firstParamIsParent方法的具体用法?PHP AdminHelper::firstParamIsParent怎么用?PHP AdminHelper::firstParamIsParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AdminHelper
的用法示例。
在下文中一共展示了AdminHelper::firstParamIsParent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getImageFieldRequirements
public static function getImageFieldRequirements($modelConfig, $fieldProperty)
{
$size = false;
if ($modelConfig->standalone === false && ($parentIdProperty = self::firstParamIsParent($modelConfig))) {
$parentModelConfig = AdminHelper::modelExists($parentIdProperty, 'id');
if ($parentModelConfig && $parentModelConfig->imageSizes) {
if ($parentModelConfig->keyBasedSizes) {
$objectId = AdminHelper::firstParamIsParent($parentModelConfig, true);
/** @var BaseModel $modelName */
/** @var ModelConfig $parentModelConfig */
$modelName = $parentModelConfig->myFullEntityName();
$object = $modelName::find($objectId);
$modelKey = $object->model_key;
$imageSizes = $parentModelConfig->imageSizes->{$modelKey};
} else {
$imageSizes = $parentModelConfig->imageSizes;
}
if ($imageSizes) {
foreach ($imageSizes as $size) {
$size = AdminHelper::objectToArray($size);
break;
}
}
}
}
if (!$size) {
foreach ($modelConfig->formFields as $field) {
if ($field->property == $fieldProperty) {
foreach ($field->sizes as $size) {
$size = AdminHelper::objectToArray($size);
break;
}
}
}
}
if ($size) {
$data = array('minWidth' => $size[0], 'minHeight' => $size[1], 'transformMethod' => $size[2], 'folder' => $size[3], 'quality' => $size[4]);
return $data;
}
return false;
}