Results 1 to 2 of 2

Thread: [SOLVED] Getting access to other fields in options_callback

  1. #1
    User
    Join Date
    08-07-09.
    Location
    Kent, United Kingdom
    Posts
    92

    Default [SOLVED] Getting access to other fields in options_callback

    Hi all,
    I'm adding to tl_module to give the option for user login types via the DCA with the following:
    Code:
    $GLOBALS['TL_DCA']['tl_module']['fields']['logintypes'] = array(
    	'label'			=> &$GLOBALS['TL_DCA']['tl_module']['logintypes'],
    	'inputType'		=> 'checkbox',
    	'options_callback'	=> array('ef_member_login','options_logintypes'),
    	'eval'			=> array('multiple'=>true,'submitOnChange'=>true)
    
    );
    $GLOBALS['TL_DCA']['tl_module']['fields']['logintype_default'] = array(
    	'label'			=> &$GLOBALS['TL_DCA']['tl_module']['logintype_default'],
    	'inputType'		=> 'select',
    	'options_callback'	=> array('ef_member_login','options_logintype_default')
    );
    
    $GLOBALS['TL_DCA']['tl_module']['palettes']['ef_member_login']='name,type,headline;cols,jumpTo;guests,protected;align,space,cssID;logintypes,logintype_default';
    
    class ef_member_login extends ef_backend{
    	function options_logintypes(){
    		return $GLOBALS['eFLUX']['login']['username_fields'];
    	}
    	function options_logintype_default(){
    		return array('some options please');
    	}
    }
    option_logintypes() is fine, this gets the possible login types from the configuration file.
    What I want to do now is within options_logintype_default is to pick from the Model the options selected in logintypes.

    Possible?

    Cheers

  2. #2
    User
    Join Date
    08-07-09.
    Location
    Kent, United Kingdom
    Posts
    92

    Default Re: Getting access to other fields in options_callback

    Answered my own question, I was in a mess due to forgetting about unserialize (*sigh* Kept getting mixed with up json).
    Anyway the solution to such a situation:

    Code:
    $r=$this->Database->prepare('SELECT logintypes FROM tl_module WHERE id=?')
    ->execute($this->Input->get('id'));
    return unserialize($r->logintypes);

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •