How to get a list of CMS pages that use a specific component
3
Sometimes it is necessary to add a plugin entry to a specific CMS page.
An example:
Testimonials should be placed on different pages. So I have to add every testimonial to a CMS page.
However, not every page (imprint, contact form, etc.) can display testimonials. Therefore, a dropdown with all options would be a bit confusing for the customer.
In order to only display CMS pages in the backend dropdown that display a testimonial, the withComponent
scope can be used.
$options = \Cms\Classes\Page::withComponent('showTestimonial')->all();
There are no comments yet
Be the first one to comment