0
Welcome Guest! Login
0 items Join Now

SOLVED Help me to modifying the particle infolist (yaml/twig)

  • SOLVED Help me to modifying the particle infolist (yaml/twig)

    Posted 8 years 2 months ago
    • Hello all,

      I'm doing my firsts steps trying to understand particles and modifying one to behave like and evenlist: InfoList

      My only goal now is create 3 fields more: date, time, location into infolist particle and then show it in the layout.

      For doing this, my modifyied yaml:
      (relevant fields, line 58-73)

      name: Info List
      description: Displays Info List
      type: particle
      icon: fa-info-circle
      
      form:
        fields:
          enabled:
            type: input.checkbox
            label: Enabled
            description: Globally enable the particle.
            default: true
      
          class:
            type: input.selectize
            label: CSS Classes
            description: CSS class name for the particle.
      
          title:
            type: input.text
            label: Title
            description: Customize the title text.
            placeholder: Enter title
      
          intro:
            type: textarea.textarea
            label: Intro
            description: Customize the intro text.
            placeholder: Enter short description
      
          cols:
            type: select.select
            label: Grid Column
            description: Select the grid column amount for the list items
            placeholder: 'Select...'
            default: g-1cols
            options:
              g-1cols: 1 Column
              g-2cols: 2 Columns
              g-3cols: 3 Columns
              g-4cols: 4 Columns
              g-5cols: 5 Columns
      
          infolists:
            type: collection.list
            array: true
            label: Info Lists
            description: Create each item to appear in the content row.
            value: title
            ajax: true
      
            fields:
              .title:
                type: input.text
                label: Item Title
                description: Customize the item title text.
                placeholder: Enter item title
              .date:
                type: input.date
                label: Event Date
                description: Set de event date
                placeholder: Enter the event date
              .time:
                type: input.time
                label: Event time
                description: Event time
                placeholder: Enter the event time
              .location:
                type: input.text
                label: Event Location
                description: Location of the event
                placeholder: Enter the event location 
              .image:
                type: input.imagepicker
                label: Image
                description: Select desired image.
              .image:
                type: input.imagepicker
                label: Image
                description: Select desired image.
              .imageloc:
                type: select.select
                label: Image Location
                description: Select the location for the image
                placeholder: 'Select...'
                default: left
                options:
                  left: Left
                  right: Right
              .textstyle:
                type: select.select
                label: Text Style
                description: Select the style for the text
                placeholder: 'Select...'
                default: compact
                options:
                  compact: Compact
                  large: Large
                  bold: Bold
                  header: Header
              .imagestyle:
                type: select.select
                label: Image Style
                description: Select the style for the image
                placeholder: 'Select...'
                default: compact
                options:
                  compact: Compact
                  large: Large
                  browser: Browser
              .desc:
                type: textarea.textarea
                label: Description
                description: Customize the description.
                placeholder: Enter short description
              .tag:
                type: input.text
                label: Tag
                description: Customize the tag
                placeholder: Enter tag
              .subtag:
                type: input.text
                label: Sub Tag
                description: Customize the sub tag
                placeholder: Enter sub tag
              .label:
                type: input.text
                label: Label
                description: Customize the read more label
                placeholder: Enter read more label
              .link:
                type: input.text
                label: Link
                description: Specify the link address.
              .icon:
                type: input.icon
                label: Icon
                description: Specify the read more icon.
              .readmoreclass:
                type: input.selectize
                label: Read More Classes
                description: CSS class name for the read more.
      

      And my twig relevant modification (lines:42-58)


      {% for infolist in particle.infolists %}
            <div class="g-infolist-item {% if infolist.image %} g-infolist-with-img{% endif %}">
              
              {% set imagedata %}
              <div class="g-infolist-item-img g-block{% if infolist.imagestyle == 'compact' %} size-22 hidden-phone{% endif %}{% if infolist.imagestyle == 'browser' %} browser{% endif %} {{ infolist.imageloc|e }}">
                {% if infolist.imagestyle == 'browser' %}
                <div class="browser-wrapper">
                  <div class="browser-bar">
                    <span class="browser-button"></span>
                  </div>
                {% endif %}
                <img src="{{ url(infolist.image)|e }}" alt="{{ url(infolist.title)|e }}" />
                {% if infolist.imagestyle == 'browser' %}
                </div>
                {% endif %}
              </div>
              {% endset %}
              
              {% if infolist.image and infolist.imageloc == 'left' %}
              {{ imagedata }}
              {% endif %}
              
              <div class="g-infolist-item-text{% if infolist.image %} g-block{% endif %} g-infolist-textstyle-{{ infolist.textstyle }}">
                {% if infolist.title %}
                <div class="g-infolist-item-title {% if infolist.textstyle == 'bold' %}g-bold{% endif %}">
                  {% if infolist.textstyle == 'large' %}
                  <div class="g-title-hero">
                  {% endif %} 
                  {% if infolist.link %}
                  <a href="{{ infolist.link|e }}">
                  {% endif %} 
                    {{ infolist.title|raw }}
                  {% if infolist.link %}
                  </a>
                  {% endif %} 
                  {% if infolist.textstyle == 'large' %}
                  </div>
                  {% endif %}
                </div>
                {% endif %}
                  
                {% if infolist.date %}
                  <div class="g-infolist-item-date{% if infolist.image %} g-block{% endif %} g-infolist-textstyle-{{ infolist.textstyle }}">
                  {{ infolist.date|date("m/d/Y") }}
                  </div>
                {% endif %}
                
                {% if infolist.time %}
                  <div class="g-infolist-item-time{% if infolist.image %} g-block{% endif %} g-infolist-textstyle-{{ infolist.textstyle }}">
                   {{ infolist.time|raw }}
                  </div>
                {% endif %}
                
                {% if infolist.location %}
                   <div class="g-infolist-item-location{% if infolist.image %} g-block{% endif %} g-infolist-textstyle-{{ infolist.textstyle }}">
                    {{ infolist.location|raw }}
                   </div>
                {% endif %}
                
                {% if infolist.tag or infolist.subtag %}
                <div class="g-infolist-tags">
                {% if infolist.tag %}
                  {% if infolist.link %}
                  <a href="{{ infolist.link|e }}">
                  {% endif %} 
                    <span class="g-tag">{{ infolist.tag|e }}</span>
                  {% if infolist.link %}
                  </a>
                  {% endif %} 
                {% endif %} 


      Problem? Nothing of my new fields are shown on the page. Only the standar infolist.title. What I'm doing wrong?

      Thanks in advance.

      PS: I'm trying this locally, I can't provide a link to the online source.
    • MrT's Avatar
    • MrT
    • Preeminent Rocketeer
    • Posts: 101084
    • Thanks: 13484
    • Web Designer/Developer

    Re: SOLVED Help me to modifying the particle infolist (yaml/twig)

    Posted 8 years 2 months ago
    • I would need to see your site live to be able to assist.

      Please get your site online and post your URL, superuser id and pswd in the secure tab of your post and I'll have a look for you. Also, Please post your FTP logon, password and FTP URL in the secure area of your post.


      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: SOLVED Help me to modifying the particle infolist (yaml/twig)

    Posted 8 years 2 months ago
    • Hello Mark,

      I've put the site online and I've discovered that in there is working!!!! Then I suspected that the problem was in my local development environment and I've seen that it's not working on PhP 7.0.7 but in 5.4/5.5/7.0 it's working as intended.

      For now I'll assume that it's a problem with this php version. But I will downgrade my php in the local environment to 7.0.0 for not having this issues...

      Thanks anyway!

Time to create page: 0.077 seconds