Documentation ¶
Index ¶
- Constants
- type FieldService
- type Fields
- type Flexible
- type Layout
- type Repeater
- type Row
- type Service
- func (s *Service) GetField(name string, args ...interface{}) interface{}
- func (s *Service) GetFieldObject(name string, args ...interface{}) domain.PostField
- func (s *Service) GetFields(args ...interface{}) Fields
- func (s *Service) GetFlexible(input interface{}, args ...interface{}) Flexible
- func (s *Service) GetLayout(name string, args ...interface{}) domain.Field
- func (s *Service) GetLayouts(args ...interface{}) domain.FieldGroups
- func (s *Service) GetRepeater(input interface{}, args ...interface{}) Repeater
- type SubFields
- type WalkerFunc
Constants ¶
const ( // SEPARATOR is the separator that defines the split between // field keys for repeaters and flexible content. SEPARATOR = "|" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FieldService ¶
type FieldService interface { GetField(name string, args ...interface{}) interface{} GetFieldObject(name string, args ...interface{}) domain.PostField GetFields(args ...interface{}) Fields GetLayout(name string, args ...interface{}) domain.Field GetLayouts(args ...interface{}) domain.FieldGroups GetRepeater(input interface{}, args ...interface{}) Repeater GetFlexible(input interface{}, args ...interface{}) Flexible }
FieldService defines methods for obtaining fields for the front end templates.
type Fields ¶
type Fields map[string]interface{}
Fields defines the map of fields to be returned to the template.
type Flexible ¶
type Flexible []Layout
Flexible represents the collection of layouts used for the flexible content function in templates.
type Repeater ¶
type Repeater []Row
Repeater represents the collection of rows used for the repeater function in templates.
type Row ¶
type Row domain.PostFields
Row represents the collection of the repeaters containing `sub_fields.
func (Row) First ¶
func (r Row) First() interface{}
First
Returns the first element in the repeater, or nil if the length of the repeater is zero.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service
Defines the helper for obtaining fields for front end templates.
func (*Service) GetField ¶
GetField
Returns the value of a specific field. Returns errors.NOTFOUND if the field was not found by the given key.
func (*Service) GetFieldObject ¶
GetFieldObject
Returns the raw object of a specific field. Returns errors.NOTFOUND if the field was not found by the given key.
func (*Service) GetFields ¶
GetFields
Returns all of the fields for the current post, or post ID given.
func (*Service) GetFlexible ¶
GetFlexible
Returns the collection of Layouts from the given key and returns a new Flexible.
Returns errors.INVALID if the field type is not flexible content. Returns errors.INTERNAL if the layouts could not be cast to a string slice.
func (*Service) GetLayouts ¶
func (s *Service) GetLayouts(args ...interface{}) domain.FieldGroups
GetGroups
func (*Service) GetRepeater ¶
GetRepeater
Returns the collection of children from the given key and returns a new Repeater.
Returns errors.NOTFOUND if the field was not found by the given key. Returns errors.INVALID if the field type is not a repeater or the name could not be cast.
type SubFields ¶
type SubFields domain.PostFields
Subfields represents the collection of fields used for templates. It has various functions attached to it making it easier to loop over.
func (SubFields) First ¶
func (s SubFields) First() interface{}
First
Returns the first element in the sub fields, or nil if the length of the sub fields is zero.
type WalkerFunc ¶
WalkerFunc defines the function for walking the slice of domain.PostField when being mapped. It send the field back to the calling function for processing.