This file contains hidden or 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
| ... | |
| /** | |
| * @title Test Widget | |
| * @author Paweł Mikołajczuk <[email protected]> | |
| * @description Test widget | |
| * @homepage http://www.sourcefabric.org/en/newscoop/ | |
| * @version 1.0 | |
| */ | |
| class TestWidget extends Widget // implements IWidget class with only render method | |
| { |
This file contains hidden or 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
| ... | |
| // set metadata property with variable | |
| public $title = 'Test widget title from property'; | |
| ... |
This file contains hidden or 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
| ... | |
| /** | |
| * @setting | |
| * @label Autor name | |
| */ | |
| public $author = 'Paweł Mikołajczuk>'; | |
| /** | |
| * @setting | |
| * @label Autor old |
This file contains hidden or 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
| /** | |
| * @Route("/articles.{_format}", defaults={"_format"="json"}) | |
| * @Method("GET") | |
| * @View() | |
| */ | |
| public function getArticlesAction(Request $request) | |
| { | |
| $em = $this->container->get('em'); | |
| $publication = $this->get('newscoop.publication_service')->getPublication()->getId(); | |
| $serializer = $this->get('serializer'); |
This file contains hidden or 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
| Newscoop\Entity\Comment: | |
| exclusion_policy: ALL | |
| properties: | |
| subject: | |
| expose: true | |
| read_only: true | |
| type: string | |
| groups: ["details", "list"] | |
| serialized_name: subject | |
| message: |
This file contains hidden or 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
| newscoop_gimme: | |
| allow_origin: | |
| - "example.com" | |
| - "second-example.com" |
This file contains hidden or 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
| { | |
| "require": { | |
| "silex/silex": "dev-master", | |
| "twig/twig": ">=1.8,<2.0-dev", | |
| "sourcefabric/newscoop-php-sdk": "dev-master" | |
| } | |
| } |
This file contains hidden or 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
| <?php | |
| require_once __DIR__.'/../vendor/autoload.php'; // Composer autoloading | |
| $app = new Silex\Application(); | |
| // register twig support | |
| $app->register(new Silex\Provider\TwigServiceProvider(), array( | |
| 'twig.path' => __DIR__.'/Resources/views', | |
| )); |
This file contains hidden or 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
| ... | |
| //debug | |
| $app['debug'] = true; | |
| $api = new Client(); | |
| // set here your newscoop instance address | |
| $api->setApiEndpoint('http://newscoop.dev/api'); | |
| ... |
This file contains hidden or 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
| ... | |
| //create route | |
| $app->get('/', function (Request $request) use ($app, $api){ | |
| // choose resource, in second parameter you can pass array with additional parameters | |
| $articles = $api->getResource('/articles', array( | |
| 'type' => 'news' | |
| )) | |
| // set number of items per page - default is 10 |