} else {
$figure->setAttribute('class', 'image');
}
- if ($width !== 'auto' && \is_numeric($width) && $width > 0) {
- $figure->setAttribute(
- 'style',
- $this->getStyle($attachment, $width)
- );
- }
+
+ $figure->setAttribute(
+ 'style',
+ $this->getStyle($attachment, $width)
+ );
+
$figure->appendChild($element);
return $figure;
}
interface IMetacodeUpcast
{
/**
+ * Converts a known metacode into the HTML representation for use by CKEditor5.
+ *
+ * The fragment must be inserted into your returned DOM element.
*
* @param \DOMDocumentFragment $fragment fragment containing all child nodes, must be appended to returned element
* @param array $attributes list of attributes
*/
public function upcast(\DOMDocumentFragment $fragment, array $attributes): ?\DOMElement;
+ /**
+ * Returns true if the given attributes are valid for this upcast.
+ * If not, the metacode is converted to a text node with the bbcode output.
+ *
+ * @param array $attributes
+ * @return bool
+ */
public function hasValidAttributes(array $attributes): bool;
+
+ /**
+ * Caches the object for the given attributes.
+ *
+ * @param array $attributes
+ */
public function cacheObject(array $attributes): void;
}