<p>This is what the function currently does</p>

<pre><code>public function tweetButton($options = [])
{
    $dataAttributes = $this-&gt;getOptionsAsDataAttributes($options);

    $html = '&lt;a class="twitter-share-button" href="https://twitter.com/share"'.$dataAttributes.'&gt;Tweet&lt;/a&gt;';

    return $html;
}
</code></pre>

<p>So it returns an <code>a</code> tag rather than a link. You should remove your outer tag but you can't place your custom text. You would have to use a <a href="https://twig.symfony.com/doc/2.x/filters/replace.html" rel="nofollow noreferrer">string replace function</a> </p>

<pre><code>{{ twitterTweetButton()|replace({'&gt;Tweet&lt;':' &gt;my custom text&lt;' }) }} 
</code></pre>

CC BY-SA 3.0
2018-04-18T23:55:12.703Z
Thanks Robin, what I am trying to figure out is how to use these Twig functions (see above). The example I used to change the text for example, however I didn't get any results. PS: the string replacement doesn't work either...
Nutmeg
CC BY-SA 3.0
2018-04-18T23:57:43.467Z
Like I said, this won't do anything because the function does not work the way you want. As you can see there is no way to change the text. It's a hard coded string. You need to use the `replace` filter
Robin Schambach
CC BY-SA 3.0
2018-04-19T00:08:18.683Z
The plugin's manual tells otherwise, thats all, however these instructions are related to Dukt's Craft 2 version. (see above) Thanks for your help, Robin.
Nutmeg
CC BY-SA 3.0
2018-04-19T04:46:55.207Z
Do you want to remove the "Tweet" string from the button or the text in the field? However it will still return a html element and no link
Robin Schambach
CC BY-SA 3.0
2018-04-19T08:09:02.723Z
Thank you, Robin - I don't want to waste more of your time. I've dropped all Dukt's plugins and am working on a custom solution..
Nutmeg
CC BY-SA 3.0
2018-04-18T23:24:24.727Z
2018-04-18T23:29:38.843Z
2018-04-18T23:29:38.843Z
Robin Schambach
<p>Require a little help with removing the pre-parsed text from Dukt's <code>{{ twitterTweetButton() }}</code></p>

<pre><code> &lt;li&gt;&lt;a href="  {{ twitterTweetButton({
                        text: "some text",
                        target: "_blank"
                    }) }}"&gt;&lt;i class="fa fa-twitter" aria-hidden="true"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
</code></pre>

<p>This does not work....</p>

<p>The docs specify the following Twig functions:</p>

<ul>
<li><code>text</code> — Pre-populated text highlighted in the Tweet composer.</li>
<li><code>url</code> — URL included with the Tweet.</li>
<li><code>hashtags</code> — A comma-separated list of hashtags to be appended to
default Tweet text.</li>
<li><code>via</code> — Attribute the source of a Tweet to a Twitter username.</li>
<li><code>related</code> — A comma-separated list of accounts related to the content
of the shared URI.</li>
<li><code>size</code> — Set to large to display a larger button.</li>
<li><code>lang</code> — A supported Twitter language code. Loads text components in
the specified language. Note: does not affect the text of the cited
Tweet.</li>
<li><code>dnt</code> — When set to true, the Tweet and its embedded page do not
influence Twitter targeting including suggested accounts.</li>
</ul>

<plugin-dukttwitter>
Tweaking the Tweet Follow Button
# Tweaking the Tweet Follow Button

(Asked by: username_0 on 2018-04-18)

Require a little help with removing the pre-parsed text from Dukt's {{ twitterTweetButton() }}
 

This does not work....
The docs specify the following Twig functions:

text — Pre-populated text highlighted in the Tweet composer.
url — URL included with the Tweet.
hashtags — A comma-separated list of hashtags to be appended to
default Tweet text.
via — Attribute the source of a Tweet to a Twitter username.
related — A comma-separated list of accounts related to the content
of the shared URI.
size — Set to large to display a larger button.
lang — A supported Twitter language code. Loads text components in
the specified language. Note: does not affect the text of the cited
Tweet.
dnt — When set to true, the Tweet and its embedded page do not
influence Twitter targeting including suggested accounts.

**Tags:** plugin-dukttwitter


---

## 1 answers

### Answer by username_1 on 2018-04-18. Score: 1

This is what the function currently does
public function tweetButton($options = [])
{
    $dataAttributes = $this->getOptionsAsDataAttributes($options);

    $html = 'Tweet';

    return $html;
}

So it returns an a tag rather than a link. You should remove your outer tag but you can't place your custom text. You would have to use a string replace function 
{{ twitterTweetButton()|replace({'>Tweet<':' >my custom text<' }) }}

> **Comments:**
> **username_0**: Thanks Robin, what I am trying to figure out is how to use these Twig functions (see above). The example I used to change the text for example, however I didn't get any results. PS: the string replacement doesn't work either...  
> **username_1**: Like I said, this won't do anything because the function does not work the way you want. As you can see there is no way to change the text. It's a hard coded string. You need to use the `replace` filter  
> **username_0**: The plugin's manual tells otherwise, thats all, however these instructions are related to Dukt's Craft 2 version. (see above) Thanks for your help, Robin.  
> **username_1**: Do you want to remove the "Tweet" string from the button or the text in the field? However it will still return a html element and no link  
> **username_0**: Thank you, Robin - I don't want to waste more of your time. I've dropped all Dukt's plugins and am working on a custom solution..  

---

