I'm trying to make a plugin more generally usable (so others could use it). For my own use, it uses a category field called 'mainCategory' but I'd like that the field handle could be specified in the plugin settings.
What I imagine is:
$url = $entry->mainCategory->last()->uri;
$plugin = craft()->plugins->getPlugin('myPlugin'); $settings = $plugin->getSettings(); $fieldHandle = $settings->categoryFieldHandle; $url = $entry->getField($fieldHandle)->last()->uri;