本文整理汇总了PHP中EEM_Base::field_settings_for方法的典型用法代码示例。如果您正苦于以下问题:PHP EEM_Base::field_settings_for方法的具体用法?PHP EEM_Base::field_settings_for怎么用?PHP EEM_Base::field_settings_for使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EEM_Base
的用法示例。
在下文中一共展示了EEM_Base::field_settings_for方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepare_value_from_db_for_display
/**
* Shortcut for preparing a database result for display
* @param EEM_Base $model
* @param string $field_name
* @param string $raw_db_value
* @param boolean|string $pretty_schema true to display pretty, a string to use a specific "Schema", or false to NOT display pretty
* @return string
*/
protected function _prepare_value_from_db_for_display($model, $field_name, $raw_db_value, $pretty_schema = true)
{
$field_obj = $model->field_settings_for($field_name);
$value_on_model_obj = $field_obj->prepare_for_set_from_db($raw_db_value);
if ($field_obj instanceof EE_Datetime_Field) {
$field_obj->set_date_format(EE_CSV::instance()->get_date_format_for_csv($field_obj->get_date_format($pretty_schema)), $pretty_schema);
$field_obj->set_time_format(EE_CSV::instance()->get_time_format_for_csv($field_obj->get_time_format($pretty_schema)), $pretty_schema);
}
if ($pretty_schema === true) {
return $field_obj->prepare_for_pretty_echoing($value_on_model_obj);
} elseif (is_string($pretty_schema)) {
return $field_obj->prepare_for_pretty_echoing($value_on_model_obj, $pretty_schema);
} else {
return $field_obj->prepare_for_get($value_on_model_obj);
}
}
示例2: _prepare_value_from_db_for_display
/**
* Shortcut for preparing a database result for display
* @param EEM_Base $model
* @param string $field_name
* @param string $raw_db_value
* @param boolean|string $pretty_schema true to display pretty, a string to use a specific "Schema", or false to NOT display pretty
* @return string
*/
protected function _prepare_value_from_db_for_display($model, $field_name, $raw_db_value, $pretty_schema = true)
{
$field_obj = $model->field_settings_for($field_name);
$value_on_model_obj = $field_obj->prepare_for_set_from_db($raw_db_value);
if ($pretty_schema === true) {
return $field_obj->prepare_for_pretty_echoing($value_on_model_obj);
} elseif (is_string($pretty_schema)) {
return $field_obj->prepare_for_pretty_echoing($value_on_model_obj, $pretty_schema);
} else {
return $field_obj->prepare_for_get($value_on_model_obj);
}
}