getHomepage(); if (!$homepage->getId() || !$this->authorization->isAllowed('Esun_MultiLocaleTranslation::translate_wiki') ) { return $html; } $config = [ 'entityType' => 'wiki_homepage', 'entityId' => (int)$homepage->getId(), 'sourceStoreId' => 0, 'storesUrl' => $subject->getUrl('localetranslate/translation/stores'), 'fieldsUrl' => $subject->getUrl('localetranslate/translation/fields'), 'applyUrl' => $subject->getUrl('localetranslate/translation/apply'), 'autoTranslateUrl' => $subject->getUrl('localetranslate/translation/autotranslate'), ]; $button = sprintf( '', htmlspecialchars((string)json_encode($config, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT), ENT_QUOTES), __('Translate') ); return preg_replace('/(
)/', '$1' . $button, $html, 1) ?? $html; } }