Callback lazy builder for parametrs block.

@param [array] $values
@return array
763970
public function parametrsBlock($id) {
    $databaseSendOrder = \Drupal::service('site_orders.database');
    $site_commerce = \Drupal::entityTypeManager()->getStorage('site_commerce')->load($id);
    $items = $site_commerce->get('field_parametrs')->getValue();
    $values = [];

    foreach ($items as $delta => $item) {
      $item = (object) $item;
      $hasParametrInCart = $databaseSendOrder->hasPositionInCart('site_commerce_parametr', $id, $delta);

      // Если передан объект товара.
      if ($item->target_id) {
        $position = \Drupal::entityTypeManager()->getStorage('site_commerce')->load($item->target_id);

        if ($position) {
          // Формируем стоимость позиции.
          $group = 1;
          $cost = getCostValueForUserPriceGroup($position, $group, FALSE, FALSE);

          $values[$delta] = array(
            'id' => $id,
            'target_id' => $item->target_id,
            'position' => $position,
            'site_commerce' => $site_commerce,
            'name' => $item->name,
            'description' => $item->description,
            'min' => $position->field_quantity->min,
            'unit' => $position->field_quantity->unit,
            'cost' => $cost['value'],
            'currency' => $cost['currency'],
            'select' => $item->select,
            'in_cart' => $hasParametrInCart,
          );
        }
      } else {
        $values[$delta] = array(
          'id' => $id,
          'target_id' => $item->target_id,
          'position' => NULL,
          'site_commerce' => $site_commerce,
          'name' => $item->name,
          'description' => $item->description,
          'min' => $item->min,
          'unit' => $item->unit,
          'cost' => \Drupal::service('kvantstudio.formatter')->price($item->cost),
          'currency' => $item->currency,
          'select' => $item->select,
          'in_cart' => $hasParametrInCart,
        );
      }
    }

    return [
      '#theme' => 'site_commerce_parametrs_default_formatter',
      '#values' => $values,
      '#attached' => array(
        'library' => array(
          'site_commerce/product_parametrs',
          'site_orders/module',
        ),
      ),
    ];
  }
332873
public static function getNonEmptyValues(array $values)
    {
        /*
         * No values?
         * Nothing to do
         */
        if (empty($values)) {
            return null;
        }

        return array_filter($values, function ($value) {
            $nonEmptyScalar = is_scalar($value) && '' !== $value;
            $nonEmptyArray = is_array($value) && !empty($value);

            return $nonEmptyScalar || $nonEmptyArray || is_object($value);
        });
    }
553119
private function loadRequestParameters($values)
    {
        foreach ($values as $param => $value) {
            $this->request->prependParameter($param, $value);
        }
    }
742539
public function addValues($values=array()) {
		return $this->_addOrSetValues($values, function(HtmlTR $row,$_values){$row->addValues($_values);});
	}
924001
public function filter($values)
    {
        if (is_array($values)) {
            foreach ($values as $key => $value) {
                $values[$key] = $this->filterValue($value);
            }
        }

        return $values;
    }
1025845
private function buildSetPart($values)
    {
        $result = [];
        foreach ($values as $columnName => $value) {
            $value = $this->protectExpressionValue($value);
            $result[] = $this->quoteIdentifier($columnName) . ' = ' . $value;
        }

        return implode(', ', $result);
    }
433326
public function getFlatMap(array $values)
	{
		$result = [];
		foreach ($values as $key => $value) {
			self::applyValueProcessors($key, $value);
			$result[$key] = $value;
		}
		return $result;
	}
844873
protected function parseArray(string $values): array
    {
        // PostgreSql arrays represented as strings
        // '{}' - empty array
        // '{scope1}' or '{scope1,scope2}' - non-empty array
        // so it should always start with '{' and end with '}'.
        assert(substr($values, 0, 1) === '{' && substr($values, -1) === '}');

        $parsed = strlen($values) === 2 ? [] : explode(',', substr($values, 1, -1));

        return $parsed;
    }
381291
public function valuesArray($values) {
		if ($values instanceof \ArrayObject)
			$this->value = $values->getArrayCopy();
		elseif (is_object($values))
			$this->value = get_object_vars($values);
		elseif (is_array($values))
			$this->value = $values;
		else
			throw new \InvalidArgumentException("Method 'valuesArray' expected an object or array value");
		
		if (is_numeric(key($this->value))) {
			$this->valueList = $this->value;
			$this->value = null;
		}
		
		return $this;
	}
1126653
public function preparedResults($values)
    {
        $preparedValues = [];

        /* @var $col Col */
        /* @var $field Field */
        foreach ($this->select as $pos => $selectColumn) {
            $col = $selectColumn[0];
            $field = $col->getOutputField();
            $val = ArrayHelper::getValue($values, $pos);
            // first use the inbuilt converters
            try {
                $val = Type::getType(
                    $field->dbType($this->connection)
                )->convertToPHPValue($val, $this->connection->getDatabasePlatform());
            } catch (DBALException $exception) {
            }

            // use the field converters if any were provided by the user.
            $converters = $field->getDbConverters($this->connection);

            if ($converters) {
                foreach ($converters as $converter) {
                    $val = call_user_func($converter, $this->connection, $val, $field);
                }
            }
            $preparedValues[] = $val;
        }

        return $preparedValues;
    }
