acf_field_post_object::get_post_result
This function will return an array containing id, text and maybe description data
Метод класса: acf_field_post_object{}
Хуков нет.
Возвращает
Массив. The combined result array.
Использование
$acf_field_post_object = new acf_field_post_object(); $acf_field_post_object->get_post_result( $id, $text );
- $id(разное) (обязательный)
- The ID of the post result.
- $text(строка) (обязательный)
- The text for the response item.
Список изменений
| С версии 5.4.0 | Введена. |
Код acf_field_post_object::get_post_result() acf field post object::get post result ACF 6.4.2
public function get_post_result( $id, $text ) {
// vars
$result = array(
'id' => $id,
'text' => $text,
);
// look for parent
$search = '| ' . __( 'Parent', 'acf' ) . ':';
$pos = strpos( $text, $search );
if ( $pos !== false ) {
$result['description'] = substr( $text, $pos + 2 );
$result['text'] = substr( $text, 0, $pos );
}
// return
return $result;
}