You are here

function _themekey_node_discover in ThemeKey 6

Function _themekey_node_discover().

1 call to _themekey_node_discover()
_themekey_properties_discover in ./themekey_build.inc
Function _themekey_properties_discover().

File

./themekey_build.inc, line 189

Code

function _themekey_node_discover() {
  require_once drupal_get_path('module', 'node') . '/node.pages.inc';
  $properties = array();
  $ignore = array(
    // Generic node properties
    'teaser',
    'teaser_js',
    'teaser_include',
    'body',
    'format',
    'log',
    'submit',
    'preview',
    'form_id',
    'path',
    'vid',
    'validated',
    'comment',
    'name',
    'revision',
    'status',
    'date',
    // Book properties
    'book/router_path',
    'book/module',
    'book/parent_depth_limit',
    'book/weight',
    'book/pick-book',
    'book/menu_name',
    'book/original_bid',
    // Menu properties
    'menu/module',
    'menu/parent_depth_limit',
    'menu/weight',
    'menu/customized',
    'menu/expanded',
    'menu/hidden',
  );

  //
  $nodes = array();
  $node_types = node_get_types();

  //
  foreach ($node_types as $node_type) {
    $form_state = array();
    $form_id = $node_type->type . '_node_form';
    $node = array(
      'uid' => 0,
      'name' => '-',
      'type' => $node_type->type,
      'language' => 'en',
    );

    //
    $form = drupal_retrieve_form($form_id, $form_state, $node);
    $form['#post'] = array();
    drupal_prepare_form($form_id, $form, $form_state);
    $form = form_builder($form_id, $form, $form_state);
    $node = node_form_submit_build_node($form, $form_state);

    //
    _themekey_node_discover_properties($node, $properties);
    $properties = array_diff($properties, $ignore);
  }
  return $properties;
}