Content

Introduction

Overview

The ContentService class provides an interface for managing and retrieving various content types and navigation structures within a web application. This service includes methods to access menu items, pages, posts, and other content-related functionalities.

Namespace

namespace Toolstation\Content\Services;

Class Definition

The ContentService class implements the ContentService contract defined in the Toolstation\Contracts\Content namespace.

class ContentService implements \Toolstation\Contracts\Content\ContentService

Methods

getMenuBySlug($slug)

Purpose: Retrieves a menu item by its slug.

Parameters string $slug: The slug of the menu item to retrieve.

Returns This method is not yet implemented (// TODO).

getAllMenuItems

Purpose: Retrieves a collection of all menu items.

Return type collection

getPageBySlug

Purpose: Retrieves a page by its slug.

parameters:

  • slug (string): The slug of the page.

Return type mixed

getPageById

Purpose: Retrieves a page by its ID.

parameters:

  • id (int): The ID of the page.

Return type mixed

Purpose: Retrieves links to archives.

Return type mixed

getArchivesByDate

Purpose: Retrieves archives by date.

parameters:

  • slug (string): Date in F-Y format.
  • categorySlug (string): The category slug.

Return type mixed

getPostsByCategory

Purpose: Retrieves posts by category.

parameters:

  • slug (string): The slug of the category.

Return type mixed

getChildren

Purpose: Retrieves children by their parent.

parameters:

  • parent (mixed): The parent item.

Return type mixed

getDepartmentBanners

Purpose: Retrieves department banners.

parameters:

  • slug (string): The slug for department banners.

Return type mixed

getContentBySlug

Purpose: Retrieves content by its slug. (Deprecated)

parameters:

  • slug (string): The slug of the content.

Return type mixed

getFooterNav (Deprecated)

Purpose: Retrieves footer navigation. (Deprecated)

Return type mixed

getHeaderNav (Deprecated)

Purpose: Retrieves header navigation. (Deprecated)

Return type mixed


Copyright © 2026