localizer = $localizer; $this->pinned = $pinned; $this->id = $id; $this->featureName = $featureName; $this->moveElement = $moveElement; $this->labelTagName = $labelTagName; } /** * @inheritDoc */ public function getTemplateData(): array { $messageLocalizer = $this->localizer; $data = [ 'is-pinned' => $this->pinned, 'label' => $messageLocalizer->msg( $this->id . '-label' ), 'label-tag-name' => $this->labelTagName, 'pin-label' => $messageLocalizer->msg( 'vector-pin-element-label' ), 'unpin-label' => $messageLocalizer->msg( 'vector-unpin-element-label' ), 'data-pinnable-element-id' => $this->id, 'data-feature-name' => $this->featureName ]; if ( $this->moveElement ) { // Assumes consistent naming standard for pinnable elements and their containers $data = array_merge( $data, [ 'data-unpinned-container-id' => $this->id . '-unpinned-container', 'data-pinned-container-id' => $this->id . '-pinned-container', ] ); } return $data; } }