add some hooks for the profile page

This commit is contained in:
Evan Prodromou 2009-10-09 15:28:12 -04:00
parent bf1c662990
commit 44a59bbc2d
2 changed files with 213 additions and 144 deletions

View File

@ -291,3 +291,45 @@ EndShowHeadElements: Right before the </head> tag; put <script>s here if you nee
- $action: the current action
CheckSchema: chance to check the schema
StartShowLargeProfileSection: Starting to show the section of the
profile page with the actual profile data;
hook to prevent showing the profile (e.g.)
- $action: the current action
- &$profile: the profile being shown
StartShowLargeProfileElements: inside the section, before the first
element; prepend elements here
- $action: the current action
- &$profile: the profile being shown
EndShowLargeProfileElements: inside the section, after the last element;
append elements here
- $action: the current action
- &$profile: the profile being shown
EndShowLargeProfileSection: After showing the section of the profile
page with the profile elements
- $action: the current action
- &$profile: the profile being shown
StartShowLargeEntityActionsSection: Starting to show the section of the
profile page with action links; hook
to hide them (for example)
- $action: the current action
- &$profile: the profile being shown
StartShowLargeEntityActionsElements: inside the list, before the first
element; prepend elements here
- $action: the current action
- &$profile: the profile being shown
EndShowLargeEntityActionsElements: inside the list, after the last element;
append elements here
- $action: the current action
- &$profile: the profile being shown
EndShowLargeEntityActionsSection: After showing the section of the profile
page with the entity actions
- $action: the current action
- &$profile: the profile being shown

View File

@ -181,9 +181,19 @@ class ShowstreamAction extends ProfileAction
function showProfile()
{
$this->showProfileData();
$this->showEntityActions();
}
function showProfileData()
{
if (Event::handle('StartShowLargeProfileSection', array(&$this, &$this->profile))) {
$this->elementStart('div', 'entity_profile vcard author');
$this->element('h2', null, _('User profile'));
if (Event::handle('StartShowLargeProfileElements', array(&$this, &$this->profile))) {
$avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE);
$this->elementStart('dl', 'entity_depiction');
$this->element('dt', null, _('Photo'));
@ -270,12 +280,23 @@ class ShowstreamAction extends ProfileAction
$this->elementEnd('dl');
}
Event::handle('EndShowLargeProfileElements', array(&$this, &$this->profile));
}
$this->elementEnd('div');
Event::handle('EndShowLargeProfileSection', array(&$this, &$this->profile));
}
}
function showEntityActions()
{
if (Event::handle('StartShowLargeEntityActionsSection', array(&$this, &$this->profile))) {
$this->elementStart('div', 'entity_actions');
$this->element('h2', null, _('User actions'));
$this->elementStart('ul');
if (Event::handle('StartShowLargeEntityActionsElements', array(&$this, &$this->profile))) {
if (empty($cur)) { // not logged in
$this->elementStart('li', 'entity_subscribe');
$this->showRemoteSubscribeLink();
@ -341,8 +362,14 @@ class ShowstreamAction extends ProfileAction
}
}
Event::handle('EndShowLargeEntityActionsElements', array(&$this, &$this->profile));
}
$this->elementEnd('ul');
$this->elementEnd('div');
Event::handle('EndShowLargeEntityActionsSection', array(&$this, &$this->profile));
}
}
function showRemoteSubscribeLink()