You are here

public function ExifSettingsController::createPhotographyVocabulary in Exif 8

Same name and namespace in other branches
  1. 8.2 src/Controller/ExifSettingsController.php \Drupal\exif\Controller\ExifSettingsController::createPhotographyVocabulary()

Create a vocabulary "photographies'metadata".

Use by routing.yml.

1 string reference to 'ExifSettingsController::createPhotographyVocabulary'
exif.routing.yml in ./exif.routing.yml
exif.routing.yml

File

src/Controller/ExifSettingsController.php, line 76

Class

ExifSettingsController
Class ExifSettingsController manage action of settings pages.

Namespace

Drupal\exif\Controller

Code

public function createPhotographyVocabulary() {
  $values = [
    "name" => "photographs metadata",
    "vid" => "photographs_metadata",
    "description" => "information related to photographs",
  ];
  $voc = Vocabulary::load("photographs_metadata");
  if (!$voc) {
    Vocabulary::create($values)
      ->save();
    $message = $this
      ->t('The  vocabulary photography has been created');
  }
  else {
    $message = $this
      ->t('The  vocabulary photography is already created. nothing to do');
  }
  drupal_set_message($message);
  $response = new RedirectResponse('/admin/config/media/exif/helper');
  $response
    ->send();
  exit;
}