|
7 | 7 | [](https://codeclimate.com/github/bnomei/kirby-blueprints) |
8 | 8 | [](https://twitter.com/bnomei) |
9 | 9 |
|
10 | | -PHP Class-based Blueprints for Kirby CMS for better type safety and code completion. |
| 10 | +Kirby Ink - PHP Class-based Blueprints for Kirby CMS for better type safety and code completion. |
11 | 11 |
|
12 | 12 | ## Install |
13 | 13 |
|
@@ -473,6 +473,67 @@ Column::make() |
473 | 473 | ]), |
474 | 474 | ``` |
475 | 475 |
|
| 476 | +## Why is it called Ink? |
| 477 | +
|
| 478 | +Because on top of all these `*::make()`-helpers it also introduces a new `Ink::*`-helpers to create a blueprint definition from a PageModel. And because it's short and easy to remember. |
| 479 | + |
| 480 | +```php |
| 481 | +<?php |
| 482 | + |
| 483 | +use ...; |
| 484 | + |
| 485 | +class ElephantPage extends Page |
| 486 | +{ |
| 487 | + use HasInk; |
| 488 | + |
| 489 | + #[ |
| 490 | + Label('Left Ear'), |
| 491 | + Type(FieldTypes::TEXT), |
| 492 | + ] |
| 493 | + public Field $leftEar; |
| 494 | + |
| 495 | + #[ |
| 496 | + Label('Right Ear'), |
| 497 | + Type(FieldTypes::TAGS), |
| 498 | + ] |
| 499 | + public Field $rightEar; |
| 500 | + |
| 501 | + #[ |
| 502 | + Blueprint |
| 503 | + ] |
| 504 | + public static function elephantsBlueprint(): array |
| 505 | + { |
| 506 | + $user = kirby()->user(); |
| 507 | + |
| 508 | + return Ink::page( |
| 509 | + title: 'Elephant', |
| 510 | + columns: [ |
| 511 | + Ink::column(2/3)->fields([ |
| 512 | + 'leftEar' => true, |
| 513 | + Ink::field(FieldTypes::BLOCKS) |
| 514 | + ->id('trunk') |
| 515 | + ->label('Trunk Blocks') |
| 516 | + ->property('empty', '🐘'), |
| 517 | + 'rightEar' => true, |
| 518 | + ]), |
| 519 | + Ink::column(1/3)->sections([ |
| 520 | + Ink::section(SectionTypes::FIELDS)->fields([ |
| 521 | + Ink::field('text', label: 'User') |
| 522 | + ->property('placeholder', $user?->email().' ('.$user?->role().')'), |
| 523 | + ]), |
| 524 | + Ink::section(SectionTypes::INFO) |
| 525 | + ->label('Kirby Version') |
| 526 | + ->theme('info') |
| 527 | + ->text(kirby()->version()), |
| 528 | + Ink::section(SectionTypes::FILES) |
| 529 | + ->label('Files'), |
| 530 | + ]), |
| 531 | + ], |
| 532 | + )->toArray(); |
| 533 | + } |
| 534 | +} |
| 535 | +``` |
| 536 | + |
476 | 537 | ## Disclaimer |
477 | 538 |
|
478 | 539 | This plugin is provided "as is" with no guarantee. Use it at your own risk and always test it yourself before using it in a production environment. If you find any issues, please [create a new issue](https://github.com/bnomei/kirby-blueprints/issues/new). |
|
0 commit comments