-
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 #21 from CoopBelvedere/dev_1.1.0
Dev 1.1.0
- Loading branch information
Showing
19 changed files
with
214 additions
and
163 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
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,43 @@ | ||
<?php | ||
|
||
namespace Belvedere\FormMaker\Listeners; | ||
|
||
use Belvedere\FormMaker\Models\Nodes\Node; | ||
use Belvedere\FormMaker\Contracts\Models\Nodes\Inputs\InputContract; | ||
|
||
class AddNodeInRanking | ||
{ | ||
/** | ||
* The node to be added in ranking. | ||
* | ||
* @var \Belvedere\FormMaker\Models\Nodes\Node | ||
*/ | ||
protected $node; | ||
|
||
/** | ||
* Create the event listener. | ||
* | ||
* @param \Belvedere\FormMaker\Models\Nodes\Node $node | ||
* @return void | ||
*/ | ||
public function __construct(Node $node) | ||
{ | ||
$this->node = $node; | ||
|
||
$this->handle(); | ||
} | ||
|
||
/** | ||
* Handle the event. | ||
* | ||
* @return void | ||
*/ | ||
protected function handle(): void | ||
{ | ||
if ($this->node->type === 'label' && $this->node->getRelation('parent') instanceof InputContract) { | ||
return; | ||
} | ||
|
||
$this->node->getRelation('parent')->addInRanking($this->node); | ||
} | ||
} |
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
Oops, something went wrong.