398813
private function prepareValues($values, callable $valueCallable = null)
    {
        if (is_array($values)) {
            foreach ($values as &$value) {
                if ($valueCallable) {
                    $value = call_user_func_array($valueCallable, [(string) $value]);
                }

                $value = (string) $value;
            }
            unset($value);

            $values = array_values($values);
        } else {
            if ($valueCallable) {
                $values = call_user_func_array($valueCallable, [(string) $values]);
            }

            $values = (string) $values;
        }

        return $values;
    }
988978
private function valuesToFormParameters($values, $parent)
    {
        $ret = array();
        foreach ($values as $key => $value) {
            if (null !== $parent) {
                $keyName = sprintf('%s[%s]', $parent, $key);
            } else {
                $keyName = $key;
            }
            if (is_scalar($value)) {
                $ret[$keyName] = $value;
            } else {
                $ret = array_merge($ret, $this->valuesToFormParameters($value, $keyName));
            }
        }
        return $ret;
    }
929937
public static function genericSetMultiple(array $values)
    {
        $container = static::container();
        foreach ($values as $id => $value) {
            $container->{static::$setMethod}($id, $value);
        }
    }
935419
public function setAutocompleterValues($values)
    {
        if (\is_array($values)) {
            $values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values);

            $callback = static function () use ($values) {
                return $values;
            };
        } elseif ($values instanceof \Traversable) {
            $valueCache = null;
            $callback = static function () use ($values, &$valueCache) {
                return $valueCache ?? $valueCache = iterator_to_array($values, false);
            };
        } elseif (null === $values) {
            $callback = null;
        } else {
            throw new InvalidArgumentException('Autocompleter values can be either an array, "null" or a "Traversable" object.');
        }

        return $this->setAutocompleterCallback($callback);
    }
316674
protected function add(array $values)
    {
        $values =
            $this->dispatchBeforeOperationEvent(
                '\RedKiteLabs\RedKiteCms\RedKiteCmsBundle\Core\Event\Content\Block\BeforeBlockAddingEvent',
                BlockEvents::BEFORE_ADD_BLOCK,
                $values,
                'exception_block_adding_aborted'
            );

        $this->validator->checkEmptyParams($values);
        $requiredParameters = array("PageId" => "", "LanguageId" => "", "SlotName" => "");
        $this->validator->checkRequiredParamsExists($requiredParameters, $values);

        // When the Content is null the dafault text is inserted
        if (!array_key_exists('Content', $values)) {
            $defaults = $this->getDefaultValue();
            if (!is_array($defaults)) {
                $exception = array(
                    'message' => 'exception_method_returns_invalid_value',
                    'parameters' => array(
                        '%className%' => get_class($this),
                    ),
                );
                throw new General\InvalidArgumentTypeException(json_encode($exception));
            }

            $mergedValues = array_merge($values, $defaults);
            $availableOptions = array(
                'Content' => '',
                'InternalJavascript' => '',
                'ExternalJavascript' => '',
                'InternalStylesheet' => '',
                'ExternalStylesheet' => '',
            );
            $this->validator->checkOnceValidParamExists($availableOptions, $mergedValues);
            $values = $mergedValues;
        }

        try {
            $this->blockRepository->startTransaction();

            // Saves the content
            if (null === $this->alBlock) {
                $className = $this->blockRepository->getRepositoryObjectClassName();
                $this->alBlock = new $className();
            }

            $values = $this->checkCreatedAt($values);
            $result = $this->blockRepository
                    ->setRepositoryObject($this->alBlock)
                    ->save($values);
            if (false !== $result) {
                $this->blockRepository->commit();
                $this->eventsHandler
                     ->createEvent(BlockEvents::AFTER_ADD_BLOCK, '\RedKiteLabs\RedKiteCms\RedKiteCmsBundle\Core\Event\Content\Block\AfterBlockAddedEvent', array($this))
                     ->dispatch();

                return $result;
            }

            $this->blockRepository->rollBack();

            return $result;
        } catch (\Exception $e) {
            if (isset($this->blockRepository) && $this->blockRepository !== null) {
                $this->blockRepository->rollBack();
            }

            throw $e;
        }
    }
1211280
public function setValues($values=array()) {
		return $this->_addOrSetValues($values, function(HtmlTR $row,$_values){$row->setValues($_values);});
	}
312877
public function inputs(array $values = null): array
    {
        if ($values === null) {
            if ($this->all) {
                return $this->input;
            }

            $values = [];
            if ($this->serverRequest->getMethod() !== 'GET') {
                $values = (array) $this->serverRequest->getParsedBody();
            }

            $values += $this->serverRequest->getQueryParams();
            $this->all = true;
        }

        $this->cache = [];

        return $this->input = $values;
    }