{"id":28075213,"url":"https://github.com/getk2/k2-example-plugin","last_synced_at":"2025-05-13T00:55:22.449Z","repository":{"id":10317409,"uuid":"12444547","full_name":"getk2/k2-example-plugin","owner":"getk2","description":"Example K2 Plugin (for developers)","archived":false,"fork":false,"pushed_at":"2018-02-08T09:28:30.000Z","size":15,"stargazers_count":8,"open_issues_count":1,"forks_count":3,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-05-13T00:55:17.404Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/getk2.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-08-28T21:03:41.000Z","updated_at":"2019-07-11T14:19:27.000Z","dependencies_parsed_at":"2022-08-29T10:41:12.699Z","dependency_job_id":null,"html_url":"https://github.com/getk2/k2-example-plugin","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getk2%2Fk2-example-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getk2%2Fk2-example-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getk2%2Fk2-example-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getk2%2Fk2-example-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/getk2","download_url":"https://codeload.github.com/getk2/k2-example-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253850891,"owners_count":21973672,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-13T00:55:21.930Z","updated_at":"2025-05-13T00:55:22.435Z","avatar_url":"https://github.com/getk2.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Example K2 plugin (for developers)\n=========\n\n*Please note that this K2 plugin for Joomla is intended for Joomla extension developers only*\n\nOne of the things that make K2 very powerful is the K2 plugin API, which is built on top of Joomla's plugin API.\n\nUsing a K2 plugin you can easily extend the forms used for items, categories and user profiles. That means you can write a simple plugin to add additional fields and extend K2 forms beyond \"extra fields\". So you can write any plugin that brings programmatic logic inside the K2 item, category and user forms, which is by definition beyond the powers of any \"CCK\" system.\n\nThe K2 plugin has 8 trigger events for the frontend and another 8 for the backend (so you can create additional fields in your K2 forms and then display them in your site). The naming conventions are similar to Joomla's. For the item display in the frontend we have 6 events, identical to Joomla's plugin events and named with the \"onK2\" prefix instead of just \"on\". There is 1 event for the category display and 1 more for the user profile display in the frontend. There are also 6+2 events for the backend, which are used to extend the backend forms for the item (one for each tab of the item form plus one generic), category and user profile forms.\n\nSince we're basically adding fields in the backend for these 3 forms, we need to define these fields somewhere. We do so inside the XML of the plugin by defining additional \"groups\" of parameters (or fields in Joomla 2.5 or newer).\n\nIf we want to extend the item form for example, we create a new parameter \u003cparams\u003e group with the attribute \"name\" and value \"item-content\" or \"item-video\" (where the value part targets a specific tab in the item form). In a similar fashion, we create parameter groups for \"category\" and \"user\". In these groups we can now write new fields in XML format and we can also make use of Joomla content elements (or write our own). These XML fields will extend the forms in the backend. To display the output of these forms in the frontend, we just use a function to render the form values entered.\n\nJust to wrap things up, this is the basic concept of a K2 plugin: We define XML fields in the plugin, which extend the item, category and user forms in the backend. Then we use a function in the frontend (in the main plugin php file) to render these fields.\n\nDownload the example plugin we provide and examine the code. This example plugin adds an extra field where you can input a YouTube URL and it will automatically convert it to a video in the frontend. We extend all 3 forms in the backend (item, category, user).\n\nThe plugin can be installed using Joomla extension installer.\n\nK2 plugins are installed inside the \"/plugins/K2/\" folder in your Joomla site.\n\n\n### FEATURES\nA example K2 plugin for Joomla intended for Joomla extension developers only. It will create a field in the K2 item form to insert a YouTube video URL, which will then be rendered in the item page (in the site frontend).\n\nUse it to learn the K2 plugin API and build Joomla extensions that interface with K2.\n\n\n### DEMO \u0026 SHOWCASE\nThere is no demo or showcase available for this extension. But all the K2 extensions referenced here http://getk2.org/show/tag/built%20by%20joomlaworks have been developed from this plugin.\n\n\n### REQUIREMENTS\nThis is a K2 plugin for Joomla and the only basic requirements to use it are:\n\n- K2 v2.6.x or newer installed\n- Joomla 2.5 or 3.x installed\n\n\n### LICENSE\nThis is a Joomla extension developed by JoomlaWorks and released under the GNU/GPL v2 license.\n\n\n### ADDITIONAL INFO\nSome helpful links:\n\n- K2 - https://getk2.org\n- Joomla - https://www.joomla.org\n\nIf you want to provide feedback for this Joomla plugin, you may use the GitHub issue tracker here: https://github.com/getk2/k2-example-plugin/issues\n\n\n## DOWNLOAD\nYou can grab the latest release here: https://github.com/getk2/k2-example-plugin/archive/master.zip\n\nTo install this Joomla plugin, download the file in your computer and then head over to the Joomla installer and choose to upload the file you just downloaded.\n\nAn older release for Joomla 1.5 can be found here: https://github.com/getk2/k2-example-plugin/releases/download/v2.1/plg_k2_example-v2.1_j1.5-1.7.zip\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetk2%2Fk2-example-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgetk2%2Fk2-example-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetk2%2Fk2-example-plugin/lists"}