CMS  Version 3.9
SectionContentManagerMap Class Reference

Maintains the map of SectionContentManagers for different Section types. More...

Static Public Member Functions

static registerManager ($type, $manager)
 Registers a SectionContentManager for handling a specified section type. More...
 
static getManager ($section)
 Retrieves the SectionContentManager object for the specified section. More...
 
static isSectionTypeRegistered ($section_type)
 Check whether a SectionContentManager has been registered for the specified type. More...
 
static getRegisteredTypes ()
 Returns the list of registered section content types. More...
 
static onInitialize ()
 

Detailed Description

Maintains the map of SectionContentManagers for different Section types.

Components can register a custom SectionManager type by consuming the RegisterSectionManagers event and calling SectionManagerMap::registerSectionManager().

Author
andy

Definition at line 78 of file section_manager.inc.

Member Function Documentation

◆ getManager()

static SectionContentManagerMap::getManager (   $section)
static

Retrieves the SectionContentManager object for the specified section.

Parameters
Section$sectionthe Section object for which the manager is to be retrieved
Returns
the SectionContentManager object that will resolve content for this section
Exceptions
FakoliException

Definition at line 100 of file section_manager.inc.

101  {
102  $mgr = SectionContentManagerMap::$map[$section->section_type];
103  if (!$mgr)
104  {
105  throw new FakoliException("Unknown section manager for section '{$section->section}'");
106  }
107 
108  return $mgr;
109  }
$section
Definition: event_form.inc:44
FakoliException is the base exception class for all Fakoli errors.
Definition: core.inc:53

◆ getRegisteredTypes()

static SectionContentManagerMap::getRegisteredTypes ( )
static

Returns the list of registered section content types.

Returns
array the list of registered section content types in alphabetical order

Definition at line 125 of file section_manager.inc.

126  {
127  $types = array_keys(SectionContentManagerMap::$map);
128  sort($types);
129  return $types;
130  }
$types

◆ isSectionTypeRegistered()

static SectionContentManagerMap::isSectionTypeRegistered (   $section_type)
static

Check whether a SectionContentManager has been registered for the specified type.

Parameters
string$section_typethe type of Section
Returns
boolen true if a SectionContentManager has been registered for this type, false otherwise

Definition at line 116 of file section_manager.inc.

117  {
118  return array_key_exists($section_type, SectionContentManagerMap::$map);
119  }

◆ onInitialize()

static SectionContentManagerMap::onInitialize ( )
static

Definition at line 132 of file section_manager.inc.

133  {
134  trace("Registering Section Content Managers", 4);
135  ComponentManager::fireEvent('RegisterSectionContentManagers');
136  }
static fireEvent($event, $parameter=null, $mustBeConsumed=false)
Fire an event to all subscribers as detailed in their manifests.

◆ registerManager()

static SectionContentManagerMap::registerManager (   $type,
  $manager 
)
static

Registers a SectionContentManager for handling a specified section type.

Parameters
string$typethe type of section to be managed by the registered object
object$managerthe section manager object that will resolve content requests for sections of the given type.

Definition at line 88 of file section_manager.inc.

89  {
90  trace("Section Type '{$type}' will be managed by ".get_class($manager), 4);
91  SectionContentManagerMap::$map[$type] = $manager;
92  }

The documentation for this class was generated from the following file: