15 KiB
15 KiB
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.
Available hooks
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.
Setup and registry
SMW::DataType::initTypesto add additional DataType supportSMW::Property::initPropertiesto add additional predefined propertiesSMW::Constraint::initConstraintsto add custom constraintsSMW::GetPreferencesto add extra preferences that are ordered on the Semantic MediaWiki user preference tabSMW::Setup::AfterInitializationCompleteto modify global configuration after initialization of Semantic MediaWiki is completedSMW::Settings::BeforeInitializationCompleteto modify the Semantic MediaWiki configuration before the initialization is completedSMW::GroupPermissions::BeforeInitializationCompleteto modify the Semantic MediaWiki permissions before the initialization is completedSMW::Event::RegisterEventListenersto register additional event listenersSMW::Listener::ChangeListener::RegisterPropertyChangeListenersallows to register and listen to individual property changesSMW::Schema::RegisterSchemaTypesallows to register additional schema types
Store
SMW::SQLStore::BeforeDeleteSubjectCompleteis called before the deletion of a subject is completedSMW::SQLStore::AfterDeleteSubjectCompleteis called after the deletion of a subject is completedSMW::SQLStore::BeforeChangeTitleCompleteis called before change to a subject is completedSMW::SQLStore::BeforeDataRebuildJobInsertsto add update jobs while running the rebuild processSMW::SQLStore::BeforeDataUpdateCompleteto extend theSemanticDataobject before the update is completedSMW::SQLStore::AfterDataUpdateCompleteto process information after an update has been completedSMW::Store::BeforeDataUpdateCompleteto extend theSemanticDataobject before the update is completedSMW::Store::AfterDataUpdateCompleteto process information after an update has been completed
Property tables
SMW::SQLStore::AddCustomFixedPropertyTablesto add fixed property table definitionsSMW::SQLStore::updatePropertyTableDefinitionsto add additional table definitions during initializationSMW::SQLStore::EntityReferenceCleanUpCompleteto process information about an entity where the clean-up has been finalized
Installer
SMW::SQLStore::Installer::BeforeCreateTablesCompleteto add additional table indicesSMW::SQLStore::Installer::AfterCreateTablesCompleteto add extra tables after the creation process as been finalizedSMW::SQLStore::Installer::AfterDropTablesCompleteto remove extra tables after the drop process as been finalized
Query
SMW::Store::BeforeQueryResultLookupCompleteto return aQueryResultobject before the standard selection process is started and allows to suppress the standard selection process completely by returningfalseSMW::Store::AfterQueryResultLookupCompleteto manipulate aQueryResultafter the selection process
Parser, annotations, and revision
SMW::Parser::BeforeMagicWordsFinderto extend the magic words list that theInTextAnnotationParsershould inspect on a given text sectionSMW::Parser::AfterLinksProcessingCompleteto add additional annotation parsing afterInTextAnnotationParserhas finished the processing of standard annotation links (e.g.[[...::...]])SMW::Parser::ParserAfterTidyPropertyAnnotationCompleteallows to add additionalPropertyAnnotatoras part of theParserAfterTidyafter default annotators have been executedSMW::FileUpload::BeforeUpdateto add extra annotations on aFileUploadevent before theStoreupdate is triggeredSMW::RevisionGuard::ChangeRevisionto forcibly change a revision used during content parsingSMW::RevisionGuard::ChangeRevisionIDto forcibly change the revision ID as in case of theFactboxwhen building the content.SMW::RevisionGuard::IsApprovedRevisionto define whether a revision is approved or needs to be suppressed.SMW::RevisionGuard::ChangeFileto forcibly change the file version used
Miscellaneous
SMW::Factbox::BeforeContentGenerationto replace or amend text elements shown in a FactboxSMW::Browse::AfterIncomingPropertiesLookupCompleteto extend the incoming properties display forSpecial:BrowseSMW::Browse::BeforeIncomingPropertyValuesFurtherLinkCreateto replace the standardSearchByPropertywith a custom link inSpecial:Browseto an extended list of results (returnfalseto replace the link)SMW::Browse::AfterDataLookupCompleteto extend the HTML with data displayed onSpecial:BrowseSMW::Admin::RegisterTaskHandlersto extend availableTaskHandlerused in theSpecial:SemanticMediaWikidashboardSMW::ResultFormat::OverrideDefaultFormatto override the default result format handlingSMW::Job::AfterUpdateDispatcherJobCompleteto add additional update jobs for a property and related subjectsSMW::Exporter::Controller::AddExpDatato add additional RDF data for a selected subjectSMW::Maintenance::AfterUpdateEntityCollationCompleteruns after theupdateEntityCollection.phpscript has finished processing the update of entity collation changes
Deprecated hooks
smwInitDatatypes(since 1.9)smwInitProperties(since 2.1)smwShowFactbox(since 2.1)smwRefreshDataJobs(since 2.3)smwUpdatePropertySubjects(since 1.9)smwAddToRDFExport(since 3.0)SMWSQLStore3::updateDataBefore(since 3.1)SMWSQLStore3::updateDataAfter(since 2.3)SMWStore::updateDataBefore(since 3.1)SMWStore::updateDataAfter(since 3.1)SMWResultFormat(since 3.1)