Initial commit
This commit is contained in:
commit
65e0da7e11
1397 changed files with 596542 additions and 0 deletions
75
site/OFF_plugins/field-engineer/fields/engineer/engineer.php
Normal file
75
site/OFF_plugins/field-engineer/fields/engineer/engineer.php
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
class EngineerField extends BaseField {
|
||||
static public $assets;
|
||||
|
||||
public function __construct() {
|
||||
$this->Presentation = new \Engineer\Presentation();
|
||||
$this->PresentationArray = new \Engineer\PresentationArray();
|
||||
$this->Outline = new \Engineer\Outline();
|
||||
$this->Field = new \Engineer\Field();
|
||||
}
|
||||
|
||||
public function presentation() {
|
||||
return $this->Presentation;
|
||||
}
|
||||
|
||||
public function presentationArray() {
|
||||
return $this->PresentationArray;
|
||||
}
|
||||
|
||||
public function outline() {
|
||||
return $this->Outline;
|
||||
}
|
||||
|
||||
public function setField() {
|
||||
return $this->Field();
|
||||
}
|
||||
|
||||
public function input() {
|
||||
$blueprint = $this->page->blueprint()->yaml['fields'][$this->name];
|
||||
|
||||
$outline = $this->outline()->set($blueprint, $this->name);
|
||||
$presentation_array = $this->presentationArray()->prepare($blueprint);
|
||||
|
||||
$presentation = $this->presentation()->set($presentation_array, yaml($this->value));
|
||||
unset($presentation['label']);
|
||||
|
||||
kirby()->set('option', 'egr.count', 0);
|
||||
|
||||
$args['args'] = array(
|
||||
'instance' => $this,
|
||||
'outline' => array(
|
||||
'instance' => $this,
|
||||
'outline' => $outline
|
||||
),
|
||||
'presentation' => array(
|
||||
'instance' => $this,
|
||||
'presentation' => $presentation,
|
||||
'field_name' => $this->name,
|
||||
'id' => $this->name
|
||||
),
|
||||
);
|
||||
|
||||
$template = egr::snippet('template', $args);
|
||||
return $template;
|
||||
}
|
||||
|
||||
public function element() {
|
||||
$element = parent::element();
|
||||
$element->data('field', 'engineer');
|
||||
$element->data('name', $this->name);
|
||||
return $element;
|
||||
}
|
||||
}
|
||||
|
||||
if(c::get('engineer.debug', false)) {
|
||||
EngineerField::$assets = array(
|
||||
'css' => array('style.css'),
|
||||
'js' => array('script.js'),
|
||||
);
|
||||
} else {
|
||||
EngineerField::$assets = array(
|
||||
'css' => array('style.min.css'),
|
||||
'js' => array('script.min.js'),
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue