Layer

This document is about how to set up and use a Layer object.

First steps

Set up a Layer object like that:

<?php 

use IDML\Content\Layer;

$layer = new Layer(); 

If you want to set your own unique identifier, set up the Image like that: new Layer('UniqueName');

Every layer needs to be added into the Designmap:

<?php

use IDML\Content\DesignMap;

$designMap = new DesignMap();
$designMap->addLayer($layer);

Color

Layers may have different colors when working in InDesign. Add a color from the Color Enum like that:

<?php

use IDML\Content\Enum\Layer\Color;

$layer->addColor(Color::OLIVEGREEN());

Placing objects into layers

When working with layers in InDesign the logic is to place an object into a layer. Our logic is different here: you need to tell an object to which layer it belongs.

<?php

$myRectangle = new Rectangle();
$myRectangle->setItemLayer($layer);