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

Feature: Widgets and Snippets #382

Merged
merged 89 commits into from Apr 22, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
86351e6
Initial work on Snippets / Widgets
bobdenotter Apr 1, 2019
beaf556
Working on Widgets / snippets
bobdenotter Apr 3, 2019
69d035f
Don't add my name, PHPStorm.
bobdenotter Apr 3, 2019
d1535f6
Making "News" work
bobdenotter Apr 4, 2019
0946009
Getting more work done on Widgets
bobdenotter Apr 5, 2019
61bf743
CS
bobdenotter Apr 5, 2019
102a57f
Fixing merge conflict
bobdenotter Apr 6, 2019
38e8561
Working on Snippets
bobdenotter Apr 6, 2019
dd56f44
Working on widgets and snippets
bobdenotter Apr 6, 2019
fe22691
CS fixes
bobdenotter Apr 6, 2019
1c139c7
Working on Snippet processing
bobdenotter Apr 6, 2019
b1322a8
Working on snippets
bobdenotter Apr 6, 2019
5ae5491
And making a snippet modify the headers!
bobdenotter Apr 8, 2019
1707cd5
Add unit tests for injector
bobdenotter Apr 8, 2019
12ecdfc
CS fixes
bobdenotter Apr 8, 2019
9294e35
Adding Kakunin test
bobdenotter Apr 8, 2019
22460b6
Initial work on Snippets / Widgets
bobdenotter Apr 1, 2019
4ba72fd
Working on Widgets / snippets
bobdenotter Apr 3, 2019
210a83c
Don't add my name, PHPStorm.
bobdenotter Apr 3, 2019
480a0e7
Making "News" work
bobdenotter Apr 4, 2019
84d065f
Getting more work done on Widgets
bobdenotter Apr 5, 2019
889a9ff
CS
bobdenotter Apr 5, 2019
17c95fb
Fixing merge conflict
bobdenotter Apr 6, 2019
a3e6f87
Working on Snippets
bobdenotter Apr 6, 2019
1e1e2f6
Working on widgets and snippets
bobdenotter Apr 6, 2019
5fa38fc
Working on Snippet processing
bobdenotter Apr 6, 2019
4ec5d6b
Working on snippets
bobdenotter Apr 6, 2019
5717344
And making a snippet modify the headers!
bobdenotter Apr 8, 2019
d9f8231
Adding Kakunin test
bobdenotter Apr 8, 2019
ba0c56e
CS fixes to widgets / snippets
bobdenotter Apr 9, 2019
b81d074
Don't add my name, PHPStorm
bobdenotter Apr 10, 2019
03fe08a
Don't use "Manager", use "Snippets", cause that's what they are.
bobdenotter Apr 10, 2019
6d24420
Minor cleanup
bobdenotter Apr 10, 2019
6dc2c62
More tests
bobdenotter Apr 10, 2019
d92550a
Make ZoneSubscriber look at Interfaces
bobdenotter Apr 13, 2019
af5a6b5
Fix in typehint
bobdenotter Apr 13, 2019
28e7331
Make widgets use __invoke
bobdenotter Apr 13, 2019
99a7ffa
Don't pass around $twig
bobdenotter Apr 13, 2019
eecd517
CS
bobdenotter Apr 13, 2019
f779e31
Renaming FooControllerInterface to FooZone
bobdenotter Apr 14, 2019
36635db
Requested changes
bobdenotter Apr 14, 2019
8ca032e
Minor tweaks
bobdenotter Apr 14, 2019
e03e844
Make snippets into a type of widget!
bobdenotter Apr 14, 2019
f8203d8
CS fix
bobdenotter Apr 14, 2019
7e1acdd
Added TwigAware Interface
bobdenotter Apr 14, 2019
b58de93
More cleanup on Widgets
bobdenotter Apr 14, 2019
66fdaec
Working on widgets
bobdenotter Apr 14, 2019
7a4151f
Requested changes
bobdenotter Apr 14, 2019
f3cdbd8
Make WidgetInterface
bobdenotter Apr 17, 2019
2af8948
Making Traits (in progress)
bobdenotter Apr 17, 2019
1794ef6
Updating Traits
bobdenotter Apr 17, 2019
1ed954b
no traits, back to Interface
bobdenotter Apr 17, 2019
987fb6d
Use PHP 7.1.18, because Travis defaults to 7.1.11 and it breaks
bobdenotter Apr 18, 2019
81bd588
Clarify pinning of PHP 7.1.18 in Travis.yml
bobdenotter Apr 19, 2019
a92f288
Don't add arrays to queue, but just the $widgets
bobdenotter Apr 19, 2019
9bc7146
Requested changes
bobdenotter Apr 19, 2019
a700756
Refactor `Zone` to `RequestZone`.
bobdenotter Apr 19, 2019
129ad0c
Updating tests
bobdenotter Apr 19, 2019
7a582e8
remove registerBoltWidgets from Widgets class
bobdenotter Apr 19, 2019
89037e0
Refactor `isFrontend` to `isForFrontend`, etc.
bobdenotter Apr 19, 2019
62398cd
Fixing tests
bobdenotter Apr 19, 2019
0530698
Move Response to its own interface
bobdenotter Apr 19, 2019
bb51dfc
Have widgets 'get' the Request just before being invoked.
bobdenotter Apr 19, 2019
4bc744e
Move `registerBoltWidgets` to a subscriber.
bobdenotter Apr 19, 2019
c552dbc
Minor changes
bobdenotter Apr 19, 2019
db9c9aa
Add `ProcessWidgetsQueueSubscriber` for Response
bobdenotter Apr 20, 2019
5ba5299
Make widgets pass along extra parameters
bobdenotter Apr 21, 2019
2a36058
Correctly pass $params
bobdenotter Apr 21, 2019
5793bf4
Don't modify StreamedResponse
bobdenotter Apr 21, 2019
60fed0e
Requested changes
bobdenotter Apr 21, 2019
5ae6479
Revert "Requested changes"
bobdenotter Apr 21, 2019
77a1cce
Move `instanceof StreamedResponse` to start of method
bobdenotter Apr 21, 2019
9c317ab
Set config as true global
bobdenotter Apr 21, 2019
2587a11
Requested changes
bobdenotter Apr 21, 2019
aa9d9d4
CS fix
bobdenotter Apr 21, 2019
60122b1
Remove methods from Twigaware interface
bobdenotter Apr 21, 2019
9bdd3bc
Init $template as string
bobdenotter Apr 21, 2019
bc0b59d
Remove $type, and remove the initial `''` for $template
bobdenotter Apr 21, 2019
f9abecd
Move Snippet to Widget\Injector
Apr 21, 2019
989e5e9
Changes in Widgets
Apr 21, 2019
0f34da1
merge master
Apr 21, 2019
af1cc72
Change BaseWidget description
bobdenotter Apr 21, 2019
871a5b9
Improve Widgets
Apr 21, 2019
16b48fe
Fix HtmlInjector
Apr 21, 2019
1a444a6
fix cs
Apr 21, 2019
74ee8fd
Html Injector rewritten
Apr 21, 2019
3cc070a
Fix NewsWidget
Apr 21, 2019
17a97c5
Fix setting deps in Widget Queue Processor
Apr 21, 2019
b54a9d0
Widgets changes (#411)
JarJak Apr 22, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Widget/BaseWidget.php
Expand Up @@ -86,13 +86,13 @@ public function getPriority(): int
public function __invoke(array $params = []): string
{
if (array_key_exists('template', $params)) {
$this->template = $params['template'];
$this->setTemplate($params['template']);
}

if ($this instanceof TwigAware) {
$output = $this->twig->render($this->template, $params);
$output = $this->twig->render($this->getTemplate(), $params);
} else {
$output = $this->template;
$output = $this->getTemplate();
}

return sprintf(
Expand Down
4 changes: 4 additions & 0 deletions src/Widget/TwigAware.php
Expand Up @@ -16,4 +16,8 @@ interface TwigAware
public function setTwig(Environment $twig): WidgetInterface;

public function getTwig(): Environment;

public function getTemplate(): string;
bobdenotter marked this conversation as resolved.
Show resolved Hide resolved

public function setTemplate(string $template): WidgetInterface;
}
4 changes: 0 additions & 4 deletions src/Widget/WidgetInterface.php
Expand Up @@ -17,14 +17,10 @@ public function getTarget(): string;

public function getPriority(): int;

public function getTemplate(): string;

/**
* @return string from Bolt\Snippet\RequestZone constants enum
*/
public function getZone(): string;

public function getSlug(): string;

public function __invoke(array $params = []): string;
bobdenotter marked this conversation as resolved.
Show resolved Hide resolved
}