eZ\Publish\Core\REST\Common\Output\Generator\Xml\FieldTypeHashGenerator::generateKeyAttribute PHP Method

generateKeyAttribute() protected method

Generates a key attribute with $key as the value, if $key is not null.
protected generateKeyAttribute ( XmlWriter $writer, string | null $key = null )
$writer XmlWriter
$key string | null
    protected function generateKeyAttribute(\XmlWriter $writer, $key = null)
    {
        if ($key !== null) {
            $writer->startAttribute('key');
            $writer->text($key);
            $writer->endAttribute();
        }
    }