Fix Travis test error
This commit is contained in:
parent
893843969f
commit
a9c9c21d3b
@ -76,7 +76,8 @@ abstract class AbstractContainer extends AbstractElement
|
|||||||
{
|
{
|
||||||
$elements = array('Text', 'TextRun', 'Link', 'PreserveText', 'TextBreak',
|
$elements = array('Text', 'TextRun', 'Link', 'PreserveText', 'TextBreak',
|
||||||
'ListItem', 'ListItemRun', 'Table', 'Image', 'Object', 'Footnote',
|
'ListItem', 'ListItemRun', 'Table', 'Image', 'Object', 'Footnote',
|
||||||
'Endnote', 'CheckBox', 'TextBox', 'Field', 'Line', 'Shape');
|
'Endnote', 'CheckBox', 'TextBox', 'Field', 'Line', 'Shape',
|
||||||
|
'Title', 'TOC', 'PageBreak');
|
||||||
$functions = array();
|
$functions = array();
|
||||||
for ($i = 0; $i < count($elements); $i++) {
|
for ($i = 0; $i < count($elements); $i++) {
|
||||||
$functions[$i] = 'add' . $elements[$i];
|
$functions[$i] = 'add' . $elements[$i];
|
||||||
|
|||||||
@ -298,22 +298,23 @@ abstract class AbstractElement
|
|||||||
*/
|
*/
|
||||||
private function setMediaRelation()
|
private function setMediaRelation()
|
||||||
{
|
{
|
||||||
if ($this->mediaRelation === false) {
|
if (!$this instanceof Link && !$this instanceof Image && !$this instanceof Object) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$mediaPart = $this->getMediaPart();
|
|
||||||
$elementName = substr(get_class($this), strrpos(get_class($this), '\\') + 1);
|
$elementName = substr(get_class($this), strrpos(get_class($this), '\\') + 1);
|
||||||
|
$mediaPart = $this->getMediaPart();
|
||||||
/** @var \PhpOffice\PhpWord\Element\Image $this Type hint */
|
|
||||||
$source = $this->getSource();
|
$source = $this->getSource();
|
||||||
$image = ($elementName == 'Image') ? $this : null;
|
$image = null;
|
||||||
|
if ($this instanceof Image) {
|
||||||
|
$image = $this;
|
||||||
|
}
|
||||||
$rId = Media::addElement($mediaPart, strtolower($elementName), $source, $image);
|
$rId = Media::addElement($mediaPart, strtolower($elementName), $source, $image);
|
||||||
$this->setRelationId($rId);
|
$this->setRelationId($rId);
|
||||||
|
|
||||||
if ($elementName == 'Object') {
|
if ($this instanceof Object) {
|
||||||
/** @var \PhpOffice\PhpWord\Element\Object $this Type hint */
|
$icon = $this->getIcon();
|
||||||
$rId = Media::addElement($mediaPart, 'image', $this->getIcon(), new Image($this->getIcon()));
|
$rId = Media::addElement($mediaPart, 'image', $icon, new Image($icon));
|
||||||
$this->setImageRelationId($rId);
|
$this->setImageRelationId($rId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user