Creating Grids
We use Grids in our BO controller implementations in the methods to display the lists of blog categories and blog posts.
Here, we will only focus on the blog post Grids enabling us to display a full list and a filtered list of blog posts linked to a category. Remember that anytime you can have a look at the GitHub repository of this book containing the module files to get the blog categories Grid.
As seen in previous chapters, a Grid is generated by a Grid Factory, which uses the following objects:
- A definition factory for the structure of the column
- A data factory that retrieves the data to display
In the case of the blog posts, let’s define the structure of the column for our Grid in the /modules/whblog/src/Grid/Definition/Factory/WHBlogPostDefinitionFactory.php
file with the following content:
//namespace and uses available in the GitHub repository final class WHBlogPostDefinitionFactory extends AbstractGridDefinitionFactory { &...