You are here

function fb_post_node_settings_validate in Drupal for Facebook 7.4

1 string reference to 'fb_post_node_settings_validate'
_fb_post_node_settings_form in ./fb_post.module
Helper for the node submission form and the node type form.

File

./fb_post.module, line 602

Code

function fb_post_node_settings_validate($element, &$form_state) {
  $values = drupal_array_get_nested_value($form_state['values'], $element['#parents']);

  /* On second thought, allow a default message even when status is not set.
    if ($values['message'] && !$values['status']) {
      form_error($element['message'], t('Your message %message will not be published to Facebook unless the Post checkbox is selected.  Check the box or erase the message to continue.', array(
                                          '%message' => $values['message'],
                                        )));
    }
    */
  if (isset($form_state['values']['status']) && empty($form_state['values']['status'])) {

    // Node form, node not published.
    if ($values['message'] || $values['status']) {
      form_error($element, t('Cannot post to Facebook because this content is not published.'));
    }
  }
}