PHP code example of fede91it / fof-nnrelation

1. Go to this page and download the library: Download fede91it/fof-nnrelation library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fede91it / fof-nnrelation example snippets


class FoobarDispatcher extends F0FDispatcher
{
  public function onBeforeDispatch()
  {
    // Add multiple to multiple relations support
    jimport('f0f-nnrelation.fields.nnrelation');
    jimport('f0f-nnrelation.fields.header.nnrelation');
    jimport('f0f-nnrelation.models.nnrelation');
    jimport('f0f-nnrelation.tables.nnrelation');
    
    return parent::onBeforeDispatch();
  }
}
xml
<view name="teams">
  <config>
    <option name="behaviors">nnrelation</option>
  </config>
</view>
xml
<field name="players"
       type="nnrelation"
       empty_replacement="COM_FOOBAR_NO_PLAYERS_LABEL"
       url="index.php?option=com_foobar&amp;view=player&amp;id=[ITEM:FOOBAR_PLAYER_ID]"
       show_link="true"/>