public static function time($timestamp, $format = 'short', $classes = '') { $brick = new Brick('time'); $brick->datetime = Date::format($timestamp, 'iso'); $brick->text(Date::format($timestamp, $format)); $brick->addClass($classes); return $brick; }
public function alert($alert = null) { if (!is_null($alert)) { $this->alert = $alert; return $this; } if (is_null($this->alert)) { return null; } $message = $this->alert; $alert = new Brick('div'); $alert->addClass('message message-is-alert'); $alert->append(function () use($message) { $content = new Brick('span'); $content->addClass('message-content'); $content->text($message); return $content; }); $alert->append(function () { $toggle = new Brick('span'); $toggle->addClass('message-toggle'); $toggle->html('<i>×</i>'); return $toggle; }); return $alert; }
/** * Get a link that allows to delete the comment. Only available to registered * users. * * @return Brick|string */ public function deleteLink() { // Ensure the current user is allowed to edit the comment if (!$this->exists || !$this->currentUserCan('delete')) { return ''; } $uri = $this->page()->uri(); $hash = $this->page()->hash(); $id = $this->id(); $link = new Brick('a'); $link->attr('href', $this->actionUrl('delete')); $link->data('href', $this->actionUrl('delete', true)); $link->addClass('comment-delete-link js-delete'); $link->text(l('comments.comment.delete', 'Delete')); return $link; }