-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
400 additions
and
149 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,5 @@ | |
|
||
abstract class Action extends SavableComponent implements ActionInterface | ||
{ | ||
|
||
public ?string $uid = 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 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,34 @@ | ||
<?php | ||
|
||
namespace panlatent\craft\actions\abstract; | ||
|
||
class ConditionAction extends Action | ||
{ | ||
public function __construct(private readonly ActionInterface $action, $config = []) | ||
{ | ||
parent::__construct($config); | ||
} | ||
|
||
public function getConditions(): array | ||
{ | ||
return []; | ||
} | ||
|
||
public function getAction(): ActionInterface | ||
{ | ||
return $this->action; | ||
} | ||
|
||
public function validateConditions(): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function execute(ContextInterface $context): bool | ||
{ | ||
|
||
|
||
|
||
return $this->action->execute($context); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -4,5 +4,4 @@ | |
|
||
interface TriggerInterface | ||
{ | ||
public function handle(): bool; | ||
} |
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,61 @@ | ||
<?php | ||
|
||
namespace panlatent\schedule\actions; | ||
|
||
use Craft; | ||
use craft\base\ElementInterface; | ||
use craft\elements\Entry; | ||
use panlatent\craft\actions\abstract\Action; | ||
use panlatent\craft\actions\abstract\ContextInterface; | ||
|
||
class ElementAction extends Action | ||
{ | ||
public string $elementType = Entry::class; | ||
|
||
public ?string $elementAction = null; | ||
|
||
public $query; | ||
|
||
public function execute(ContextInterface $context): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function getSettingsHtml(): ?string | ||
{ | ||
$elementTypes = Craft::$app->getElements()->getAllElementTypes(); | ||
|
||
$elementTypeOptions = []; | ||
$allElementActionOptions = []; | ||
$allElementSourceOptions = []; | ||
foreach ($elementTypes as $elementType) { | ||
/** @var ElementInterface|string $elementType */ | ||
$elementTypeOptions[] = ['label' => $elementType::displayName(), 'value' => $elementType]; | ||
foreach ($elementType::actions('*') as $action) { | ||
$allElementActionOptions[$elementType][] = [ | ||
'label' => $action['label'] ?? $action::displayName(), | ||
'value' => $action['type'] ?? $action, | ||
]; | ||
} | ||
|
||
$allElementSourceOptions[$elementType] = []; | ||
foreach($elementType::sources('index') as $source) { | ||
if (isset($source['heading'])) { | ||
continue; | ||
} | ||
$allElementSourceOptions[$elementType][] = [ | ||
'label' => $source['label'], | ||
'value' => $source['key'], | ||
'enabled' => false, | ||
]; | ||
} | ||
} | ||
|
||
return Craft::$app->getView()->renderTemplate('schedule/_components/actions/ElementAction/settings', [ | ||
'action' => $this, | ||
'elementTypeOptions' => $elementTypeOptions, | ||
'allElementActionOptions' => $allElementActionOptions, | ||
'allElementSourceOptions' => $allElementSourceOptions, | ||
]); | ||
} | ||
} |
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,11 @@ | ||
<?php | ||
|
||
namespace panlatent\schedule\models; | ||
|
||
class ScheduleInfo | ||
{ | ||
public function getLastFinishedTime(): ?\DateTime | ||
{ | ||
|
||
} | ||
} |
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,10 @@ | ||
<?php | ||
|
||
namespace panlatent\schedule\records; | ||
|
||
use craft\db\ActiveRecord; | ||
|
||
class Action extends ActiveRecord | ||
{ | ||
|
||
} |
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.