← Back to Cumulus Core Support
Hello! First question: Wanted to ask how would you access in fronted current cluster details?
Second question: How in my component I can access cluster details, where are stored cluster details or I should get cluster based in URL parameter?
Hello,
CumulusGuard
in it's onRun
method push to page two variables:
cluster
which contains current cluster's slugclusterData
which contains array of the current cluster data.
Since version 1.1.13 active cluster slug is also pushed to session and cookie as cumulus_clusterslug
by CumulusGuard component, but by design the cluster was designed to be get using url param.
What is more if you want to get current cluster's data somewhere in your code, then you may like the method from clusterRepository
:
use Initbiz\CumulusCore\Repositories\ClusterRepository;
...
$clusterSlug = $this->property('clusterSlug');
$clusterRepository = new ClusterRepository($clusterSlug);
$clusterData = $clusterRepository->getCurrentCluster();
InIT.biz said:
Hello,
CumulusGuard
in it'sonRun
method push to page two variables:
cluster
which contains current cluster's slugclusterData
which contains array of the current cluster data.Since version 1.1.13 active cluster slug is also pushed to session and cookie as
cumulus_clusterslug
by CumulusGuard component, but by design the cluster was designed to be get using url param.What is more if you want to get current cluster's data somewhere in your code, then you may like the method from
clusterRepository
:use Initbiz\CumulusCore\Repositories\ClusterRepository; ... $clusterSlug = $this->property('clusterSlug'); $clusterRepository = new ClusterRepository($clusterSlug); $clusterData = $clusterRepository->getCurrentCluster();
Thanks it worked ;)
1-3 of 3