/** * Store information about raw content of all galleries in article to handle images in infoboxes * * @param $name Parser tag name * @param $marker substitution marker * @param $content raw tag contents * @param $attributes * @param $parser * @param $frame */ public static function onParserTagHooksBeforeInvoke($name, $marker, $content, $attributes, $parser, $frame) { if ($name === self::PARSER_TAG_GALLERY) { \Wikia\PortableInfobox\Helpers\PortableInfoboxDataBag::getInstance()->setGallery($marker, $content); } return true; }
public function getData() { if (!isset($this->data)) { $imageData = $this->getRawValueWithDefault($this->xmlNode); if (is_string($imageData) && PortableInfoboxDataBag::getInstance()->getGallery($imageData)) { $imageData = PortableInfoboxDataBag::getInstance()->getGallery($imageData); } $title = $this->getImageAsTitleObject($imageData); $this->getExternalParser()->addImage($title ? $title->getDBkey() : $imageData); $ref = null; $alt = $this->getValueWithDefault($this->xmlNode->{self::ALT_TAG_NAME}); $caption = $this->getValueWithDefault($this->xmlNode->{self::CAPTION_TAG_NAME}); wfRunHooks('PortableInfoboxNodeImage::getData', [$title, &$ref, $alt]); $this->data = ['url' => $this->resolveImageUrl($title), 'name' => $title ? $title->getText() : '', 'key' => $title ? $title->getDBKey() : '', 'alt' => $alt, 'caption' => $caption, 'ref' => $ref]; } return $this->data; }