tp TouchPointWP PostTypeCapable - TenthPres/TouchPoint-WP GitHub Wiki

tp\TouchPointWP\PostTypeCapable

This is a base class for those objects that can be derived from a Post.

Methods

post_id

int tp\TouchPointWP\PostTypeCapable::post_id()

Get the Post_id.

  • Visibility: public

Returns

  • int -

getPost

\WP_Post|null tp\TouchPointWP\storedAsPost::getPost(bool create)

Get the WP_Post object corresponding to the object.

Arguments

  • create bool - Set true if the post should be created if it doesn't exist. This would need to be implemented in each module, and is not implemented in most.

Returns

  • \WP_Post|null -

fromPost

?\tp\TouchPointWP\PostTypeCapable tp\TouchPointWP\PostTypeCapable::fromPost(\WP_Post post)

Create relevant objects from a given post

  • Visibility: public
  • This method is static.

Arguments

  • post WP_Post

Returns

  • ?\tp\TouchPointWP\PostTypeCapable -

permalink

string tp\TouchPointWP\PostTypeCapable::permalink()

Get the link for the post.

  • Visibility: public

Returns

  • string -

notableAttributes

string[] tp\TouchPointWP\PostTypeCapable::notableAttributes(array exclude)

Get notable attributes.

  • Visibility: public
  • This method is abstract.

Arguments

  • exclude array - Attributes listed here will be excluded. (e.g. if shown for a parent, not needed here.)

Returns

  • string[] -

getActionButtons

\tp\TouchPointWP\Utilities\StringableArray tp\TouchPointWP\PostTypeCapable::getActionButtons(string|null context, string btnClass, bool withTouchPointLink, bool absoluteLinks)
  • Visibility: public
  • This method is abstract.

Arguments

  • context string|null - A string that gives filters some context for where the request is coming from
  • btnClass string - HTML class names to put into the buttons/links
  • withTouchPointLink bool - Whether to include a link to the item within TouchPoint.
  • absoluteLinks bool - Set true to make the links absolute, so they work from apps or emails.

Returns

  • \tp\TouchPointWP\Utilities\StringableArray -

postIsType

bool tp\TouchPointWP\PostTypeCapable::postIsType(\WP_Post post)

Indicates if the given post can be instantiated as the given post type.

  • Visibility: public
  • This method is abstract.
  • This method is static.

Arguments

  • post WP_Post

Returns

  • bool -

getTouchPointId

int tp\TouchPointWP\PostTypeCapable::getTouchPointId()

Gets a TouchPoint item ID number, regardless of what type of object this is.

  • Visibility: public
  • This method is abstract.

Returns

  • int -

load

bool tp\TouchPointWP\module::load()

Loads the module and initializes the other actions.

Returns

  • bool -