0
Welcome Guest! Login
0 items Join Now

Access to atom values

  • Access to atom values

    Posted 1 year 4 months ago
    • Server Details (Linux/Windows, Hosting service, etc)xampp windows
      PHP version7.2
      Platform (name and version)gantry 5
      Template/Extension (name and version)helium

      Hello, I need to access the value of some variables stored in a atom but when I try to access it from another particle can't access to the correct values. For example when I try access to
      {% set aaa = gantry.config.get('particles.analytics.enabled') %}
      the value of aaa do not return the correct value stored in the analytics atom. Can anybody help me to understend what I have to do to access the value stored in the atom.
    • Last Edit: 1 year 4 months ago by Paulo Nabais.
    • MrT's Avatar
    • MrT
    • Preeminent Rocketeer
    • Posts: 90172
    • Thanks: 11768
    • Web Designer/Developer

    Re: Access to atom values

    Posted 1 year 4 months ago
    • You can't access variables from one particle/atom from inside of another.

      Regards, Mark.
    • Please search forums before posting. Please make sure your post includes the version of the CMS you are using and a link to the problem. Annotations on screenshots can also be helpful to explain problems/goals. Please use the "secure" tab for confidential information.
    • Damir's Avatar
    • Damir
    • Preeminent Rocketeer
    • Posts: 22449
    • Thanks: 2672
    • Web Developer

    Re: Access to atom values

    Posted 1 year 4 months ago
  • Re: Access to atom values

    Posted 1 year 4 months ago
    • MrT wrote:
      You can't access variables from one particle/atom from inside of another.

      Regards, Mark.

      Hello, but in the documentation of Gantry5 at " docs.gantry.org/gantry5/advanced/creatin...tion-data-using-twig " you can read "Let's say you wanted to pull the variable that is set on another particle. For example, the Branding particle. You can fetch this information using {{ gantry.config.get('particles.branding.css.class') }} which tells Gantry to pull the CSS Class value set in the Branding particle. Doing this will grab the default value, rather than a value set in an individual particle instance from the Layout Manager or Menu Editor." So, I do not understand wy you say that we can not access to the value a variable from another particle.
    • Last Edit: 1 year 4 months ago by Paulo Nabais.
  • Re: Access to atom values

    Posted 1 year 4 months ago
    • Damir wrote:
      I am getting this from the particle:
      {{ dump(gantry.config.get('particles.analytics')) }}
      array(2) {
        ["enabled"]=>
        bool(true)
        ["ua"]=>
        array(3) {
          ["anonym"]=>
          bool(false)
          ["ssl"]=>
          bool(false)
          ["debug"]=>
          bool(false)
        }
      }

      Hello Damir Have you tried to change the state of analytics to disabled? or any other variable?
    • MrT's Avatar
    • MrT
    • Preeminent Rocketeer
    • Posts: 90172
    • Thanks: 11768
    • Web Designer/Developer

    Re: Access to atom values

    Posted 1 year 4 months ago
    • It's not going to work... See the other line in the docs...

      Regards, Mark.
    • Please search forums before posting. Please make sure your post includes the version of the CMS you are using and a link to the problem. Annotations on screenshots can also be helpful to explain problems/goals. Please use the "secure" tab for confidential information.
  • Re: Access to atom values

    Posted 1 year 4 months ago
    • MrT wrote:
      It's not going to work... See the other line in the docs...

      Regards, Mark.

      Thank you Mark, but I do not understand how useful it is to access the default values, I thought that phrase had another intention.

      But there must be some way to access values. If I want to save a common configuration value to multiple instances of a particle I have to put this value in all instances? I can not create an atom like "analyitics" to store a value and use this value of the atom in the other particles instances?

      Best regards, Paulo.
    • MrT's Avatar
    • MrT
    • Preeminent Rocketeer
    • Posts: 90172
    • Thanks: 11768
    • Web Designer/Developer

    Re: Access to atom values

    Posted 1 year 4 months ago
    • That's correct. As far as I am aware you can't do that. You can access gantry variables and values but not other particle instance values. I'd also add that your questions are really developer related rather than anything to do with RocketTheme products so it might be better to ask about this on the Gantry 5 opensource project where like minded developers may be better able to answer your questions than we can here.

      https://gitter.im/gantry/gantry5


      Regards, Mark.
    • The following users have thanked you: Paulo Nabais

    • Please search forums before posting. Please make sure your post includes the version of the CMS you are using and a link to the problem. Annotations on screenshots can also be helpful to explain problems/goals. Please use the "secure" tab for confidential information.

Time to create page: 0.098 seconds