Ah, so in the relationship field, you want to be able to limit the options they can select to only those entries authored by the person making the current entry?
It’s not possible to do that natively. We’ve talked about it a bit and there are some concerns about what happens if someone else edits the entry- what happens then. But it is an interesting feature idea.
For now, you’d need to write a custom extension to get that sort of behavior though.
yes, im write a custom function
like this
public function getCanal(){
$this->channel_id = (ee()->TMPL->fetch_param('channel_id'))?ee()->TMPL->fetch_param('channel_id'):0;
$entradas=array();
$entries = ee('Model')->get('ChannelEntry')
->filter('author_id', ee()->session->userdata('member_id'))
->filter('channel_id',$this->channel_id ) // or whatever you want/need to filter on
->order('title', 'ASC');
foreach($entries->all() as $ent){
$entradas[]=array(
"chan_title"=>$ent->title,
"chan_url_title"=>$ent->url_title,
"chan_entry_id"=>$ent->entry_id,
);
}
return ee()->TMPL->parse_variables(ee()->TMPL->tagdata, $entradas);
}
and call from template to draw select box with only logged member entries in specific channel
{exp:tcdcl_utilities:getCanal channel_id="11"}
{chan_title}
{chan_url_title}
{chan_entry_id}
{/exp:tcdcl_utilities:getCanal}
Hrm- I was thinking an extension, using hook:
‘relationships_display_field’ hook. // - Allow developers to perform their own queries to modify which entries are retrieved
https://docs.expressionengine.com/latest/development/extension-hooks/api/channel-fields.html#custom_field_modify_dataee_fieldtype-ft-method-data
That would work in the cp too.
I’m pretty sure that’s how I’d go, but your logic looks sound as well.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.