Skip to content

Commit 7644876

Browse files
author
Vital Ozierski
committed
initial commit
0 parents  commit 7644876

20 files changed

+697
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.idea
2+
vendor
3+
composer.lock

composer.json

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "ozitag/tager-backend-fields",
3+
"description": "Tager Fields",
4+
"license": "MIT",
5+
"homepage": "https://github.com/ozitag/tager-backend-core",
6+
"authors": [
7+
{
8+
"name": "Vital Ozierski <[email protected]>",
9+
"email": "[email protected]",
10+
"homepage": "https://ozitag.com",
11+
"role": "Developer"
12+
}
13+
],
14+
"require": {
15+
"ozitag/tager-backend-core": "^1.2",
16+
"ozerich/laravel-filestorage-db": "^0.3"
17+
},
18+
"autoload": {
19+
"psr-4": {
20+
"OZiTAG\\Tager\\Backend\\Fields\\": "src"
21+
}
22+
}
23+
}

src/Enums/FieldType.php

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace OZiTAG\Tager\Backend\Fields\Enums;
4+
5+
use OZiTAG\Tager\Backend\Core\Enums\Enum;
6+
7+
class FieldType extends Enum
8+
{
9+
const String = 'STRING';
10+
const Text = 'TEXT';
11+
const Html = 'HTML';
12+
const Number = 'NUMBER';
13+
const Url = 'URL';
14+
const Color = 'COLOR';
15+
const Date = 'DATE';
16+
const DateTime = 'DATETIME';
17+
const TrueFalse = 'TRUE_FALSE';
18+
const Select = 'SELECT';
19+
const MultiSelect = 'MULTISELECT';
20+
const Image = 'IMAGE';
21+
const Gallery = 'GALLERY';
22+
const File = 'FILE';
23+
const Map = 'MAP';
24+
}

src/FieldFactory.php

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
3+
namespace OZiTAG\Tager\Backend\Fields;
4+
5+
use OZiTAG\Tager\Backend\Fields\Enums\FieldType;
6+
use OZiTAG\Tager\Backend\Fields\Fields\ColorField;
7+
use OZiTAG\Tager\Backend\Fields\Fields\DateField;
8+
use OZiTAG\Tager\Backend\Fields\Fields\DateTimeField;
9+
use OZiTAG\Tager\Backend\Fields\Fields\FileField;
10+
use OZiTAG\Tager\Backend\Fields\Fields\GalleryField;
11+
use OZiTAG\Tager\Backend\Fields\Fields\HtmlField;
12+
use OZiTAG\Tager\Backend\Fields\Fields\ImageField;
13+
use OZiTAG\Tager\Backend\Fields\Fields\MapField;
14+
use OZiTAG\Tager\Backend\Fields\Fields\MultiSelectField;
15+
use OZiTAG\Tager\Backend\Fields\Fields\NumberField;
16+
use OZiTAG\Tager\Backend\Fields\Fields\SelectField;
17+
use OZiTAG\Tager\Backend\Fields\Fields\StringField;
18+
use OZiTAG\Tager\Backend\Fields\Fields\TextField;
19+
use OZiTAG\Tager\Backend\Fields\Fields\TrueFalseField;
20+
use OZiTAG\Tager\Backend\Fields\Fields\UrlField;
21+
22+
class FieldFactory
23+
{
24+
public static function create($fieldType)
25+
{
26+
switch ($fieldType) {
27+
case FieldType::String:
28+
return new StringField();
29+
case FieldType::Text:
30+
return new TextField();
31+
case FieldType::Html:
32+
return new HtmlField();
33+
case FieldType::Number:
34+
return new NumberField();
35+
case FieldType::Url:
36+
return new UrlField();
37+
case FieldType::Color:
38+
return new ColorField();
39+
case FieldType::Date:
40+
return new DateField();
41+
case FieldType::DateTime:
42+
return new DateTimeField();
43+
case FieldType::TrueFalse:
44+
return new TrueFalseField();
45+
case FieldType::Select:
46+
return new SelectField();
47+
case FieldType::MultiSelect:
48+
return new MultiSelectField();
49+
case FieldType::Image:
50+
return new ImageField();
51+
case FieldType::Gallery:
52+
return new GalleryField();
53+
case FieldType::File:
54+
return new FileField();
55+
case FieldType::Map:
56+
return new MapField();
57+
}
58+
}
59+
}

