You are here

public static function SmartDateTrait::loadSmartDateFormat in Smart Date 3.0.x

Same name and namespace in other branches
  1. 8.2 src/SmartDateTrait.php \Drupal\smart_date\SmartDateTrait::loadSmartDateFormat()
  2. 8 src/SmartDateTrait.php \Drupal\smart_date\SmartDateTrait::loadSmartDateFormat()
  3. 3.x src/SmartDateTrait.php \Drupal\smart_date\SmartDateTrait::loadSmartDateFormat()
  4. 3.1.x src/SmartDateTrait.php \Drupal\smart_date\SmartDateTrait::loadSmartDateFormat()
  5. 3.2.x src/SmartDateTrait.php \Drupal\smart_date\SmartDateTrait::loadSmartDateFormat()
  6. 3.3.x src/SmartDateTrait.php \Drupal\smart_date\SmartDateTrait::loadSmartDateFormat()
  7. 3.4.x src/SmartDateTrait.php \Drupal\smart_date\SmartDateTrait::loadSmartDateFormat()

Load a Smart Date Format from a format name.

Parameters

string $formatName: The machine name of a Smart Date Format.

Return value

null|array An array of the format's options.

2 calls to SmartDateTrait::loadSmartDateFormat()
SmartDateProcessor::process in src/Plugin/FullcalendarViewProcessor/SmartDateProcessor.php
Process retrieved values before being passed to Fullcalendar.
SmartDateTrait::formatSmartDate in src/SmartDateTrait.php
Creates a formatted date value as a string.

File

src/SmartDateTrait.php, line 268

Class

SmartDateTrait
Provides friendly methods for smart date range.

Namespace

Drupal\smart_date

Code

public static function loadSmartDateFormat($formatName) {
  $format = NULL;
  $loadedFormat = \Drupal::entityTypeManager()
    ->getStorage('smart_date_format')
    ->load($formatName);
  if ($loadedFormat instanceof SmartDateFormatInterface) {
    $format = $loadedFormat
      ->getOptions();
  }
  return $format;
}