How is it right to get the chanc components in October CMS?



  • I'm studying the ready draft for October CMS and saw an interesting thing about getting a reference to the product.

    {% partial "product" product=this.controller.vars.data.product %}
    

    In summary: there is flame X with a component Essencewhich produces data for presentation on the product page. In particular, a piece of the code is presented below. $data of this.controller.vars.data.product (variably cleared for visibility and irrelevant):

    public function find()
        $data['product'] = $this->getPreparedProduct($data['id']);                       
        $result = array(
        "type" => "product",
        "data" => $data
        );
    return $result;
    

    The question is: how accurately to obtain data through this.controller.vars.data.product - is that a normal approach or a crutch? Why did I think it shouldn't be that way? $resultwhich is clearly returning somewhere and which can/do be read in a traditional way, why the requested data are derived from a list of variables, I don't understand.

    If you can give me a link to the docks where it's written, I didn't see it on official docks.



  • this.controller.vars.data.product is not necessary to obtain the necessary data, but it is sufficient data.product.


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2