Aero\Responses\Traits\HasSections

This trait can be added to a response builder class. It adds useful methods for managing sections of the page. There are other traits (HasBottomSections, HasTopSections, and HasSidebarSections) in the same namespace that add more section helpers (these traits all require that the class uses the HasSections trait as well). The trait adds the following methods:

 

getSectionKey Method

This method defines the key that is used to store the sections data on the response builder (defaults to ‘sections’).

 

setSection Method

This method will set a section. It accepts a key and value and optionally a section key (the section key will default to the getSectionKey method).

 

setSections Method

This method will set the sections. It accepts an array of sections and optionally a section key (the section key will default to the getSectionKey method).

 

getSection Method

This method will return a specified section. It accepts a key for the section and optionally a section key (the section key will default to the getSectionKey method).

 

getSections Method

This method will return a collection of the sections. It optionally accepts a section key (the section key will default to the getSectionKey method).

 

addSection Method

This method accepts a key and value to add to the sections. Using this method will put your section at the top of the sections collection.

 

addSectionBefore Method

This method works the same way as the addSection method but also accepts a key for the section that this new section should be added before.

 

addSectionAfter Method

This method works the same way as the addSection method but also accepts a key for the section that this new section should be added after.

 

removeSection Method

This method accepts a key of the section to remove and optionally accepts a section key (the section key will default to the getSectionKey method).

 

hasSections Method

This method returns if there are sections. It optionally accepts a section key (the section key will default to the getSectionKey method).

Articles in this section

Was this article helpful?
0 out of 0 found this helpful