I would like to add a similar to default articles tag field type: A dropdown with predefined selects, but someone can add their own values also.
What type of field type is this? And how could I add it inside a custom component?
To save me repeating it all here, I'll link to this helpful article that explains it step by step:
You can use the Tag form field type. This field type is available in Joomla 3.1 and newer, and works basically like this:
<field name="tags" type="tag" label="JTAG" description="JTAG_DESC" mode="ajax" class="inputbox span12 small" multiple="true" />
mode="ajax" is required in order to allow on-the-fly tag creation.
More information on using tags in your extension can be found here.
Use the tag form field type:
//Get custom field $getInput = JFormHelper::loadFieldType('Tag', false); $taginput = $tags->getInput();