chris  
          
              
                October 16, 2024,  8:17am
               
              #1 
           
         
        
          Referring to the documentiaon here 
{% put activeNav = 'home' %}
not with a string but with an array object like this in my pages
{% put pageTitles = {
      '0':  trans("Dashboard") ,
      '1':  trans("Products") ,
      '2':  product.name ,
    }
%}
so far so good, no error.
then inside the layout, I am trying to get the placeholder value like this
{% set breadcrumbs = placeholder('pageTitles') %}
And the page raises an exception
An exception has been thrown during the rendering of a template ("Array to string conversion").
is there another way to pass an object from the page to the layout other then using a placeholder ?
         
        
           
         
            
       
      
        
          
          
            daft  
          
              
                October 17, 2024,  5:39am
               
              #2 
           
         
        
          Yes, you’re right; there’s no reason this shouldn’t be appropriate. The error is caused mainly by the assumption that it will store content (a string). You know what they say about assumptions!
A fix has been included here:
  
  
    
  
  
    
    
      
        committed 05:37AM - 17 Oct 24 UTC 
      
      
      
     
   
 
  
    Eg:
{% put pageTitles = {
      '0':  "Dashboard",
      '1':  "Products",
    …   '2':  product.name,
    }
%} 
   
   
  
    
    
  
  
 
         
        
           1 Like 
         
         
            
       
      
        
          
          
            chris  
          
              
                October 21, 2024,  8:41pm
               
              #3 
           
         
        
          I just upodated with the latest v.3.7.3
and I still have the array to string conversion exception in my theme
here is my code
inside the page:
{%
  put pageTitles = {
    "0":  {
      "title" : trans_me("Dashboard"),
      "link" : "dashboard" | page
    },
    "1":  {
      "title": trans_me("Products"),
      "link": "product/products" | page
    },
    "2":  {
      "title" : product.name,
      "link" : "product/product" | page({'course':product.slug, 'activeTab':'lessons'}),
      },
    "3":  {
      "title" : trans_me("Edit", {"label" :module.name }),
      "link" : "product/product" | page({'course':product.slug, 'activeTab':'lessons'}),
      },
  }
%}
inside the layout
{% set breadcrumbs = placeholder('pageTitles') %}
 
        
           
         
            
       
      
        
          
          
            daft  
          
              
                October 23, 2024,  4:26am
               
              #4 
           
         
        
          Can you check that you have the latest october/rain package.
composer show october/rain
 
        
           
         
            
       
      
        
          
          
            chris  
          
              
                October 23, 2024,  6:21am
               
              #5 
           
         
        
          the command returns the following:
name     : october/rain
descrip. : October Rain Library
keywords : cms, october, rain
versions : * v3.7.3
type     : library
homepage : http://octobercms.com
source   : [git] https://github.com/octobercms/library.git 21c3571a4832facaf60e0c87ce7c330030305f64
dist     : [zip] https://api.github.com/repos/octobercms/library/zipball/21c3571a4832facaf60e0c87ce7c330030305f64 21c3571a4832facaf60e0c87ce7c330030305f64
path     : /Users/christophevidal/Sites/oc-christophevidal/vendor/october/rain
names    : october/rain
support
source : https://github.com/octobercms/library/tree/v3.7.3
autoload
files
psr-4
October\Rain\ => src/
October\Contracts\ => contracts/
classmap
helpers/
requires
composer/composer ^2.0.0
doctrine/dbal ^2.13.3|^3.1.4
guzzlehttp/guzzle ^7.5
laravel/tinker ~2.0
league/csv ~9.1
linkorb/jsmin-php ~1.0
nesbot/carbon ^2.0
php ^8.0.2
scssphp/scssphp ~1.0
symfony/yaml ^6.0
twig/twig ~3.0
wikimedia/less.php ~4.1
requires (dev)
laravel/framework ^9.0|^10.0
meyfa/phpunit-assert-gd ^2.0.0|^3.0.0
phpbench/phpbench ^1.2
phpunit/phpunit ^8.0|^9.0|^10.0
 
        
           
         
            
       
      
        
          
          
            daft  
          
              
                October 24, 2024, 10:04pm
               
              #6 
           
         
        
          Ok, interesting. This example below works, but yours doesn’t…
{% put pageTitles = {
      '0':  "Dashboard"|_,
      '1':  "Products"|_,
      '2':  product.name,
    }
%}
{% set breadcrumbs = placeholder('pageTitles') %}
{{ d(breadcrumbs) }}
 
        
           
         
            
       
      
        
          
          
            daft  
          
              
                October 24, 2024, 10:07pm
               
              #7 
           
         
        
          A patch for this has been included in v3.7.3
         
        
           1 Like 
         
         
            
       
      
        
          
          
            chris  
          
              
                October 29, 2024, 10:14am
               
              #8 
           
         
        
          yes this is working
{%
  put pageTitles = {
    '0':  trans_me("Dashboard"),
    '1':  trans_me("Products"),
    '2':  trans_me("Edit", {"label": product.name} ),
  }
%}
but not this
{%
  put pageTitles = {
    '0':  {
      'title':trans_me("Dashboard"),
      }
    '1':  {
      'title':trans_me("Products"),
      }
    '2':  {
      'title':trans_me("Edit", {"label": product.name} ),
      }
  }
%}
difference being in that there is a second level in the json strcuture (title attribute)
         
        
           
         
            
       
      
        
          
          
            chris  
          
              
                October 30, 2024,  1:11pm
               
              #10 
           
         
        
          it works like a charm ! well done and thanks @daft 
         
        
           1 Like