in software

Blog toolbox dynamic methods


List of added dynamic methods

  1. BackendUser – getPosts
  2. RainLab\Blog\Models\Post – getCustomPostTypes
  3. RainLab\Blog\Models\Post – getCustomPostType
  4. RainLab\Blog\Models\Post – hasPostType
  5. RainLab\Blog\Models\Post – hasTag
  6. RainLab\Blog\Models\Post – getTagList
  7. RainLab\Blog\Models\Post – canSendNewsletter
  8. RainLab\Blog\Models\Post – getPageUrl
  9. RainLab\Blog\Models\Post – getAuthor

BackendUser – getPosts

With this method you can get Posts collection from User as their author.

RainLab\Blog\Models\Post – getCustomPostTypes

With this method you can get a collection of CustomPostType which are assigned to a certain Post model.

RainLab\Blog\Models\Post – getCustomPostType

With this method you can pass key parameter of the Custom Post Type and it will then return you the object of Custom Post Type related to the Post model.

RainLab\Blog\Models\Post – hasPostType

With this method you can check if a certain Post model contains CustomPostType by passing in a key parameter. This method returns boolean.

RainLab\Blog\Models\Post – hasTag

With this method you can check if a certain Post model contains a Tag by passing in tag string parameter. This method returns boolean

RainLab\Blog\Models\Post – getTagList

This method will return an array of tags which a certain Post model contains.

RainLab\Blog\Models\Post – canSendNewsletter

With this method you can check if the Post model has enabled a newsletter option. This method returns boolean.

RainLab\Blog\Models\Post – getPageUrl

This method will try to find and return the CMS page which has a blogPost component attached to it. If a page has been found, then this method will return the page URL. Depending on situation this method can be useful, but most of the times you will probably use code part “|page” inside twig to make navigation instead of this method.

RainLab\Blog\Models\Post – getAuthor

With this method you can find the author of the Post model. It will return a BackendUser object or null.

All methods listed above can be found in Plugin.php inside the userModelExtend method, except getPosts which can be found inside the userModelExtend method.

Buy blog toolbox plugin - 13 USD

Prev: Models Next: Newsletter in detail