Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ConsoleSectionOutput.php

function ConsoleSectionOutput::setMaxHeight

Defines a maximum number of lines for this section.

When more lines are added, the section will automatically scroll to the end (i.e. remove the first lines to comply with the max height).

File

vendor/symfony/console/Output/ConsoleSectionOutput.php, line 48

Class

ConsoleSectionOutput
@author Pierre du Plessis <pdples@gmail.com> @author Gabriel Ostrolucký <gabriel.ostrolucky@gmail.com>

Namespace

Symfony\Component\Console\Output

Code

public function setMaxHeight(int $maxHeight) : void {
    // when changing max height, clear output of current section and redraw again with the new height
    $previousMaxHeight = $this->maxHeight;
    $this->maxHeight = $maxHeight;
    $existingContent = $this->popStreamContentUntilCurrentSection($previousMaxHeight ? min($previousMaxHeight, $this->lines) : $this->lines);
    parent::doWrite($this->getVisibleContent(), false);
    parent::doWrite($existingContent, false);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal