Use the "sql" form field type in config.xml only if the table exists

by Yiannis   Last Updated May 06, 2017 07:10 AM

I developed an extension for Joomla!, and I have the below sql parameter field in my config.xml

<field name="include_categories_k2" type="sql" default="" label="Include K2 Cats" description="" query="SELECT id, name FROM #__k2_categories ORDER BY name" key_field="id" value_field="name" multiple="true" />

I got sql error because the K2 is not installed on a client's website. The problem is how to check if the table #__k2_categories exists first before getting data from there?

Ok, one solution is to create elements and check there if the component exists, but is there another simple solution to avoiding create custom elements?

Thank you.

Related Questions

Using CodeMirror editor in custom component

Updated October 09, 2016 09:04 AM

Where to save extension configuration?

Updated February 16, 2017 14:10 PM

Facing error on jomsocial website

Updated July 13, 2017 23:10 PM

passing an array from view to controller to model

Updated March 11, 2018 17:10 PM