Fieldmanager
  • Package
  • Class
  • Tree
  • Todo

Packages

  • Fieldmanager
    • Context
    • Datasource
    • Field
    • Util
  • None

Classes

  • Fieldmanager_Datasource
  • Fieldmanager_Datasource_Post
  • Fieldmanager_Datasource_Term
  • Fieldmanager_Datasource_User

Class Fieldmanager_Datasource_Post

Datasource to populate autocomplete and option fields with WordPress Posts.

Fieldmanager_Datasource
Extended by Fieldmanager_Datasource_Post
Package: Fieldmanager\Datasource
Located at datasource/class-fieldmanager-datasource-post.php

Methods summary

public
# __construct( mixed $options = array() )

Constructor

Constructor

Overrides

Fieldmanager_Datasource::__construct
public string
# get_value( integer $value )

Get a post title by post ID

Get a post title by post ID

Parameters

$value
integer
$value post_id

Returns

string
post title

Overrides

Fieldmanager_Datasource::get_value
public array
# get_items( string $fragment = Null )

Get posts which match this datasource, optionally filtered by a fragment, e.g. for Autocomplete.

Get posts which match this datasource, optionally filtered by a fragment, e.g. for Autocomplete.

Parameters

$fragment
string
$fragment

Returns

array
post_id => post_title for display or AJAX

Overrides

Fieldmanager_Datasource::get_items
public string
# get_ajax_action( )

Get an action to register by hashing (non cryptographically for speed) the options that make this datasource unique.

Get an action to register by hashing (non cryptographically for speed) the options that make this datasource unique.

Returns

string
ajax action

Overrides

Fieldmanager_Datasource::get_ajax_action
public
# title_like( mixed $where, mixed & $wp_query )

Perform a LIKE search on post_title, since 's' in WP_Query is too fuzzy when trying to autocomplete a title

Perform a LIKE search on post_title, since 's' in WP_Query is too fuzzy when trying to autocomplete a title

public string
# presave_alter_values( Fieldmanager_Field $field, array $values, string|integer|null $current_values )

For post relationships, delete reciprocal post metadata prior to saving (presave will re-add)

For post relationships, delete reciprocal post metadata prior to saving (presave will re-add)

Parameters

$field
array
$values new post values
$values
array
$current_values existing post values
$current_values
string|integer|null
$current_value

Returns

string
cleaned value

Overrides

Fieldmanager_Datasource::presave_alter_values
public string
# presave( Fieldmanager_Field $field, string|integer $value, string|integer|null $current_value )

Handle reciprocal postmeta and post parents

Handle reciprocal postmeta and post parents

Parameters

$field
integer
$value
$value
string|integer
$value
$current_value
string|integer|null
$current_value

Returns

string

Overrides

Fieldmanager_Datasource::presave
public
# presave_status_transition( Fieldmanager_Field $field, integer $value )

Handle any actions based on the parent's status transition

Handle any actions based on the parent's status transition

Parameters

$field
Fieldmanager_Field
$field the parent
$value
integer
$value the child post id
public array
# preload_alter_values( Fieldmanager_Field $field, array $values )

Preload alter values for post parent The post datasource can store data outside FM's array. This is how we add it back into the array for editing.

Preload alter values for post parent The post datasource can store data outside FM's array. This is how we add it back into the array for editing.

Parameters

$field
Fieldmanager_Field
$field
$values
array
$values

Returns

array
$values loaded up, if applicable.

Overrides

Fieldmanager_Datasource::preload_alter_values
public string
# get_view_link( integer $value )

Get edit link for a post

Get edit link for a post

Parameters

$value
integer
$value

Returns

string

Overrides

Fieldmanager_Datasource::get_view_link
public string
# get_edit_link( integer $value )

Get edit link for a post

Get edit link for a post

Parameters

$value
integer
$value

Returns

string

Overrides

Fieldmanager_Datasource::get_edit_link

Methods inherited from Fieldmanager_Datasource

autocomplete_search(), get_items_for_ajax()

Magic methods summary

Properties summary

public mixed $query_callback
#

Supply a function which returns a list of posts; takes one argument, a possible fragment

Supply a function which returns a list of posts; takes one argument, a possible fragment

public array $query_args
#

Arguments to get_posts(), which uses WP's defaults, plus suppress_filters = False, which can be overriden by setting suppress_filters = True here.

Arguments to get_posts(), which uses WP's defaults, plus suppress_filters = False, which can be overriden by setting suppress_filters = True here.

See

http://codex.wordpress.org/Template_Tags/get_posts
public boolean $use_ajax
#

Allow AJAX. If set to false, Autocomplete will pre-load get_items() with no fragment, so False could cause performance problems.

Allow AJAX. If set to false, Autocomplete will pre-load get_items() with no fragment, so False could cause performance problems.

public string|Null $reciprocal
#

If not empty, set this post's ID as a value on the linked post. This is used to establish two-way relationships.

If not empty, set this post's ID as a value on the linked post. This is used to establish two-way relationships.

public boolean $show_date
#

Display the post publish date in the typeahead menu.

Display the post publish date in the typeahead menu.

public string $date_format
#

If $show_date is true, the format to use for displaying the date.

If $show_date is true, the format to use for displaying the date.

public boolean $publish_with_parent
#

Publish the child post when/if the parent is published.

Publish the child post when/if the parent is published.

public boolean $save_to_post_parent
#

Save to post parent

Save to post parent

public boolean $only_save_to_post_parent
#

Only save to post parent

Only save to post parent

Properties inherited from Fieldmanager_Datasource

$ajax_action, $allow_optgroups, $counter, $grouped, $options, $options_callback

Fieldmanager API documentation generated by ApiGen 2.8.0