This document contains details about event handlers (also known as Hooks) provided by Semantic MediaWiki to enable users to extent and integrate custom specific solutions.
Implementing a hook should be made in consideration of the expected performance impact for the front-end (additional DB read/write transactions etc.) and/or the back-end (prolonged job backlog etc.) process.
SMW::Factbox::BeforeContentGeneration
to replace or amend text elements shown in a Factbox. See also$smwgFactboxUseCache
settings.Use ofsmwShowFactbox
was deprecated with 1.9SMW::Job::updatePropertyJobs
to add additional update jobs for a property and related subjects.Use ofsmwUpdatePropertySubjects
was deprecated with 1.9SMW::DataType::initTypes
to add additional DataType support.Use ofsmwInitDatatypes
was deprecated with 1.9SMW::SQLStore::updatePropertyTableDefinitions
to add additional table definitions during initialization.
SMW::Store::BeforeQueryResultLookupComplete
to return aQueryResult
object before the standard selection process is started and allows to suppress the standard selection process completely by returningfalse
.SMW::Store::AfterQueryResultLookupComplete
to manipulate aQueryResult
after the selection process.SMW::Property::initProperties
to add additional predefined properties.Use ofsmwInitProperties
was deprecated with 2.1SMW::SQLStore::BeforeDeleteSubjectComplete
called before deletion of a subject is completed.SMW::SQLStore::AfterDeleteSubjectComplete
called after deletion of a subject is completed.SMW::SQLStore::BeforeChangeTitleComplete
called before change to a subject is completed.
SMW::Parser::BeforeMagicWordsFinder
allows to extend the magic words list that theInTextAnnotationParser
should search for the wikitext.
SMW::SQLStore::BeforeDataRebuildJobInsert
to add update jobs while running the rebuild process.Use ofsmwRefreshDataJobs
was deprecated with 2.3SMW::SQLStore::AddCustomFixedPropertyTables
to add fixed property table definitionsSMW::Browse::AfterIncomingPropertiesLookupComplete
to extend the incoming properties display forSpecial:Browse
SMW::Browse::BeforeIncomingPropertyValuesFurtherLinkCreate
to replace the standardSearchByProperty
with a custom link to an extended list of results (returnfalse
to replace the link)SMW::SQLStore::AfterDataUpdateComplete
to add processing after the update has been completed and providesCompositePropertyTableDiffIterator
to identify entities that have been added/removed during the update. Use ofSMWSQLStore3::updateDataAfter
was deprecated with 2.3
SMW::FileUpload::BeforeUpdate
to add extra annotations before the store update is triggered
For implementation details and examples, see the integration test.
Subsequent hooks should be renamed to follow a common naming practice that help distinguish them from other hook providers. In any case this list needs details and examples.
SMWExportController
, smwAddToRDFExport (SMW::Exporter::AfterRdfExportComplete)SMWParamFormat
, SMWResultFormat\SMW\Store
, SMWStore::updateDataBefore (SMW::Store::BeforeDataUpdateComplete)\SMW\Store
, SMWStore::updateDataAfter (SMW::Store::AfterDataUpdateComplete)\SMW\Store
, smwInitializeTables (SMW::Store::initTables)SMWSQLStore3SetupHandlers
, SMWCustomSQLStoreFieldTypeSMWSQLStore3SetupHandlers
, smwRefreshDataJobs (SMW::SQLStore::AfterRefreshDataJob)SMWSQLStore3Writers
, SMWSQLStore3::updateDataBefore (SMW::SQLStore::BeforeDataUpdateComplete)SMWSetupScript
, smwDropTables (SMW::Store::dropTables)SMW_refreshData
, smwDropTables (SMW::Store::dropTables)