args = $args;
}
function transform($posts) {
$results = array_map(function($post) {
return $this->getPostTitle($post);
}, $posts);
return [
$this->wrap([
'type' => 'text',
'text' => '
' . implode('', $results) . '
',
])];
}
private function wrap($block) {
return LayoutHelper::row([
LayoutHelper::col([$block]),
]);
}
private function getPostTitle($post) {
$title = $post->post_title;
$alignment = $this->args['titleAlignment'];
$alignment = (in_array($alignment, ['left', 'right', 'center'])) ? $alignment : 'left';
if ($this->args['titleIsLink']) {
$title = '' . $title . '';
}
return '' . $title . '';
}
}