You are here

function eu_cookie_compliance_update_8122 in EU Cookie Compliance (GDPR Compliance) 8

Install new cookie category configuration entity.

File

./eu_cookie_compliance.install, line 500
Update scripts for the EU Cookie Compliance module.

Code

function eu_cookie_compliance_update_8122(&$sandbox) {
  $definition = [
    'id' => 'cookie_category',
    'label' => new TranslatableMarkup('Cookie category'),
    'label_collection' => new TranslatableMarkup('Cookie categories'),
    'handlers' => [
      'storage' => 'Drupal\\eu_cookie_compliance\\CategoryStorageManager',
      'view_builder' => 'Drupal\\Core\\Entity\\EntityViewBuilder',
      'list_builder' => 'Drupal\\eu_cookie_compliance\\CookieCategoryListBuilder',
      'form' => [
        'add' => 'Drupal\\eu_cookie_compliance\\Form\\CookieCategoryForm',
        'edit' => 'Drupal\\eu_cookie_compliance\\Form\\CookieCategoryForm',
        'delete' => 'Drupal\\eu_cookie_compliance\\Form\\CookieCategoryDeleteForm',
      ],
      'route_provider' => [
        'html' => 'Drupal\\eu_cookie_compliance\\CookieCategoryHtmlRouteProvider',
      ],
    ],
    'config_prefix' => 'cookie_category',
    'config_export' => [
      'id',
      'label',
      'description',
      'checkbox_default_state',
      'weight',
    ],
    'admin_permission' => 'administer eu cookie compliance categories',
    'entity_keys' => [
      'id' => 'id',
      'label' => 'label',
      'uuid' => 'uuid',
      'description' => 'description',
      'checkbox_default_state' => 'checkbox_default_state',
      'weight' => 'weight',
    ],
    'links' => [
      'add-form' => '/admin/config/system/eu-cookie-compliance/categories/add',
      'edit-form' => '/admin/config/system/eu-cookie-compliance/categories/{cookie_category}/edit',
      'delete-form' => '/admin/config/system/eu-cookie-compliance/categories/{cookie_category}/delete',
      'collection' => '/admin/config/system/eu-cookie-compliance/categories',
    ],
  ];
  $entity_type = new ConfigEntityType($definition);
  \Drupal::entityDefinitionUpdateManager()
    ->installEntityType($entity_type);
}