Thank you for your answers! As I wrote, I followed these instructions. So I made a folder fields
in blueprints
.
In this folder I wrote the file imageselect.yml
with following content:
# /site/blueprints/fields/imageselect.yml
label: Select an image
type: select
options: images
In the blueprints/home.yml
I wrote this:
# /site/blueprints/home.yml
title: Home
pages: false
fields:
title:
label: Title
type: text
intro:
label: Intro
type: textarea
text:
type: textarea
pic:
type: imageselect
If I go to the panel on home
I get this Error:
The imageselect field is missing. Please add it to your installed fields or remove it from your blueprint
I did not change anything on the starterkit, except the Rewritebase in .htaccess
So the select.php
is the original file from starterkit:
# /panel/app/fields/select
<?php
class SelectField extends BaseField {
public function __construct() {
$this->type = 'select';
$this->options = array();
$this->icon = 'chevron-down';
}
public function options() {
return FieldOptions::build($this);
}
public function option($value, $text, $selected = false) {
return new Brick('option', $this->i18n($text), array(
'value' => $value,
'selected' => $selected
));
}
public function input() {
$select = new Brick('select');
$select->addClass('selectbox');
$select->attr(array(
'name' => $this->name(),
'id' => $this->id(),
'required' => $this->required(),
'autocomplete' => $this->autocomplete(),
'autofocus' => $this->autofocus(),
'readonly' => $this->readonly(),
'disabled' => $this->disabled(),
));
$default = $this->default();
if(!$this->required()) {
$select->append($this->option('', '', $this->value() == ''));
}
if($this->readonly()) {
$select->attr('tabindex', '-1');
}
foreach($this->options() as $value => $text) {
$select->append($this->option($value, $text, $this->value() == $value));
}
$inner = new Brick('div');
$inner->addClass('selectbox-wrapper');
$inner->append($select);
$wrapper = new Brick('div');
$wrapper->addClass('input input-with-selectbox');
$wrapper->append($inner);
if($this->readonly()) {
$wrapper->addClass('input-is-readonly');
} else {
$wrapper->attr('data-focus', 'true');
}
return $wrapper;
}
public function validate() {
return array_key_exists($this->value(), $this->options());
}
}
Hope, these Informations are a good startpoint.
Thank You!