PHPackages                             digitalstate/platform-widget-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. digitalstate/platform-widget-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

digitalstate/platform-widget-bundle
===================================

DigitalState Widget Bundle

0.3.0(9y ago)01556MITPHPPHP &gt;=5.6

Since Jan 10Pushed 9y ago2 watchersCompare

[ Source](https://github.com/DigitalState/Platform-Widget-Bundle)[ Packagist](https://packagist.org/packages/digitalstate/platform-widget-bundle)[ Docs](https://github.com/DigitalState/Platform-Widget-Bundle.git)[ RSS](/packages/digitalstate-platform-widget-bundle/feed)WikiDiscussions develop Synced 2mo ago

READMEChangelogDependencies (2)Versions (7)Used By (6)

Platform-Widget-Bundle
======================

[](#platform-widget-bundle)

The Widget bundle provides the developers a way to define widgets in the user interface.

[![Code Climate](https://camo.githubusercontent.com/dfa63c6cba7fd9d4bd11236e5f36db08d5247d40127ad8976bc9ad0f0ecf31d7/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f4469676974616c53746174652f506c6174666f726d2d5769646765742d42756e646c652f6261646765732f6770612e737667)](https://codeclimate.com/github/DigitalState/Platform-Widget-Bundle)[![Test Coverage](https://camo.githubusercontent.com/fd2695b0c9b2e341e358a42fb2eef88e4a070e42e382d69819f407c4f48f79b7/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f4469676974616c53746174652f506c6174666f726d2d5769646765742d42756e646c652f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/DigitalState/Platform-Widget-Bundle/coverage)

Table of Contents
-----------------

[](#table-of-contents)

- [Widget Entity](#widget-entity)
- [Creating a Widget](#creating-a-widget)
- [Context Filter](#context-filter)
- [Todo](#todo)

Widget Entity
-------------

[](#widget-entity)

A widget consists of a title and content meant to be displayed in a template in a specific position. Essentially, it allows the developer to customise templates without directly modifying the template files. Widgets are comparable to [ORO Placeholders](https://github.com/orocrm/platform/tree/master/src/Oro/Bundle/UIBundle#introduction-to-placeholders) with two additional features: the capability of adding a title and the context filter.

*Note: Eventually, if possible, we will merge the concept of widgets to ORO Placeholders with our additional features.*

Creating a Widget
-----------------

[](#creating-a-widget)

Widgets can be created in any bundle. They are defined the same way as any other services in Symfony using the Service Container. The developer will need to tag the service with the `ds.widget` tag in order for the system to pick it up as a widget. Finally, the developer will need to define a position in a template file, where the widget should be displayed.

**The widget class** `src/Gov/Bundle/BlogBundle/Widget/LatestPostsWidget.php`:

```
