Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Disabling plain text

edited September 2006 in Vanilla 1.0 Help
I'm curious as to if there is some way to change the "Format comments as" box in the options. Basically, I want to allow HTML, and Textile, but use both, and have no selection for anything :)


  • Options
    MarkMark Vanilla Staff
    edited July 2006
    Well, first you'd have to make your extension remove the text option from the StringManagers array.
    Then you'd have to write an extension that follows both the rules of html and textile.

    I imagine it would be something like this:

    // Remove all existing formatters from the StringManipulator object $Context->StringManipulator->Formatters = array(); $Context->StringManipulator->GlobalFormatters = array(); // Declare your new StringFormatter $Context->Dictionary["HTMLExtile"] = "HTMLExtile"; class HTMLExtileFormatter extends StringFormatter { function Parse($String, $Object, $FormatPurpose) { // Do your string manipulation here... return $String; } } // Instantiate the formatter and add it to the context object's string manipulator $HTMLExtileFormatter = $Context->ObjectFactory->NewContextObject($Context, "HTMLExtileFormatter"); $Context->StringManipulator->AddManipulator("HTMLExtile", $HTMLExtileFormatter);

    I haven't tested it, of course, but I'm pretty sure that will do it.
  • Options
    kalikianakalikiana New
    edited July 2006
    That looks just like the tutorial I followed while trying to make an extension... maybe it's worth a try to look at it again.
  • Options
    have you got something similar to remove the text bullets and allow just BetterBBcode all the time?
  • Options
    edited September 2006
    @ lowbenzo: try...
  • Options
    edited September 2006
    About the code Mark posted, it work fine if no comments have been post before with an other FormatType.
    With a previous text comment, you get this message:
    "Notice: Undefined index: Text in /path/to/library/Framework/Framework.Class.StringManipulator.php on line 98
    Fatal error: Call to a member function on a non-object in path/to/library/Framework/Framework.Class.StringManipulator.php on line 100".

    To fix it you just need to add in the extension:$Context->Configuration['DEFAULT_FORMAT_TYPE'] = 'HTMLExtile';
This discussion has been closed.