Skip to content
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

ENH Improve typing to support refactored template layer #647

Merged

Conversation

GuySartorelli
Copy link
Member

@GuySartorelli GuySartorelli marked this pull request as draft September 26, 2024 04:25
@GuySartorelli GuySartorelli force-pushed the pulls/3/refactor-template-layer branch 2 times, most recently from d287e85 to 166cd9f Compare September 27, 2024 02:40
@GuySartorelli GuySartorelli force-pushed the pulls/3/refactor-template-layer branch 3 times, most recently from 35782de to 070f521 Compare October 10, 2024 22:43
Comment on lines +241 to +243
$key = SSTemplateEngine::config()->get('global_key');
$engine = SSTemplateEngine::create();
$globalKey = md5($engine->renderString($key, ViewLayerData::create([])));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explicitly use SSTemplateEngine instead of getting whatever's registered against TemplateEngine because this config is specific to SSTemplateEngine and is explicitly ss template syntax.

Comment on lines -1325 to 1333
*
* @return string
*/
public function getTag()
public function getTag(): string
{
$template = $this->File->getFrontendTemplate();
if (empty($template)) {
return '';
}
return (string)$this->renderWith($template);
return $this->renderWith($template);
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just adding a bit of type safety since this method gets used in forTemplate() above.

@GuySartorelli GuySartorelli marked this pull request as ready for review October 23, 2024 03:07
$next = $record->dbObject($field)->getValue();
$next = $record->dbObject($field)?->getValue();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dbObject() can return null

@emteknetnz emteknetnz merged commit 5abc14d into silverstripe:3 Oct 30, 2024
5 of 8 checks passed
@emteknetnz emteknetnz deleted the pulls/3/refactor-template-layer branch October 30, 2024 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants