class HostingNode in Aegir Objects 7.3
@file The HostingNode class.
Hierarchy
- class \HostingNode uses HostingFieldable
Expanded class hierarchy of HostingNode
File
- classes/
HostingNode.inc, line 6 - The HostingNode class.
View source
class HostingNode {
use HostingFieldable;
// The node object.
protected $node = FALSE;
// Fields to format in line with Aegir standards.
protected $info_fields = [];
function __construct($node) {
$this->node = $node;
}
public function getNid() {
return $this->node->nid;
}
public function getTitle() {
return $this->node->title;
}
public function getLanguage() {
return $this->node->language;
}
public function getNode() {
return $this->node;
}
/**
* Alter the display of a node.
*/
public function nodeView() {
foreach ($this
->getInfoFields() as $field) {
$this
->fixNodeFieldDisplay($field);
}
}
protected function getInfoFields() {
return $this->info_fields;
}
/**
* Display a field as an Aegir-themed 'info' item.
*/
public function fixNodeFieldDisplay($field) {
if (isset($this->node->content[$field])) {
$this->node->content['info'][$field] = array(
'#type' => 'item',
'#title' => $this->node->content[$field]['#title'],
'#markup' => $this->node->content[$field][0]['#markup'],
);
unset($this->node->content[$field]);
}
}
/**
* Save the node.
*/
public function save() {
$this->node = node_submit($this->node);
node_save($this->node);
return $this->node->nid;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
HostingFieldable:: |
public | function | Return the target of an entityreference field. | |
HostingFieldable:: |
public | function | Return the value of a field. | |
HostingFieldable:: |
public | function | ||
HostingFieldable:: |
public | function | Return the target of an entityreference field. | |
HostingFieldable:: |
public | function | Set the value of a field. | |
HostingFieldable:: |
public | function | Set the value of a property. | |
HostingNode:: |
protected | property | ||
HostingNode:: |
protected | property | ||
HostingNode:: |
public | function | Display a field as an Aegir-themed 'info' item. | |
HostingNode:: |
protected | function | ||
HostingNode:: |
public | function | ||
HostingNode:: |
public | function | ||
HostingNode:: |
public | function | ||
HostingNode:: |
public | function | ||
HostingNode:: |
public | function | Alter the display of a node. | |
HostingNode:: |
public | function | Save the node. | |
HostingNode:: |
function |