public function testPrototypeGetter() { $node = Node::from(array('constructor' => 'articles')); $node->metas = array('image_id' => 1); $this->assertInstanceOf(__NAMESPACE__ . '\\NodeRelation', $node->image); }
protected function render_record(\Icybee\Modules\Nodes\Node $record, $selected, array $range, array $options) { $nid = $record->nid; return $record->thumbnail('$icon-m')->to_element(array('alt' => $record->alt, 'title' => $record->title, 'data-nid' => $nid, 'data-popover-image' => $record->thumbnail('$popover')->url, 'data-popover-target' => '.widget-adjust-image', 'data-title' => $record->title, 'data-path' => $record->path)); }
/** * The {@link $excerpt} property is unset if it is empty, until it is defined again, the * {@link get_excerpt()} getter provides a default value made from the {@link $body} * property. * * @param Model|string $model Defaults to "contents". */ public function __construct($model = 'contents') { if (empty($this->excerpt)) { unset($this->excerpt); } parent::__construct($model); }
/** * Replaces `type` value by "page" and `id` value by "page-id-<nid>". * * The following class names are added: * * - `slug`: "page-slug-<slug>" * - `home`: true if the page is the home page. * - `active`: true if the page is the active page. * - `trail`: true if the page is in the breadcrumb trail. * - `node-id`: "node-id-<nid>" if the page displays a node. * - `node-constructor`: "node-constructor-<normalized_constructor>" if the page displays a node. * - `template`: "template-<name>" the name of the page's template, without its extension. */ protected function get_css_class_names() { $names = array_merge(parent::get_css_class_names(), array('type' => 'page', 'id' => 'page-id-' . $this->nid, 'slug' => 'page-slug-' . $this->slug, 'home' => $this->home->nid == $this->nid, 'active' => $this->is_active, 'trail' => $this->is_trail, 'template' => 'template-' . preg_replace('#\\.(html|php)$#', '', $this->template), 'has-children' => count($this->navigation_children) != 0)); if (isset($this->node)) { $node = $this->node; $names['node-id'] = 'node-id-' . $node->nid; $names['node-constructor'] = 'node-constructor-' . \ICanBoogie\normalize($node->constructor); } return $names; }
public function test_uuid() { $node = new Node(); $node->title = "example"; $this->assertNull($node->uuid); $node->save(); $this->assertNotNull($node->uuid); }