| @@ 323-355 (lines=33) @@ | ||
| 320 | * @return (string) |
|
| 321 | */ |
|
| 322 | ||
| 323 | function get_post_title( $post, $field, $post_id = 0 ) { |
|
| 324 | ||
| 325 | // get post_id |
|
| 326 | if( !$post_id ) { |
|
| 327 | ||
| 328 | $form_data = acf_get_setting('form_data'); |
|
| 329 | ||
| 330 | if( !empty($form_data['post_id']) ) { |
|
| 331 | ||
| 332 | $post_id = $form_data['post_id']; |
|
| 333 | ||
| 334 | } else { |
|
| 335 | ||
| 336 | $post_id = get_the_ID(); |
|
| 337 | ||
| 338 | } |
|
| 339 | ||
| 340 | } |
|
| 341 | ||
| 342 | ||
| 343 | // vars |
|
| 344 | $title = acf_get_post_title( $post ); |
|
| 345 | ||
| 346 | ||
| 347 | // filters |
|
| 348 | $title = apply_filters('acf/fields/page_link/result', $title, $post, $field, $post_id); |
|
| 349 | $title = apply_filters('acf/fields/page_link/result/name=' . $field['_name'], $title, $post, $field, $post_id); |
|
| 350 | $title = apply_filters('acf/fields/page_link/result/key=' . $field['key'], $title, $post, $field, $post_id); |
|
| 351 | ||
| 352 | ||
| 353 | // return |
|
| 354 | return $title; |
|
| 355 | } |
|
| 356 | ||
| 357 | ||
| 358 | /* |
|
| @@ 279-311 (lines=33) @@ | ||
| 276 | * @return (string) |
|
| 277 | */ |
|
| 278 | ||
| 279 | function get_post_title( $post, $field, $post_id = 0 ) { |
|
| 280 | ||
| 281 | // get post_id |
|
| 282 | if( !$post_id ) { |
|
| 283 | ||
| 284 | $form_data = acf_get_setting('form_data'); |
|
| 285 | ||
| 286 | if( !empty($form_data['post_id']) ) { |
|
| 287 | ||
| 288 | $post_id = $form_data['post_id']; |
|
| 289 | ||
| 290 | } else { |
|
| 291 | ||
| 292 | $post_id = get_the_ID(); |
|
| 293 | ||
| 294 | } |
|
| 295 | ||
| 296 | } |
|
| 297 | ||
| 298 | ||
| 299 | // vars |
|
| 300 | $title = acf_get_post_title( $post ); |
|
| 301 | ||
| 302 | ||
| 303 | // filters |
|
| 304 | $title = apply_filters('acf/fields/post_object/result', $title, $post, $field, $post_id); |
|
| 305 | $title = apply_filters('acf/fields/post_object/result/name=' . $field['_name'], $title, $post, $field, $post_id); |
|
| 306 | $title = apply_filters('acf/fields/post_object/result/key=' . $field['key'], $title, $post, $field, $post_id); |
|
| 307 | ||
| 308 | ||
| 309 | // return |
|
| 310 | return $title; |
|
| 311 | } |
|
| 312 | ||
| 313 | ||
| 314 | /* |
|