You are here

public function StringMiconItem::isEmpty in Micon 8

Same name and namespace in other branches
  1. 2.x src/Plugin/Field/FieldType/StringMiconItem.php \Drupal\micon\Plugin\Field\FieldType\StringMiconItem::isEmpty()

Determines whether the data structure is empty.

Return value

bool TRUE if the data structure is empty, FALSE otherwise.

Overrides StringItemBase::isEmpty

File

src/Plugin/Field/FieldType/StringMiconItem.php, line 31

Class

StringMiconItem
Plugin implementation of the 'string_micon' field type.

Namespace

Drupal\micon\Plugin\Field\FieldType

Code

public function isEmpty() {
  $value = $this
    ->get('value')
    ->getValue();
  if ($value) {
    $value = \Drupal::service('micon.icon.manager')
      ->getIconMatch($value);
  }
  return $value === NULL || $value === '';
}