Created
December 4, 2012 14:45
-
-
Save drmmr763/4204676 to your computer and use it in GitHub Desktop.
Getting extra fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* I used to be able to get the extra fields of | |
** a k2 item by doing this: | |
*/ | |
$id = $item->getId(); | |
$db = JFactory::getDBO(); | |
$query = "SELECT extra_fields FROM #__k2_items WHERE id={$id}"; | |
$db->setQuery($query); | |
$row = $db->loadObject(); | |
// Pre K2 2.6.2 | |
$extrafields = K2ModelItem::getItemExtraFields($row); | |
/* After installing 2.5.2 update I the K2 data model for extra fields was updated. | |
** it now asks for a second parameter, the item object. | |
// function getItemExtraFields($itemExtraFields, &$item = null) item.php k2 model | |
*/ | |
// What do I have to do to get this working again? I tried this: | |
$extrafields = K2ModelItem::getItemExtraFields($row, $item); | |
// not working. Any ideas? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Forget it. That was an old code that was working for 2.6.1.
Better json_decode yourself as you did :)