diff --git a/README.MD b/README.MD index c1e09c1..9b16293 100644 --- a/README.MD +++ b/README.MD @@ -180,6 +180,13 @@ craft.faker.navigation(4) craft.faker.navigation(4, true) ``` +## Redactor +Designed to mimic a Redactor field, the function will accept a single string and return a Redactor\FieldData object. + +``` +craft.faker.redactor("A string that can contain HTML") +``` + ## Contact Jordan Beattie
jordan@mission10.co.uk
diff --git a/src/variables/FakerVariable.php b/src/variables/FakerVariable.php index 7535484..9274b61 100644 --- a/src/variables/FakerVariable.php +++ b/src/variables/FakerVariable.php @@ -99,5 +99,13 @@ public function icon($icon = null, $sprite = null, $glyphId = null, $glyphName = { return new Icon($icon, $sprite, $glyphId, $glyphName, $iconSet, $type, $css, $width, $height); } + + public function redactor( $copy ) + { + return $field = new \craft\redactor\FieldData( $copy ); + $field->content = $copy; + $field->charset = "UTF-8"; + return $field; + } }