This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
creg33270
Is it possible to access the properties of a component e.g. blogPosts in the OnStart() function? If so, how?
title = "Blog Category"
url = "/blog/category/:slug/:page?"
[blogPosts]
categoryFilter = ":slug"
==
function onStart()
{
// Access categoryFilter property
$catfilter = ???
...
}
==
creg33270
I can only access the plugin properties outside the function over twig like this:
{{ dump(this.page.components['blogPosts'].properties['postsPerPage']) }}
neilcarpenter
You can access it like this....
$this->blogPosts->postsPerPage;
Where blogPosts
is the alias of the component you're trying to access.
(In case you have multiple instances of a component on a page)
So if you gave your blogPosts an alias of newsArticles
you would access it with...
$this->newsArticles->postsPerPage
Last updated
1-4 of 4