You are here

function _api_hide_publish_date in Scheduler 2.x

Generic function to hide the publish_on date field.

3 calls to _api_hide_publish_date()
scheduler_api_test_scheduler_commerce_product_hide_publish_date in tests/modules/scheduler_api_test/scheduler_api_test.module
Implements hook_scheduler_commerce_product_hide_publish_date().
scheduler_api_test_scheduler_media_hide_publish_date in tests/modules/scheduler_api_test/scheduler_api_test.module
Implements hook_scheduler_media_hide_publish_date().
scheduler_api_test_scheduler_node_hide_publish_date in tests/modules/scheduler_api_test/scheduler_api_test.module
Implements hook_scheduler_node_hide_publish_date().

File

tests/modules/scheduler_api_test/scheduler_api_test.module, line 326
Hook implementations of the Scheduler API Test module.

Code

function _api_hide_publish_date($form, $form_state, $entity) {

  // Hide the publish_on field if the title contains 'green {type}'.
  if (stristr($entity
    ->label(), "green {$entity->getEntityTypeId()}")) {
    \Drupal::messenger()
      ->addMessage(t('Scheduler_Api_Test: The publish_on field is hidden for green.'), 'status', FALSE);
    return TRUE;
  }
  else {
    return FALSE;
  }
}