How to populate a select list in my custom module with the content types of the site? I am making my first custom module, and I want to have a select list in the module settings that has all the content types in the site, so that the admin can select which content types to have associated with the module.

here is the code I have so far:

$form['MODULE_select_content_types'] = array(
  '#type'          =&gt; 'select',
  '#title' =&gt; t('Select Content Types'),
  '#description' =&gt; t('Select the Content Types that users can subscribe to'),
  '#default_value' =&gt; variable_get('MODULE_unlisted_content_types', array()),
  '#options'       =&gt; $select,
  '#multiple'      =&gt; TRUE,
);


How do I populate the $select variable with a list of all the content types in the site?
I found some code in another module that did the same thing. That module had this code before that form option in the form function

$select = array();
$select[0] = '&lt;' . t('none') . '&gt;';
$nodetypes = node_type_get_types();
foreach ($nodetypes as $ntype =&gt; $nname) {
  $select[$ntype] = $nname-&gt;name;
}