Prepare an array of field values
@param array $list
164168
protected function prepareListFieldValue(array &$list)
    {
        foreach ($list as &$item) {
            $this->setItemThumb($item, $this->image, array('placeholder' => false));
        }
    }
4465
public function renderValue(string $value, string $list) : void
    {
        /**
         * @var \CsvMigrations\Model\Table\DblistsTable
         */
        $table = $this->loadModel('CsvMigrations.Dblists');
        $this->_createList($list);

        $query = $table->find()
            ->enableHydration(true)
            ->where([$table->aliasField('name') => $list])
            ->matching('DblistItems', function ($q) use ($value) {
                return $q->where(['DblistItems.value' => $value]);
            });

        try {
            $entity = $query->firstOrFail();
        } catch (RecordNotFoundException $e) {
            $this->set('data', '' !== trim($value) ? sprintf(ListRenderer::VALUE_NOT_FOUND_HTML, $value) : '');

            return;
        }

        Assert::isInstanceOf($entity, EntityInterface::class);
        $this->set('data', $entity->get('_matchingData')['DblistItems']->get('name'));
    }
764586
public function setList(array $list)
    {
        foreach ($list as $item) {
            $this->checkType(TypeDefinitionInterface::class, $item);
        }
        $this->list = $list;
    }
114680
def prepend_field(self, field_name, list_value):
    """"""
    return self._single_list_field_operation(field_name, list_value, prepend=True)
227540
public function readForOnly($list)
	{
		$this->read();

		$files = $this->getFiles();

		$filtered = [];

		foreach ($this->getList($list) as $list)
		{
			$list = trim($list);
			
			if (in_array($list, $files) || in_array($list . '.php', $files))
			{
				$filtered[] = $list;
			}
		}

		$this->setFiles($filtered);
	}
380904
public function formatValueList(array $list) {
		$string = '';
		foreach( $list as $i => $v ) {
			$string .= ($i ? ',' : '').$this->formatValue($v);
		}
		return $string;
	}
1109140
protected function processList(array $list): string
	{
		$processedArray = [];
		foreach ($list as $key => $value) {
			// Numeric list keys are not appended to the path.
			$processedArray[$key] = is_array($value)
				? $this->processItem($value)
				: $this->convertValue($value);
		}

		return implode('|', $processedArray);
	}
1348540
protected function limitList(array &$list, array $limit)
    {
        list($from, $to) = $limit;
        $list = array_slice($list, $from, $to, true);
    }
599100
protected function fill_collections($list=""){
		$options = array();
		foreach ($this->options as $k=>$v) { 
			$name = $k;
			$option="\"{$name}\":[";
			if (!is_string($this->options[$name])){
				$data = json_encode($this->options[$name]->render());
				$option.=substr($data,1,-1);
			} else
				$option.=$this->options[$name];
			$option.="]";
			$options[] = $option;
		}
		$this->extra_output .= implode($this->data_separator, $options);
	}
865960
protected static function prepare_list($list) {
        global $OUTPUT;
        $foldericon = $OUTPUT->image_url(file_folder_icon(24))->out(false);

        // Reset the array keys because non-numeric keys will create an object when converted to JSON.
        $list = array_values($list);

        $len = count($list);
        for ($i = 0; $i < $len; $i++) {
            if (is_object($list[$i])) {
                $file = (array)$list[$i];
                $converttoobject = true;
            } else {
                $file =& $list[$i];
                $converttoobject = false;
            }

            if (isset($file['source'])) {
                $file['sourcekey'] = sha1($file['source'] . self::get_secret_key() . sesskey());
            }

            if (isset($file['size'])) {
                $file['size'] = (int)$file['size'];
                $file['size_f'] = display_size($file['size']);
            }
            if (isset($file['license']) && get_string_manager()->string_exists($file['license'], 'license')) {
                $file['license_f'] = get_string($file['license'], 'license');
            }
            if (isset($file['image_width']) && isset($file['image_height'])) {
                $a = array('width' => $file['image_width'], 'height' => $file['image_height']);
                $file['dimensions'] = get_string('imagesize', 'repository', (object)$a);
            }
            foreach (array('date', 'datemodified', 'datecreated') as $key) {
                if (!isset($file[$key]) && isset($file['date'])) {
                    $file[$key] = $file['date'];
                }
                if (isset($file[$key])) {
                    // must be UNIX timestamp
                    $file[$key] = (int)$file[$key];
                    if (!$file[$key]) {
                        unset($file[$key]);
                    } else {
                        $file[$key.'_f'] = userdate($file[$key], get_string('strftimedatetime', 'langconfig'));
                        $file[$key.'_f_s'] = userdate($file[$key], get_string('strftimedatetimeshort', 'langconfig'));
                    }
                }
            }
            $isfolder = (array_key_exists('children', $file) || (isset($file['type']) && $file['type'] == 'folder'));
            $filename = null;
            if (isset($file['title'])) {
                $filename = $file['title'];
            }
            else if (isset($file['fullname'])) {
                $filename = $file['fullname'];
            }
            if (!isset($file['mimetype']) && !$isfolder && $filename) {
                $file['mimetype'] = get_mimetype_description(array('filename' => $filename));
            }
            if (!isset($file['icon'])) {
                if ($isfolder) {
                    $file['icon'] = $foldericon;
                } else if ($filename) {
                    $file['icon'] = $OUTPUT->image_url(file_extension_icon($filename, 24))->out(false);
                }
            }

            // Recursively loop over children.
            if (isset($file['children'])) {
                $file['children'] = self::prepare_list($file['children']);
            }

            // Convert the array back to an object.
            if ($converttoobject) {
                $list[$i] = (object)$file;
            }
        }
        return $list;
    }
