October CMS resources and help articles

Simple and to the point. Optimized by the community.

How to get a list of CMS pages that use a specific component

by OFFLINE, last modified on June 11th, 2021

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();



We use cookies to measure the performance of this website. Do you want to accept these cookies?