Make a field state change depending on the moderation state field
Drupal API: function drupal_process_states

Example A where the source fieldtype is a textfield

$form['moderation_state'] = [
  '#type'  =&gt; 'textfield',
  '#title' =&gt; ('Some title'),
];

$form['schedule_publish_date'] = [
  '#type'   =&gt; 'textfield',
  '#title'  =&gt; ('Invisible if ...'),
  '#states' =&gt; ['invisible' =&gt; [':input[name="moderation_state"]' =&gt; ['value' =&gt; "published"],],],
];


Example B where the source fieldtype is a select-field

$form['moderation_state'] = array(
  '#type'          =&gt; 'select',
  '#title'         =&gt; t('Some title'),
  '#options'       =&gt; array('unpublished'=&gt;'unpublished', 'published'=&gt;'published'),
  '#default_value' =&gt; 0,
);

$form['schedule_publish_date'] = [
  '#type'   =&gt; 'textfield',
  '#title'  =&gt; ('Invisible if ...'),
  '#states' =&gt; ['invisible' =&gt; [':input[name="moderation_state"]' =&gt; ['value' =&gt; "published"],],],
];