-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API Refactor template layer #11405
API Refactor template layer #11405
Conversation
649a6fc
to
da2ebdc
Compare
2b00a05
to
fff294a
Compare
fff294a
to
ad22082
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to update commit message / PR title
src/View/ViewLayerData.php
Outdated
|
||
public function __get(string $name): ?ViewLayerData | ||
{ | ||
$value = $this->getRawDataValue($name, type: ViewLayerData::TYPE_PROPERTY); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$value = $this->getRawDataValue($name, type: ViewLayerData::TYPE_PROPERTY); | |
$value = $this->getRawDataValue($name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussion about this can be in #11405 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/View/ViewLayerData.php
Outdated
|
||
public function __call(string $name, array $arguments = []): ?ViewLayerData | ||
{ | ||
$value = $this->getRawDataValue($name, $arguments, ViewLayerData::TYPE_METHOD); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$value = $this->getRawDataValue($name, $arguments, ViewLayerData::TYPE_METHOD); | |
$value = $this->getRawDataValue($name, $arguments); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussion about this can be in #11405 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
59730f2
to
063628a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Things looking good, this is mostly likely an issue at my end
I've tried copying https://github.com/GuySartorelli/silverstripe-twig to my local (I copied files, rather than using composer), and by adding the following line to TwigTemplateEngine::render() if (!$this->template) return '';
(this is so that it's tolerant of missing Something.twig files)
I was able to get the "global" method described in the twig module readme to work i.e. setting yml, and I was also about to get the controller method to work, by updating PageController, though I wasn't able to get the Model version to work by updating Page
I get that it's a highly experimental module, though I just need to double check with you that the ModelData::renderWith() is actually behaving as expected
// app/src/Page.php
public function renderWith($template, ModelData|array $customFields = []): DBHTMLText
{
// $template = SSViewer::create($template, SSTemplateEngine::create());
$template = SSViewer::create($template, TwigTemplateEngine::create());
return parent::renderWith($template, $customFields);
}
Yup, that works.
Alternatively, use something that isn't a page. |
Includes the following large-scale changes: - Impoved barrier between model and view layers - Improved casting of scalar to relevant DBField types - Improved capabilities for rendering arbitrary data in templates
Just realised I didn't update the commit message per #11405 (review) |
063628a
to
11a4b60
Compare
Includes the following large-scale changes:
Issue