-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor News to News/Index & add jsonSerialize()
- Loading branch information
1 parent
54a0dc5
commit 003fc59
Showing
11 changed files
with
79 additions
and
59 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 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,19 @@ | ||
<?php | ||
|
||
namespace BNETDocs\Models\News; | ||
|
||
class Index extends \BNETDocs\Models\ActiveUser implements \JsonSerializable | ||
{ | ||
public bool $acl_allowed = false; | ||
public ?array $news_posts = null; | ||
public ?\BNETDocs\Libraries\Core\Pagination $pagination = null; | ||
|
||
public function jsonSerialize(): mixed | ||
{ | ||
return \array_merge(parent::jsonSerialize(), [ | ||
'acl_allowed' => $this->acl_allowed, | ||
'news_posts' => $this->news_posts, | ||
'pagination' => $this->pagination, | ||
]); | ||
} | ||
} |
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
2 changes: 1 addition & 1 deletion
2
src/Templates/News.rss.phtml → src/Templates/News/Index.rss.phtml
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<?php | ||
|
||
namespace BNETDocs\Templates; | ||
namespace BNETDocs\Templates\News; | ||
|
||
use \CarlBennett\MVC\Libraries\Common; | ||
|
||
|
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,17 @@ | ||
<?php | ||
|
||
namespace BNETDocs\Views\News; | ||
|
||
class IndexHtml extends \BNETDocs\Views\Base\Html | ||
{ | ||
public static function invoke(\BNETDocs\Interfaces\Model $model): void | ||
{ | ||
if (!$model instanceof \BNETDocs\Models\News\Index) | ||
{ | ||
throw new \BNETDocs\Exceptions\InvalidModelException($model); | ||
} | ||
|
||
(new \BNETDocs\Libraries\Core\Template($model, 'News/Index'))->invoke(); | ||
$model->_responseHeaders['Content-Type'] = self::mimeType(); | ||
} | ||
} |
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,17 @@ | ||
<?php | ||
|
||
namespace BNETDocs\Views\News; | ||
|
||
class IndexRSS extends \BNETDocs\Views\Base\RSS | ||
{ | ||
public static function invoke(\BNETDocs\Interfaces\Model $model): void | ||
{ | ||
if (!$model instanceof \BNETDocs\Models\News\Index) | ||
{ | ||
throw new \BNETDocs\Exceptions\InvalidModelException($model); | ||
} | ||
|
||
(new \BNETDocs\Libraries\Core\Template($model, 'News/Index.rss'))->invoke(); | ||
$model->_responseHeaders['Content-Type'] = self::mimeType(); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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