-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sync entry query parameters and add site enum
- Loading branch information
Showing
8 changed files
with
90 additions
and
19 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,18 @@ | ||
<?php | ||
|
||
namespace markhuot\CraftQL\Factories; | ||
|
||
use markhuot\CraftQL\Factories\BaseFactory; | ||
use markhuot\CraftQL\Types\Site as SiteObjectType; | ||
|
||
class Site extends BaseFactory { | ||
|
||
function make($raw, $request) { | ||
return new SiteObjectType($request, $raw); | ||
} | ||
|
||
function can($id, $mode='query') { | ||
return true; | ||
} | ||
|
||
} |
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,31 @@ | ||
<?php | ||
|
||
namespace markhuot\CraftQL\Repositories; | ||
|
||
use Craft; | ||
use yii\base\Component; | ||
|
||
class Site extends Component { | ||
|
||
private $sites = []; | ||
|
||
function load() { | ||
foreach (Craft::$app->sites->getAllSites() as $site) { | ||
if (!isset($this->sites[$site->id])) { | ||
$this->sites[$site->id] = $site; | ||
if (!empty($site->uid)) { | ||
$this->sites[$site->uid] = $site; | ||
} | ||
} | ||
} | ||
} | ||
|
||
function get($id) { | ||
return $this->sites[$id]; | ||
} | ||
|
||
function all() { | ||
return $this->sites; | ||
} | ||
|
||
} |
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