You are here

public function Font::deactivate in @font-your-face 8.3

Disable a font.

Return value

bool TRUE is font is disabled. FALSE otherwise.

Overrides FontInterface::deactivate

File

src/Entity/Font.php, line 151

Class

Font
Defines the Font entity.

Namespace

Drupal\fontyourface\Entity

Code

public function deactivate() {
  $config = \Drupal::configFactory()
    ->getEditable('fontyourface.settings');
  $enabled_fonts = $config
    ->get('enabled_fonts');
  $enabled_fonts = array_diff($enabled_fonts, [
    $this->url->value,
  ]);
  $config
    ->set('enabled_fonts', $enabled_fonts)
    ->save();
  $this->status->value = FALSE;
  $this
    ->save();
  return $this
    ->isDeactivated();
}