Same name and namespace in other branches
  1. 8.x-2.x src/Controller/ExifSettingsController.php \Drupal\exif\Controller\ExifSettingsController::createPhotographyVocabulary() 1 comment

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');
    }
    $this->messenger()
        ->addStatus($message);
    $response = new RedirectResponse('/admin/config/media/exif/helper');
    $response->send();
    exit;
}