Skip to content

Change value of Option #62

Open
Open
@Capt-Zeanie

Description

@Capt-Zeanie

Is there a way to change the value of the option

Example:
I am using SCEditor to create my BBCode. In the editor it has font size which is create a bbcode tag of
[size=4]this is font size 4 ie 18px [/size]

Now I want JBBCode to read the 4 and then validate it, and then return the correct font size value in the validation function which is then placed in the html render.
eg.

style="font-size:18px">this is font size 4 ie 18px

However I keep getting

style="font-size:4px">this is font size 4 ie 18px

How do I change the option value for a new value.

I am using JBBCode to read this size using...
$builder = new CodeDefinitionBuilder('size', '

{param}

');
$builder->setUseOption(true)->setOptionValidator(new \JBBCode\validators\FontValidator());
array_push($this->definitions, $builder->build());

My fontValidator is...
public function validate($input)
{
if (is_numeric($input) && $input <= 7 && $input >= 1) {
switch ($input) {
case 1:
return 10;
break;
case 2:
return 13;
break;
case 3:
return 16;
break;
case 4:
return 18;
break;
case 5:
return 24;
break;
case 6:
return 32;
break;
case 7:
return 48;
break;
}
} else {
return 16;
}
}

Thank you so much if you help me

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions