How do I add form_alter to a form on all pages of specific content type?

I’m building a module that sends field values to a third party api using hook_form_alter. Currently, I’ve got it working when I use specific form Id’s (like a form in each the header and footer) but I can’t get it to work on forms that appear in the body of specific content type pages. In my case, this content type is called “longform”. I’ve been searching for an answer, but I’m not finding one. My code looks something like this:

function MYMODULE_form_alter(&$form, &$form_state, $form_id) {
  //form in the footer (this is on all pages)
  if($form_id == 'webform_client_form_181')
    //add handler to footer form
    $form['#submit'][] = 'MYMODULE_footer_submit_handler';

  //form in the header(this is on all pages)
  elseif ($form_id == 'webform_client_form_913'){

    //add handler to header form
    $form['#submit'][] = 'MYMODULE_header_submit_handler';

  //Check to see if the form is in the body of a longform page
  $content_type = $form['#node']->type;
  elseif ($content_type == 'longform_pages')
    //add handler to longform-page forms
    $form['#submit'][] = 'MYMODULE_longform_submit_handler';

The handlers for both the header and footer work fine, but when I add

 elseif ($content_type == 'longform_pages')

, I get the white screen of death.

I could use the id’s for forms on “longform pages” pages that already exist, but if anymore “longform pages” pages were created, those forms would no longer have my handler.

What am I doing incorrectly?

Drupal version: