Portal

外掛開發

From Joomla! Documentation

This page is a translated version of the page Portal:Plugin Development and the translation is 100% complete.
外掛開發


本頁包含了許多從說明文件摘錄的超連結內容,關於Joomla 2.5 以及 Joomla 3.x 模外掛開發。.一個好的開始是閱讀底下的閱讀清單 文章,因為他們提供了很好的引導來幫助您建立基礎知識。

什麼是外掛?

外掛是 Joomla! 擴充套件的一種類型。外掛提供了功能,來關聯於觸發事件。Joomla 提供了一些核心的外掛事件,然而任何擴充套件都可以觸發(客製化)事件。當特定事件發生時,所有和該事件關聯的外掛功能會依次被執行。這是擴展Joomla核心功能強大的方式。這也提供擴充套件開發者一個途徑,讓其它擴充套件能回應他們的行為,讓擴充套件還能再被擴充。

Joomla! 外掛架構依循觀察者設計模式(Observer Pattern ),JPlugin class 提供了方法來註冊外掛程式碼到核心或是其他客製化事件。JEventDispatcher class 是一個事件處理程序,當事件觸發時,為特定事件呼叫所有已註冊的外掛。在 Joomla 4.x我們將之移動到 Joomla 的 \Joomla\Event\Dispatcher ,並且另行遵循了 中介者設計模式(Mediator pattern)

延伸閱讀: 元件, 模組,佈景主題


使用外掛


外掛會依照它們執行的 event 來做分組,依據 event 類型分組的 event 完整清單,可以在 這裡的清單找。 (在版本 Joomla 1.5 過渡到 Joomla 2.5 之際,有好些 event 的命名有更改過,請見這裡 有詳細的變更項目清單)。也有一些簡單的教學,說明如何開發外掛,擴展搜尋和智慧搜尋元件,使用當中的一些event來執行搜尋工作:

這裡還有一些進一步的教學,利用用戶觸發,來說明如何建立用戶認證外掛,協助用戶登入Joomla以及建立 Joomla 個人資料外掛。

內容外掛可以被用於新增客製化欄位到核心元件中。以下的教學說明如何在您的網站上顯示新類型的欄位。

使用外掛來建立新的系統路由 (system router)是一個更複雜的例子,產生 URLs (僅適用於(Joomla 2.5 ))。


閱讀清單

以下的文章將會幫助您熟習Joomla! 外掛,他們將會是您認識以及開發外掛很好的出發點。

初級

要認識如何安裝並使用Joomla! 的外掛,建議要閱讀 Joomla! 系統管理中的外掛

中級

要更進一步認識外掛,建議您建立一個基本的Joomla! 外掛

如果想要閱讀關於如何在客製化模組中,執行一個基本的內容外掛(content plugin),建議您先閱讀在您的擴充套件中觸發內容

進階

要認識外掛系統運作原則,請造訪 外掛開發者總覽。接著,如果您要在您設計的元件中佈署外掛,推薦您閱讀讓您的元件支援外掛



需要外掛開發文章


The Joomla! Documentation Wiki needs your help! Below is a list of pages/articles needed for Plugin Development. If you know of a topic which needs to be addressed, just add it to the List of Red Links below by using the following wikimarkup.

Want or Need a New Article on Plugin Development?

To add a Red Link click here and add it to the Plugins Development Projects page. Please use the following wikimarkup code to add the suggested topic to the list:

*[[Put your Plugin Article name here]]

List of Red Links for needed Plugin Development Articles: