Blame | Last modification | View Log | Download
<?php namespace ProcessWire;/*** Textformatter PrivacyWire* This module adds the textformatter for PrivacyWire*** @author blaueQuelle** ProcessWire 3.x* Copyright (C) 2011 by Ryan Cramer* Licensed under GNU/GPL v2, see LICENSE.TXT** http://www.processwire.com* http://www.ryancramer.com**/class TextformatterPrivacyWire extends Textformatter implements Module{public static function getModuleInfo(){return ['title' => 'PrivacyWire Textformatter','summary' => "PrivacyWire Textformatter to render privacy options via shortcode [[privacywire-choose-cookies]]",'author' => 'blaueQuelle','href' => "https://github.com/blaueQuelle/privacywire",'version' => 7,'requires' => ["PHP>=7.2","ProcessWire>=3.0.110"],];}public function formatValue(Page $page, Field $field, &$str){$privacyWire = $this->modules->get("PrivacyWire");// Multi Language Supportif ($this->wire('languages')) {$userLanguage = $this->wire('user')->language;$lang = $userLanguage->isDefault() ? '' : "__$userLanguage->id";} else {$lang = '';}$tag_search = $this->open_tag . "privacywire-choose-cookies" . $this->close_tag;$tag_replace = "<button class='button privacywire-show-options'>{$privacyWire->get("textformatter_choose_label$lang|textformatter_choose_label")}</button>";$str = str_replace($tag_search, $tag_replace, $str);}}