-
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.
- Loading branch information
Lútsen Stellingwerff
authored and
Lútsen Stellingwerff
committed
Jan 11, 2017
0 parents
commit 1517f40
Showing
4 changed files
with
73 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Copyright (c) 2016 - 2017 Lútsen Stellingwerff | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
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 @@ | ||
[<img src="https://cdn.rawgit.com/lutsen/lagan/master/lagan-logo.svg" width="100" alt="Lagan">](https://github.com/lutsen/lagan) | ||
|
||
Lagan Boolean Property Controller | ||
================================ | ||
|
||
Controller for the Lagan Boolean property. | ||
This can't actually be a "real" boolean because this breaks Lagan. Thats why we use a 0 or a 1 instead. | ||
|
||
To be used with [Lagan](https://github.com/lutsen/lagan). Lagan lets you create flexible content objects with a simple class, and manage them with a web interface. | ||
|
||
Lagan is a project of [Lútsen Stellingwerff](http://lutsen.land/) from [HoverKraft](http://www.hoverkraft.nl/). |
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,23 @@ | ||
{ | ||
"name": "lagan/property-boolean", | ||
"type": "library", | ||
"description": "Controller for the Lagan boolean property.", | ||
"keywords": ["lagan","boolean","property","controller"], | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Lútsen Stellingwerff", | ||
"email": "lutsenstellingwerff@gmail.com", | ||
"homepage": "http://www.hoverkraft.nl", | ||
"role": "Developer" | ||
} | ||
], | ||
"require": { | ||
"php": ">=5.5.0" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Lagan\\Property\\": "src/" | ||
} | ||
} | ||
} |
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,32 @@ | ||
<?php | ||
|
||
namespace Lagan\Property; | ||
|
||
/** | ||
* Controller for the Lagan boolean property. | ||
* This can't actually be a "real" boolean because this breaks Lagan. Thats why we use a 0 or a 1 instead. | ||
* | ||
* A property type controller can contain a set, read, delete and options method. All methods are optional. | ||
* To be used with Lagan: https://github.com/lutsen/lagan | ||
*/ | ||
|
||
class Boolean { | ||
|
||
/** | ||
* The set method is executed each time a property with this type is set. | ||
* | ||
* @param bean $bean The Redbean bean object with the property. | ||
* @param array $property Lagan model property arrray. | ||
* @param boolean $new_value The input of this property. | ||
* | ||
* @return boolean The Lagan base model checks if a property is set. This controller just sets the value to `true` if it is. | ||
*/ | ||
public function set($bean, $property, $new_value) { | ||
|
||
return $new_value ? 1 : 0; | ||
|
||
} | ||
|
||
} | ||
|
||
?> |