Jump to content

Community

Developer Documentation

Content Messages

Invision Community 4.2 introduces the new Content Message feature, which allows moderators to post messages that will appear above all comments, on all pages, on a specific content item.

To add this feature to your content item, you must first implement the \IPS\Content\MetaData interface to add support for storing Meta Data on your content item.

Once Meta Data has implemented, you need to add core_ContentMessages to your supportedMetaDataTypes() method.

public static function supportedMetaDataTypes()
{
	return array( 'core_ContentMessages' );
}

Once Content Messages has been added as a supported data type, displaying them within your content items templates is as simple as adding the following line where you want the messages to be displayed:

{template="contentItemMessages" group="global" app="core" params="$item->getMessages(), $item"}

And then add the following to your Moderation Menu:

						{{if $item->canOnMessage( 'add' )}}
							<li class='ipsMenu_item'><a href='{$item->url()->csrf()->setQueryString( array( 'do' => 'messageForm' ) )}' data-ipsDialog data-ipsDialog-title='{lang="add_message"}'>{lang="add_message"}</a></li>
						{{endif}}

 

And that is all that is required to implement Content Messages.


  Report Document


×
×
  • Create New...