Commit c2ca563b authored by John Voskuilen's avatar John Voskuilen
Browse files

Issue #3219111: Clean code

parent 8243c11d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -12,5 +12,5 @@ office_hours_widget:
  js:
    js/office_hours.js: {}
  dependencies:
    - core/jquery
    - core/drupal
    - core/jquery
+0 −1
Original line number Diff line number Diff line
@@ -4,7 +4,6 @@ namespace Drupal\office_hours;

use Drupal\Component\Utility\Html;
use Drupal\office_hours\Element\OfficeHoursDatetime;
use Drupal\office_hours\OfficeHoursDateHelper;

/**
 * Factors out OfficeHoursItemList->getItems()->getRows().
+1 −0
Original line number Diff line number Diff line
@@ -113,6 +113,7 @@ class OfficeHoursItem extends FieldItemBase {
   *
   * @param array $settings
   *   The field settings.
   *
   * @return array
   *   The form definition for the field settings.
   */
+6 −5
Original line number Diff line number Diff line
@@ -33,9 +33,9 @@ abstract class OfficeHoursWidgetBase extends WidgetBase {
    return $element;
  }

  public function extractFormValues(FieldItemListInterface $items, array $form, FormStateInterface $form_state) {
    parent::extractFormValues($items, $form, $form_state);
  }
  // public function extractFormValues(FieldItemListInterface $items, array $form, FormStateInterface $form_state) {
  //   parent::extractFormValues($items, $form, $form_state);
  // }

  /**
   * {@inheritdoc}
@@ -66,7 +66,8 @@ abstract class OfficeHoursWidgetBase extends WidgetBase {
        // Perhaps, but using '-1' (saved as '-001') works, too.
        $item['starthours'] = !empty($start) ? (int) $start : -1;
        $item['endhours'] = !empty($end) ? (int) $end : -1;
      } else {
      }
      else {
        $item['starthours'] = isset($start) ? (int) $start : -1;
        $item['endhours'] = isset($end) ? (int) $end : -1;
      }
+0 −1
Original line number Diff line number Diff line
@@ -133,7 +133,6 @@ class CSVOfficeHoursField extends OfficeHoursField {
        // Override empty values because it is not well handled if there
        // is a comment associated with a day. But if there is no comment
        // it has to be empty.

        if ($item['comment']) {
          $item['starthours'] = empty($item['starthours']) ? -1 : $item['starthours'];
          $item['endhours'] = empty($item['endhours']) ? -1 : $item['endhours'];
Loading