private function createTopHeadingRow(array $rows)
    {
        $elements = array();

        if ($this->options[self::GRID_PARAM_BATCH] === true) {
            $checkbox = Element::checkbox(null, false, array(), false);
            $elements[] = $this->createColumn(null, $checkbox);
        }

        foreach ($rows as $row) {
            // Ignore if configuration for current column isn't provided
            if (!$this->hasColumnConfiguration($row[self::GRID_PARAM_COLUMN])) {
                continue;
            }

            $column = isset($row[self::GRID_PARAM_COLUMN]) ? $row[self::GRID_PARAM_COLUMN] : null;
            // Use label if provided explicitly, otherwise use normalized column name as a fallback
            $label = isset($row[self::GRID_PARAM_LABEL]) ? $row[self::GRID_PARAM_LABEL] : TextUtils::normalizeColumn($row[self::GRID_PARAM_COLUMN]);

            // If sorting isn't defined, then assume that it's true by default
            if (!isset($row[self::GRID_PARAM_SORTING]) && isset($row[self::GRID_PARAM_FILTER]) && $row[self::GRID_PARAM_FILTER] == true) {
                $row[self::GRID_PARAM_SORTING] = true;
            } else {
                $row[self::GRID_PARAM_SORTING] = false;
            }

            // If translation isn't defined, assume true by default
            if (!isset($row[self::GRID_PARAM_TRANSLATE])) {
                $row[self::GRID_PARAM_TRANSLATE] = true;
            }

            // Translate if required
            if ($row[self::GRID_PARAM_TRANSLATE] == true && $this->hasTranslator()) {
                $label = $this->translator->translate($label);
            }

            // Creating a link or raw text here
            if ($row[self::GRID_PARAM_SORTING] === true) {
                // Use explicit key parameter for sorting if provided
                $inputName = isset($row[self::GRID_PARAM_NAME]) ? $row[self::GRID_PARAM_NAME] : $column;

                $elements[] = $this->createHeader($this->createHeaderLink($inputName, ' ' . $label));
            } else {
                $elements[] = $this->createTextHeader($label);
            }
        }

        if ($this->hasActions()) {
            $actionLabel = 'Actions';
            $actionLabel = $this->hasTranslator() ? $this->translator->translate($actionLabel) : $actionLabel;
            $elements[] = $this->createTextHeader($actionLabel);
        }

        return $this->createTableRow($elements);
    }