Custom field type that has multiple fields to extend the default field types Ok scenario that I'd like to create.
Create a custom field type lets call it videos. In this field type you would have 5 separate fields title, description, caption, link, thumb. This would make up the field type which could then be selected from the field type when creating a new field in the CP.

The objective is that this grouped field type could then be re-used within separate matrix fields or as a field in it's own right.

I know you can create field types for plugins but is there a way to create the above?
I would say you can do this yeah, it just take a little figuring out is all.

Your input template could look something like:

&lt;input type="text" name="{{ name }}[title]" value="{{ value.title is defined ? value.title }}"&gt;
&lt;input type="text" name="{{ name }}[description]" value="{{ value.description is defined ? value.description }}"&gt;
&lt;input type="text" name="{{ name }}[caption]" value="{{ value.caption is defined ? value.caption }}"&gt;
&lt;input type="text" name="{{ name }}[thumb]" value="{{ value.thumb is defined ? value.thumb }}"&gt;


Then in your fieldtypes main class, something like:

public function getInputHtml($name, $value)
{

    // If value is null, we set it to an array to prevent template errors
    if(!$value)
    {
      $value = array();
    }

    return craft()-&gt;templates-&gt;render('bosh/input', array(
        'name'  =&gt; $name,
        'value' =&gt; $value
    ));
}

public function prepValueFromPost($value)
{   
    return json_encode($value);
}

public function prepValue($value)
{
    return json_decode($value, TRUE);
}


So basically you are settings the fieldtype value to an array of pluginHandle[field] which then you json_encode so it can all go into database without any issues.

Then when you retrieve the value from the DB, its a string, so you json_decode it into an array. The TRUE part states you want an associative array, rather than a stdClass object.

Thats pretty much it at a basic level :)