method textValueOptions documentation in bbn\Appui\Option
Returns an option's children array of id and text in a user-defined indexed array
Example
X::dump($opt->textValueOptions(12, 'title'));
/* value comes from the default argument
array [
  ['title' => "My option 21", 'value' =>  21],
  ['title' => "My option 22", 'value' =>  22],
  ['title' => "My option 25", 'value' =>  25],
  ['title' => "My option 27", 'value' =>  27]
]
function($id, string $text = 'text', string $value = 'value')
  {
    $res = [];
    if ($opts = $this->fullOptions($id)) {
      $cfg = $this->getCfg($id) ?: [];
      $i   = 0;
      foreach ($opts as $k => $o) {
        if (!isset($is_array)) {
          $is_array = \is_array($o);
        }
        $res[$i] = [
          $text => $is_array ? $o[$this->fields['text']] : $o,
          $value => $is_array ? $o[$this->fields['id']] : $k
        ];
        if (!empty($cfg['show_code'])) {
          $res[$i][$this->fields['code']] = $o[$this->fields['code']];
        }
        /*
        if ( !empty($cfg['schema']) ){
          if ( \is_string($cfg['schema']) ){
            $cfg['schema'] = json_decode($cfg['schema'], true);
          }
          foreach ( $cfg['schema'] as $s ){
            if ( !empty($s['field']) ){
              $res[$i][$s['field']] = $o[$s['field']] ?? null;
            }
          }
        }
        */
        $i++;
      }
    }
    return $res;
  }
  Returns an option's children array of id and text in a user-defined indexed array BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
  
  
    
    
      
        
        
      
    
    
    
      
      
      
      
      
        
          
          
          
          
          
          
          
          
            
              
                
              
            
            
              
              This website uses cookies to ensure you get the best experience on our website.                
                
              
              
                
                
              
             
           
          
          
          
            
            © 2011-2025 
BBN Solutions