-
-
Notifications
You must be signed in to change notification settings - Fork 38
WIP Re-add Neos7 Flicker plugin for testing the fusion plugin #190
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
base: 9.0
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| <?php | ||
| namespace Neos\Demo\Controller; | ||
|
|
||
| /* | ||
| * This file is part of the Neos.Demo package. | ||
| * | ||
| * (c) Contributors of the Neos Project - www.neos.io | ||
| * | ||
| * This package is Open Source Software. For the full copyright and license | ||
| * information, please view the LICENSE file which was distributed with this | ||
| * source code. | ||
| */ | ||
|
|
||
| use Neos\Flow\Annotations as Flow; | ||
| use Neos\Flow\Mvc\Controller\ActionController; | ||
|
|
||
| /** | ||
| * Controller that displays flickr photo streams | ||
| */ | ||
| class FlickrController extends ActionController | ||
| { | ||
| /** | ||
| * @Flow\InjectConfiguration(path="flickr.tagStreamUriPattern") | ||
| * @var string | ||
| */ | ||
| protected $tagStreamUriPattern; | ||
|
|
||
| /** | ||
| * @Flow\InjectConfiguration(path="flickr.userStreamUriPattern") | ||
| * @var string | ||
| */ | ||
| protected $userStreamUriPattern; | ||
|
|
||
| /** | ||
| * @return void|string | ||
| */ | ||
| public function tagStreamAction() | ||
| { | ||
| $tags = $this->request->getInternalArgument('__tags') ?: 'default-tag'; // todo how to pass `__tags` from node? | ||
| if ($tags === null || $tags === '') { | ||
| return '<p>Please specify Flickr tag(s)</p>'; | ||
| } | ||
| $endpointUrl = sprintf($this->tagStreamUriPattern, $tags); | ||
|
|
||
| $this->view->assign('tags', $tags); | ||
| $this->view->assign('feed', $this->fetchStream($endpointUrl)); | ||
| } | ||
|
|
||
| /** | ||
| * @param string|null $userId | ||
| * @return void|string | ||
| */ | ||
| public function userStreamAction($userId = null) | ||
| { | ||
| if ($userId === null) { | ||
| return '<p>No user specified</p>'; | ||
| } | ||
| $endpointUrl = sprintf($this->userStreamUriPattern, $userId); | ||
| $this->view->assign('feed', $this->fetchStream($endpointUrl)); | ||
| } | ||
|
|
||
| /** | ||
| * @param string $endpointUrl | ||
| * @return array | ||
| */ | ||
| protected function fetchStream(string $endpointUrl) | ||
| { | ||
| $stream = file_get_contents($endpointUrl); | ||
| return json_decode($stream, true); | ||
| } | ||
|
|
||
| /** | ||
| * Disable the default error flash message | ||
| * | ||
| * @return boolean | ||
| */ | ||
| protected function getErrorFlashMessage() | ||
| { | ||
| return false; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
|
|
||
| Neos: | ||
| Demo: | ||
| flickr: | ||
| tagStreamUriPattern: 'http://api.flickr.com/services/feeds/photos_public.gne?format=json&nojsoncallback=1&tags=%s' | ||
| userStreamUriPattern: 'http://api.flickr.com/services/feeds/photos_public.gne?format=json&nojsoncallback=1&id=%s' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| ## | ||
| # A simple "Flickr" plugin that demonstrates the "PluginViews"-feature | ||
| # | ||
| 'Neos.Demo:Content.Flickr': | ||
| superTypes: | ||
| 'Neos.Demo:Constraint.Content.Main': true | ||
| 'Neos.Neos:Plugin': true | ||
| ui: | ||
| label: 'Flickr Plugin' | ||
| icon: 'icon-flickr' | ||
| inspector: | ||
| groups: | ||
| 'feed': | ||
| label: 'Feed' | ||
| icon: 'icon-rss' | ||
| help: | ||
| message: 'Displays a gallery of images from a flickr stream based on tags.' | ||
| options: | ||
| # todo weren't plugin views removed? https://github.com/neos/neos-development-collection/pull/4330 | ||
| 'pluginViews': | ||
| 'UserFeed': | ||
| label: 'Neos.Demo:NodeTypes.Content.Flickr:options.pluginViews.userFeed' | ||
| controllerActions: | ||
| 'Neos\Demo\Controller\FlickrController': ['userStream'] | ||
|
Comment on lines
+18
to
+24
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this dead code?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pluginViews? Yeah we removed those. Which technically means we broke this plugin, because people said no one ever uses plugin views 🙈 |
||
| properties: | ||
| 'tags': | ||
| type: string | ||
| defaultValue: '' | ||
| ui: | ||
| label: "Tags" | ||
| reloadIfChanged: true | ||
| inspector: | ||
| group: 'feed' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| ## | ||
| # "Flickr" element, extending "Plugin" | ||
| # | ||
| prototype(Neos.Demo:Content.Flickr) < prototype(Neos.Neos:Plugin) { | ||
| package = 'Neos.Demo' | ||
| controller = 'Flickr' | ||
| action = 'tagStream' | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| <a href="{photo.link}" target="_blank" title="{photo.title} - published on {photo.published -> f:format.date(format: 'Y-m-d')}"> | ||
| <img src="{photo.media.m}" alt="{photo.title}" class="img-responsive img-thumbnail" /> | ||
| </a> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <div class="flickr-stream"> | ||
| <h3>Photo Stream for tag(s) "{tags}"</h3> | ||
| <ul class="clearfix"> | ||
| <f:for each="{feed.items}" as="photo"> | ||
| <li class="pull-left"> | ||
| <f:render partial="Flickr/Photo" arguments="{photo: photo}" /> | ||
| <p> | ||
| <f:link.action action="userStream" arguments="{userId: photo.author_id}">Show more photos by "{photo.author}"</f:link.action> | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that link cannot be resolved:
arguments: {
"node": "live__eyJsYW5ndWFnZSI6ImVuX1VTIn0=__336d96a5-b6c6-7d81-685f-89d32c37756e",
"@package": "Neos.Neos",
"@controller": "Frontend\\Node",
"@action": "show",
"@format": "html",
"--neos_demo-content_flickr": {
"@package": "neos.demo",
"@controller": "flickr",
"@action": "userstream",
"@format": "html",
"userId": "187194180@N06"
}
}
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is "node" in this a correct representation for a frontend node in a route?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could be, but in theory it should just be able to link to the page and switch to this action then. like views were never needed for multiple actions, just if you wanted to split those actions to different pages.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i dont understand ... not even linking to the same page works: public function tagStreamAction()
{
return $this->uriBuilder->uriFor('tagStream');
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh wait a second ... i think i answered
to quickly in my head
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| </p> | ||
| </li> | ||
| </f:for> | ||
| </ul> | ||
| </div> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <div class="flickr-stream"> | ||
| <h3>{feed.title}</h3> | ||
| <ul class="clearfix"> | ||
| <f:for each="{feed.items}" as="photo"> | ||
| <li class="pull-left"> | ||
| <f:render partial="Flickr/Photo" arguments="{photo: photo}" /> | ||
| <p> | ||
| <f:link.action action="tagStream">Back to tag stream</f:link.action> | ||
| </p> | ||
| </li> | ||
| </f:for> | ||
| </ul> | ||
| </div> |



Uh oh!
There was an error while loading. Please reload this page.