Field: Current Entry ID (Extension Development)
This is an open discussion with 8 replies, filed under Extensions.
Search
It’s not what I was looking for but this is working:
$currentPageURL = $this->_Parent->_Parent->_Parent->getCurrentPageURL(); preg_match_all('/d+/', $currentPageURL, $entry_id, PREG_PATTERN_ORDER); $entry_id = $entry_id[0][count($entry_id[0])-1];
Instead of $this->_Parent->_Parent->_Parent->getCurrentPageURL();
try using
Administration::instance()->getCurrentPageURL();
I’ll look at exposing the Context data in the next Symphony release. It would be a simple matter of having a new function in lib/toolkit/class.administrationpage.php
like:
public function Context(){ return $this->_context; }
And calling it with Administration::instance()->Page->Context()
Thanks Alistair!
Additional question: What’s the best way to get the current entry id in context of appendFormattedElement()
?
Okay, found the solution myself:
$wrapper->getAttribute('id');
I’ll look at exposing the Context data in the next Symphony release. It would be a simple matter of having a new function in lib/toolkit/class.administrationpage.php like:
Alistair, it would be great if all field related functions could access the context data.
By the way, Administration::instance() seems not to be available when used in appendFormattedElement()
.
Alistair, it would be great if all field related functions could access the context data.
I noted this a while back too. Glad to see I’m not the only odd ball!
$wrapper->getAttribute('id');
I discovered this myself today too. Hack!
Create an account or sign in to comment.
I’m sure I asked that before, I’m sure it was nickdunn who knew the answer … but I can’t find the thread anymore:
I’d like to know the current entry id while displaying a field (context:
displayPublishPanel()
). If I useprint_r($this)
I see the correct number as a private variable ofcontext
. How do I access this variable?