You are here

public function YAMLExporter::compile in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/aklump/loft_data_grids/src/AKlump/LoftDataGrids/YAMLExporter.php \AKlump\LoftDataGrids\YAMLExporter::compile()

Build the string content of $this->output and return $this for chaining.

Parameters

mixed $page_id: (Optional) Defaults to NULL. Set this to only compile a single page.

Return value

$this

Overrides ExporterInterface::compile

File

vendor/aklump/loft_data_grids/src/AKlump/LoftDataGrids/YAMLExporter.php, line 32

Class

YAMLExporter
Class YAMLExporter

Namespace

AKlump\LoftDataGrids

Code

public function compile($page_id = null) {
  $pages = $this
    ->getDataAsTransformedArray();
  if (!is_null($page_id) && array_key_exists($page_id, $pages)) {
    $pages = $pages[$page_id];
  }
  $this->output = Yaml::dump($pages);
  return $this;
}