Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

field() Traversal should be able to reference table/meta #971

Closed
sc0ttkclark opened this Issue · 3 comments

2 participants

@sc0ttkclark
Owner
// A field on the post type that's part of it's object table
$post_title = $pod->field( 'related_post_type.post_title' );

// A relationship field on the post type
$another_relationship = $pod->field( 'related_post_type.another_relationship' );

// A relationship (custom simple) field on the post type that's meta-based
$custom_meta_field = $pod->field( 'related_post_type.custom_simple_relationship' );

// A field on the post type that's meta-based
$custom_meta_field = $pod->field( 'related_post_type.custom_meta_field' );

// A field on the post type that's table-based
$custom_table_field = $pod->field( 'another_post_type.custom_table_field' );

// A field on the taxonomy that's part of it's object table (part of the new Taxonomy field type handling)
$term_id = $pod->field( 'taxonomy_name.term_id' );

// A field on the taxonomy that's table-based (part of the new Taxonomy field type handling)
$custom_table_field = $pod->field( 'taxonomy_name.custom_table_field' );

Right now, you can only reference fields on that object, or relationships/file uploads. It doesn't let you grab field values that are meta-based or on the Pods-created table.

Available options as of Pods 2.3

  • related_post_type.post_title
  • related_post_type.another_relationship
  • related_post_type.custom_simple_relationship (pending confirmation of unit test)
  • related_post_type.custom_meta_field
  • another_post_type.custom_table_field
  • taxonomy_name.term_id (pending confirmation of unit test)
  • taxonomy_name.custom_table_field (pending confirmation of unit test)
  • post_thumbnail (for post types)
  • post_thumbnail.full (for post types, traversal is the size to use, thumbnail default, accepts thumbnail, medium, large, full, 400x111, etc)
  • post_thumbnail_url (for post types)
  • post_thumbnail_url.full (for post types, traversal is the size to use, thumbnail default, accepts thumbnail, medium, large, full, 400x111, etc)
  • avatar (for users)
  • avatar.32 (for users, traversal is the size to use, must be integer, default is 96, max is 512)
  • image_attachment.123 (output an image by attachment ID)
  • image_attachment.123.full (output an image by attachment ID, traversal is the size to use, thumbnail default, accepts thumbnail, medium, large, full, 400x111, etc)
  • image_attachment_url.123 (output an image URL by attachment ID)
  • image_attachment_url.123.full (output an image URL by attachment ID, traversal is the size to use, thumbnail default, accepts thumbnail, medium, large, full, 400x111, etc)
  • file_field_name._src / file_field_name._src_full URL for full image size
  • file_field_name._src_sizename URL for custom image size
  • file_field_name._src_thumbnail URL for thumbnail image size
@sc0ttkclark sc0ttkclark was assigned
@sc0ttkclark sc0ttkclark referenced this issue from a commit
@sc0ttkclark sc0ttkclark Permalink handling for detail_url for taxonomies, users, and now comm…
…ents; Support for traversal on object fields part 1 in #971
df1f559
@pglewis pglewis was assigned
@sc0ttkclark
Owner

Assigning to @pglewis for the remaining unit tests to be done on the 'unchecked' items in the task list here so we can close it.

@sc0ttkclark sc0ttkclark referenced this issue from a commit
@sc0ttkclark sc0ttkclark Fixes #1054; Added ->field( 'avatar' ) for users, uses get_avatar #971;…
… Set all Pods necessary options as autoload; Fixes Avatar handling / loading; Fixes #1049; Fix issue when renaming extended Pod, better enforcing the inability to rename on post types / taxonomies
d68fc66
@pglewis
Owner

Newly added for file uploads:

file._src = full file url
file._src_{size-name} = size-name image url (file._src_full, file._src_thumbnail, file._src_medium)

@sc0ttkclark
Owner

Taxonomies need retesting as part of #1638

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.