src/Fields/ColorField.php

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
namespace OZiTAG\Tager\Backend\Fields\Fields;
4+
5+
use OZiTAG\Tager\Backend\Fields\Enums\FieldType;
6+
7+
class ColorField extends Field
8+
{
9+
public function getType()
10+
{
11+
return FieldType::Color;
12+
}
13+
14+
public function setValue($value)
15+
{
16+
17+
}
18+
19+
public function getValue()
20+
{
21+
22+
}
23+
24+
public function getAdminJson()
25+
{
26+
27+
}
28+
29+
public function getPublicJson()
30+
{
31+
32+
}
33+
34+
public function getDatabaseValue()
35+
{
36+
37+
}
38+
}

src/Fields/DateField.php

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
namespace OZiTAG\Tager\Backend\Fields\Fields;
4+
5+
use OZiTAG\Tager\Backend\Fields\Enums\FieldType;
6+
7+
class DateField extends Field
8+
{
9+
public function getType()
10+
{
11+
return FieldType::Date;
12+
}
13+
14+
public function setValue($value)
15+
{
16+
17+
}
18+
19+
public function getValue()
20+
{
21+
22+
}
23+
24+
public function getAdminJson()
25+
{
26+
27+
}
28+
29+
public function getPublicJson()
30+
{
31+
32+
}
33+
34+
public function getDatabaseValue()
35+
{
36+
37+
}
38+
}

src/Fields/DateTimeField.php

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
namespace OZiTAG\Tager\Backend\Fields\Fields;
4+
5+
use OZiTAG\Tager\Backend\Fields\Enums\FieldType;
6+
7+
class DateTimeField extends Field
8+
{
9+
public function getType()
10+
{
11+
return FieldType::DateTime;
12+
}
13+
14+
public function setValue($value)
15+
{
16+
17+
}
18+
19+
public function getValue()
20+
{
21+
22+
}
23+
24+
public function getAdminJson()
25+
{
26+
27+
}
28+
29+
public function getPublicJson()
30+
{
31+
32+
}
33+
34+
public function getDatabaseValue()
35+
{
36+
37+
}
38+
}

src/Fields/Field.php

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace OZiTAG\Tager\Backend\Fields\Fields;
4+
5+
abstract class Field
6+
{
7+
abstract function validate();
8+
9+
abstract function getValue();
10+
11+
abstract function getAdminJson();
12+
13+
abstract function getPublicJson();
14+
15+
abstract function getDatabaseValue();
16+
17+
protected $value;
18+
}

src/Fields/FileField.php

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
namespace OZiTAG\Tager\Backend\Fields\Fields;
4+
5+
use OZiTAG\Tager\Backend\Fields\Enums\FieldType;
6+
7+
class FileField extends Field
8+
{
9+
public function getType()
10+
{
11+
return FieldType::File;
12+
}
13+
14+
public function setValue($value)
15+
{
16+
17+
}
18+
19+
public function getValue()
20+
{
21+
22+
}
23+
24+
public function getAdminJson()
25+
{
26+
27+
}
28+
29+
public function getPublicJson()
30+
{
31+
32+
}
33+
34+
public function getDatabaseValue()
35+
{
36+
37+
}
38+
}

src/Fields/GalleryField.php

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
namespace OZiTAG\Tager\Backend\Fields\Fields;
4+
5+
use OZiTAG\Tager\Backend\Fields\Enums\FieldType;
6+
7+
class GalleryField extends Field
8+
{
9+
public function getType()
10+
{
11+
return FieldType::Gallery;
12+
}
13+
14+
public function setValue($value)
15+
{
16+
17+
}
18+
19+
public function getValue()
20+
{
21+
22+
}
23+
24+
public function getAdminJson()
25+
{
26+
27+
}
28+
29+
public function getPublicJson()
30+
{
31+
32+
}
33+
34+
public function getDatabaseValue()
35+
{
36+
37+
}
38+
}

src/Fields/HtmlField.php

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
namespace OZiTAG\Tager\Backend\Fields\Fields;
4+
5+
use OZiTAG\Tager\Backend\Fields\Enums\FieldType;
6+
7+
class HtmlField extends Field
8+
{
9+
public function getType()
10+
{
11+
return FieldType::Text;
12+
}
13+
14+
public function setValue($value)
15+
{
16+
17+
}
18+
19+
public function getValue()
20+
{
21+
22+
}
23+
24+
public function getAdminJson()
25+
{
26+
27+
}
28+
29+
public function getPublicJson()
30+
{
31+
32+
}
33+
34+
public function getDatabaseValue()
35+
{
36+
37+
}
38+
}

0 commit comments

Comments
 (0)