prototype(Newland.CityTheme:SearchButton) < prototype(Neos.Neos:Content) {
    // get search page from search settings
    @context.searchPage = Neos.Neos:NodeUri {
        node = ${q(site).find('#' + String.split(Configuration.setting('Newland.Toubiz.Search.Neos.sites.default.mainSearchPage'), '/')[2]).get(0)}
    }

    buttonType = ${q(site).property('buttonType')}

    link = Neos.Fusion:Case {
        backend {
            condition = ${node.context.inBackend}
            renderer = '#0'
        }

        internal {
            condition = ${q(node).property('link')}
            renderer = ${q(node).property('link')}
            renderer.@process.convertUris = Neos.Neos:ConvertUris
        }

        search {
            condition = ${q(node).property('searchQuery') != ''}
            @context.searchQuery = ${q(node).property('searchQuery')}

            renderer = ${searchPage + '?search=' + searchQuery}
        }
    }
    
    node = ${(node)}

    @cache {
        mode = 'uncached'
        context {
            1 = 'site'
            2 = 'node'
        }
    }
}
