Despite being possible to duplicate and rename plugin's files by examining the XML file of the plugin, it is not feasible duplicate plugins like we duplicate templates, because we can not update field-type name references and file references inside the source code in a fail-proof way.
So in order to duplicate plugins we have to do it manually,
But for a developer it is easy to do it
e.g. to duplicate text field and create a new field called "myfield"
- Duplicate folder:
plugins/flexicontent_fields/text/
- Rename the copied folder to be:
plugins/flexicontent_fields/myfield/
- Rename the files
text.php and text.xml
to be
myfield.php and myfield.xml
- Copy (inside the above folder) the language file:
administrator/languages/en-GB/en-GB.plg_flexicontent_fields_text.ini
and rename it to be:
en-GB.plg_flexicontent_fields_myfield.ini
- Replace all field-type name references inside myfield.php with the new field name:
(A) replace (multiple times)
plgFlexicontent_fieldsText
with
plgFlexicontent_fieldsMyfield
(B) replace
static $field_types = array('text', 'textselect');
with
static $field_types = array('myfield');
doing the above, you are (probably) DONE with this file
------------------------------------------------------------------------
BUT please note thus:
some words inside the above file, may contain the field name e.g. the class name JText contains the field name "text", but it must not be changed.
e.g. text-align: left;
e.g. SELECT DISTINCT value, value as text
-- so if you do SEARCH AND REPLACE,
then IT must be with CONFIRMATION OF EVERY REPLACEMENT,
but the above mentioned replacements should be enough !
- Replace all field-type name references inside myfield.xml with the new field-type name:
(A) replace
<name>FLEXIcontent - Text</name>
with
<name>FLEXIcontent - Myfield</name>
(B) replace
<filename plugin="text">text.php</filename>
<filename plugin="myfield">myfield.php</filename>
(C) replace
<fieldset name="group-text" addfieldpath="/administrator/components/com_flexicontent/elements">
with
<fieldset name="group-myfield" addfieldpath="/administrator/components/com_flexicontent/elements">
(D) replace
<language tag="en-GB">en-GB.plg_flexicontent_fields_text.ini</language>
with
<language tag="en-GB">en-GB.plg_flexicontent_fields_myfield.ini</language>
- EDIT field source code to achieve the desired behavior
- ZIP the folder:
plugins/flexicontent_fields/myfield/
- Install the zip file with the new plugin via Joomla installer, OR TRY to use discover extensions in J2.5 + and install plugin like that ...