If you're using Joomla Component Builder and your admin list view isn't showing any items, even though there are items in the database, edit your admin view and make sure in the Admin behaviour column is set to Show in All List Views for at least one field.
Ok. When creating a custom field:
Here's an example of the text that goes in the "The php for the getOptions method" box.
// gets the name and IDs of the description articles
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->where($db->quoteName('a.state') . ' != 2');
$query->where($db->quoteName('a.catid') . ' = 24');
$items = $db->loadObjectList();
$options = array();
\t$options = JHtml::_('select.option', '', 'Select an option');
\tforeach($items as $item)
\t\t$options = JHtml::_('select.option', $item->id, $item->title);
In the table field, this is the field that your method above links to. #__content
In the Component field, put the name of your component; example com_regsix
In the value_field: put the field name from the table being accessed by the getOptions method that contains the field that you want to display in the listview. IN this case it is "title".
In the key field: put the field in the table being accessed by the getOptions method that contains the value that is being stored (not the table your getOptions method is accessing). In this example, it would be "id" from the #__content which is being stored in another table for sessions.
You can use array_keys to get the keys from an array but how do you get the keys from elements in an object.
Easiest method is to cast the object to an array and use array_keys.
$Keys = array_keys(array)$ObjectName);
If you get this message after switching to php version 7.x, change your code to from count() to count(get_object_vars()).
At some point, my Joomla system running on my local WAMP became incredibly slow. It was taking 30-60 seconds to load a page that only takes a few seconds to load on my cloud server.
I discovered that when I had enabled xdebug in my php.ini settings, I had turned on the profiler which was generating 80 MB files on each page load. When I disabled the profiler, then the site went back to loading normally.