How To Make An Addon Resource?

Well I created some phrases to export with the add-on so that works ok at the moment but thanks for the tip :)

I also tried searching here for the suggestion to be able to attach Custom User Fields to add-ons but wasn't able to find it. Would really come in handy.
 
To set the title and description, before the line $dw->save(); add this:

PHP:
$dw->setExtraData(XenForo_DataWriter_UserField::DATA_TITLE, 'This is the title of the user field');
$dw->setExtraData(XenForo_DataWriter_UserField::DATA_DESCRIPTION, 'This is the description of the user field');
That automatically creates the phrases with the defined text.
Does this also associate the new phrases with the add-on?
 
Just to clarify, you had to manually associate the phrases after your add-on was installed? Subsequently editing the phrase then removes the association (by design, according to Mike).

So the answer to my original question is 'no, the phrases are not associated with the add-on when defined via setExtraData during the install'. Correct?
 
So the work-around is to manually define and associate the phrases with the add-on. When defined this way, you do not lose the association with the add-on after editing a phrase.
 
You can edit the phrase when associated but editing the user field removes the association. Better of not even assigning the phrase to the add-on. Do you plan on releasing this? I'd say just put the phrases in the install code for the DataWriter and leave it at that.
 
Top Bottom