-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from markhuot/element-queries
first pass
- Loading branch information
Showing
28 changed files
with
268 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace markhuot\keystone\base; | ||
|
||
class ContextBag | ||
{ | ||
public function __construct( | ||
protected array $context | ||
) { | ||
} | ||
|
||
public function __isset($key) | ||
{ | ||
return true; | ||
} | ||
|
||
public function __get($key) | ||
{ | ||
return $this->context[$key] ?? null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace markhuot\keystone\behaviors; | ||
|
||
use yii\base\Behavior; | ||
|
||
class InteractsWithKeystoneBehavior extends Behavior | ||
{ | ||
protected bool $editableInLivePreview = false; | ||
|
||
protected bool $renderWithContext = false; | ||
|
||
public function setEditableInLivePreview(bool $editable = true) | ||
{ | ||
$this->editableInLivePreview = $editable; | ||
|
||
return $this->owner; | ||
} | ||
|
||
public function setRenderWithContext(bool $renderWithContext = true) | ||
{ | ||
$this->renderWithContext = $renderWithContext; | ||
|
||
return $this->owner; | ||
} | ||
|
||
public function isEditableInLivePreview() | ||
{ | ||
return $this->editableInLivePreview; | ||
} | ||
|
||
public function shouldRenderWithContext() | ||
{ | ||
return $this->renderWithContext; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace markhuot\keystone\listeners; | ||
|
||
use craft\events\DefineBehaviorsEvent; | ||
use markhuot\keystone\behaviors\InteractsWithKeystoneBehavior; | ||
|
||
class AttachFieldBehavior | ||
{ | ||
const INTERACTS_WITH_KEYSTONE = 'interactsWithKeystone'; | ||
|
||
public function handle(DefineBehaviorsEvent $event): void | ||
{ | ||
$event->behaviors[self::INTERACTS_WITH_KEYSTONE] = InteractsWithKeystoneBehavior::class; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.