Source of file CustomHtmlEditorFieldExtension.php
Size: 1,459 Bytes - Last Modified: 2021-12-23T10:05:50+00:00
/var/www/docs.ssmods.com/process/src/code/CustomHtmlEditorFieldExtension.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 | <?php /** * An extension of HTMLEditorField that lets you set editor-specific body class names and TinyMCE configs */ class CustomHtmlEditorFieldExtension extends Extension { /** * * @param string $identifier */ public function setEditorConfig($identifier) { CustomHTMLEditorField::set_editor_config($this->owner, $identifier); return $this->owner; } /** * Get the identifier for this field's HTMLEditorConfig * * @return string */ public function getEditorConfigID() { return CustomHTMLEditorField::get_editor_config($this->owner); } /** * Return this field's HTMLEditorConfig * * @return HTMLEditorConfig */ public function getEditorConfig() { return HTMLEditorConfig::get($this->getEditorConfigID()); } /** * Convenience method for setting body classes. Just slightly nicer than using setAttribute(). * NOTE: the specified classes will be APPENDED to the config's body_class property, not replace it * * @param string $classes */ public function setBodyClass($classes) { $this->owner->setAttribute('data-body-class', $classes); return $this->owner; } /** * Return This field's body class setting * * @return string */ public function getBodyClass() { $this->owner->getAttribute('data-body-class'); } } |