439579
protected function getListFieldValue()
    {
        $conditions = $this->query_filter;
        $conditions['limit'] = $this->data_limit;
        $conditions['field_id'] = $this->data_field['field_id'];

        $list = (array) $this->field_value->getList($conditions);
        $this->prepareListFieldValue($list);
        return $list;
    }
66889
private function setNoProxyList($list)
    {
        if (is_array($list)) {
            $this->proxySettings['no'] = array_map('trim', $list);
            return;
        }

        if (is_string($list) && strpos($list, ',') !== false) {
            $this->proxySettings['no'] = explode(',', $list);
        } elseif (is_string($list) && strpos($list, ' ') !== false) {
            $this->proxySettings['no'] = explode(' ', $list);
        }
        $this->proxySettings['no'] = array_map('trim', $this->proxySettings['no']);
    }
1160570
public function writeAutoload( array $list ) {

    $file = Autoload::FILE;
    if( is_dir( dirname( $file ) ) || mkdir( dirname( $file ), 0777, true ) ) {

      //
      uksort( $list, function ( $a, $b ) {
        return strlen( $b ) - strlen( $a );
      } );

      //
      $content = [];
      foreach( $list as $namespace => $path ) {

        // detect if the path can be relative (then remove the root)
        $is_absolute = substr( $path, 0, strlen( $this->root ) ) != $this->root;
        if( !$is_absolute ) $path = substr( $path, strlen( $this->root ) );

        $count     = substr_count( $namespace, '\\' );
        $namespace = str_replace( [ '\\', "'" ], [ '\\\\', "\\'" ], $namespace );
        $path      = str_replace( [ '\\', "'" ], [ '\\\\', "\\'" ], $path );

        $prefix    = $is_absolute ? "'" : "__DIR__ . '/../";
        $content[] = "  '{$namespace}' => [ {$prefix}{$path}', {$count} ]";
      }

      // 
      file_put_contents( $file, "<?php return [\n" . implode( ",\n", $content ) . "\n];\n" );

      // invalidate opcache
      if( function_exists( 'opcache_invalidate' ) ) {
        opcache_invalidate( $file, true );
      }
    }
  }
493304
protected function toArray( array $list )
	{
		$result = [];

		foreach( $list as $item ) {
			$result[] = (object) $item->toArray( true );
		}

		return $result;
	}
240803
protected static function prepareWhere(array $array, $list)
    {
        if (!is_array($list)) {
            $list = [$list];
        }
        foreach ($list as $v) {
            if (array_key_exists($v, $array)) {
                return $v;
            }
        }

        return null;
    }
364794
public function setItems($list)
    {
        if (!is_array($list)) {
            $this->items = null;

            return;
        }

        $items = [];
        foreach ($list as $index => $element) {
            if ((!is_object($element) || !($element instanceof \ShopgateOrderItem)) && !is_array($element)) {
                unset($list[$index]);
                continue;
            }

            if ($element instanceof \ShopgateOrderItem) {
                $element = $element->toArray();
            }

            $item = $this->itemFactory->create();
            $item->loadArray($element);
            $items[$item->getItemNumber()] = $item;
        }

        $this->items = $items;
    }
302760
protected function prepareListLanguage(array &$list)
    {
        foreach ($list as $id => &$item) {
            $item['file_exists'] = is_file($this->translation->getFile($id));
        }
    }