Skip to content

Commit

Permalink
Added redactor function
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Beattie committed Aug 3, 2023
1 parent 2e6130e commit 7357b30
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -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 <u>HTML</u>")
```

## Contact
Jordan Beattie <br>
jordan@mission10.co.uk <br>
Expand Down
8 changes: 8 additions & 0 deletions src/variables/FakerVariable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

}

0 comments on commit 7357b30

Please sign in to comment.