1 month ago
0
Topic

Hello,dear users and developers of the wonderful SEBLOD content builder!

I find it very convenient to use Typo HTML and suggest a way to use custom attributes of the Select Simple field here, for example as follows:

This can be useful if, depending on the value of the field, you need to use the appropriate attributes.

For this to work, you need to file plugins/cck_field_typo/html/html.php , inside the description of the plg CCK_Field_Type Html class, add the following lines:

if ( $html != '' && strpos( $html, '*attr' ) !== false ) { 

    $arr = json_decode($field->options2);

    for ($n = 0; $n <= 5; $n++) { 

        $search = '*attr' . (string)$n . '*'; 

        $replace = $arr->options[(int)$field->value]->attr[$n]; 

        $html=str_replace( $search, $replace, $html ); 

    } 

}

Result:

So far, we have to make a copy of this file so that it is not lost during the update, but I think it would be nice to include this code (possibly improved to refer to attributes not by number, but by name) in the official version.

Get a VIP membership