localizer = $localizer; $this->pinned = $pinned; $this->name = $name; $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->name . '-label' ), 'label-tag-name' => $this->labelTagName, 'pin-label' => $messageLocalizer->msg( 'vector-pin-element-label' ), 'unpin-label' => $messageLocalizer->msg( 'vector-unpin-element-label' ), 'data-name' => $this->name, 'data-feature-name' => $this->featureName ]; if ( $this->moveElement ) { // Assumes consistent naming standard for pinnable elements and their containers $data = array_merge( $data, [ 'data-pinnable-element-id' => $this->name . '-pinnable-element', 'data-unpinned-container-id' => $this->name . '-unpinned-container', 'data-pinned-container-id' => $this->name . '-pinned-container', ] ); } return $data; } }