RainLab\Pages\Classes\Page::setPlaceholdersAttribute PHP Метод

setPlaceholdersAttribute() публичный Метод

Takes an array of placeholder data (key: code, value: content) and renders it as a single string of Twig markup against the "code" attribute.
public setPlaceholdersAttribute ( array $value ) : void
$value array
Результат void
    public function setPlaceholdersAttribute($value)
    {
        if (!is_array($value)) {
            return;
        }
        // Prune any attempt at setting a placeholder that
        // is not actually defined by this pages layout.
        $placeholders = array_intersect_key($value, $this->listLayoutPlaceholders());
        $result = '';
        foreach ($placeholders as $code => $content) {
            if (!strlen(trim($content))) {
                continue;
            }
            $result .= '{% put ' . $code . ' %}' . PHP_EOL;
            $result .= $content . PHP_EOL;
            $result .= '{% endput %}' . PHP_EOL;
            $result .= PHP_EOL;
        }
        $this->attributes['code'] = trim($result);
        $this->attributes['placeholders'] = $placeholders;
    }