original_string: public function get_instances_data(array $instanceids, bool $returnall = false) : array {
          $result = api::get_instances_fields_data($this->get_fields(), $instanceids);
  
          if (!$returnall) {
              // Filter only by visible fields (list of visible fields may be different for each instance).
              $handler = $this;
              foreach ($instanceids as $instanceid) {
                  $result[$instanceid] = array_filter($result[$instanceid], function(data_controller $d) use ($handler) {
                      return $handler->can_view($d->get_field(), $d->get('instanceid'));
                  });
              }
          }
          return $result;
      }
code: public function get_instances_data(array $instanceids, bool $returnall = false) : array {
          $result = api::get_instances_fields_data($this->get_fields(), $instanceids);
  
          if (!$returnall) {
              // Filter only by visible fields (list of visible fields may be different for each instance).
              $handler = $this;
              foreach ($instanceids as $instanceid) {
                  $result[$instanceid] = array_filter($result[$instanceid], function(data_controller $d) use ($handler) {
                      return $handler->can_view($d->get_field(), $d->get('instanceid'));
                  });
              }
          }
          return $result;
      }
code_tokens: public function get_instances_data ( array $ instanceids , bool $ returnall = false ) : array { $ result = api :: get_instances_fields_data ( $ this -> get_fields ( ) , $ instanceids ) ; if ( ! $ returnall ) { // Filter only by visible fields (list of visible fields may be different for each instance). $ handler = $ this ; foreach ( $ instanceids as $ instanceid ) { $ result [ $ instanceid ] = array_filter ( $ result [ $ instanceid ] , function ( data_controller $ d ) use ( $ handler ) { return $ handler -> can_view ( $ d -> get_field ( ) , $ d -> get ( 'instanceid' ) ) ; } ) ; } } return $ result ; }
docstring: Returns the custom fields values for multiple instances
  
  The caller must check access to the instance itself before invoking this method
  
  The result is an array of data_controller objects
  
  @param int[] $instanceids
  @param bool $returnall return data for all fields (by default only visible fields)
  @return data_controller[][] 2-dimension array, first index is instanceid, second index is fieldid.
  All instanceids and all fieldids are present, some data_controller objects may have 'id', some not.
  In the last case data_controller::get_value() and export_value() functions will return default values.
docstring_tokens: Returns the custom fields values for multiple instances