|
| 1 | +<?php |
| 2 | + |
| 3 | +/** |
| 4 | + * @file |
| 5 | + * Copyright 2022 Google Inc. |
| 6 | + * |
| 7 | + * This program is free software; you can redistribute it and/or modify it under |
| 8 | + * the terms of the GNU General Public License version 2 as published by the |
| 9 | + * Free Software Foundation. |
| 10 | + * |
| 11 | + * This program is distributed in the hope that it will be useful, but WITHOUT |
| 12 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 13 | + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
| 14 | + * License for more details. |
| 15 | + * |
| 16 | + * You should have received a copy of the GNU General Public License along |
| 17 | + * with this program; if not, write to the Free Software Foundation, Inc., 51 |
| 18 | + * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 19 | + */ |
| 20 | + |
| 21 | +/** |
| 22 | + * @file |
| 23 | + * Install, update, and uninstall functions for the Apigee Free-form module. |
| 24 | + */ |
| 25 | + |
| 26 | + /** |
| 27 | + * Implements hook_install(). |
| 28 | + */ |
| 29 | + function apigee_freeform_doc_install($is_syncing) { |
| 30 | + // Do not allow to delete the freeform_doc's node type machine name. |
| 31 | + $locked = \Drupal::state()->get('node.type.locked'); |
| 32 | + $locked['freeform_doc'] = 'freeform_doc'; |
| 33 | + \Drupal::state()->set('node.type.locked', $locked); |
| 34 | + } |
| 35 | + |
| 36 | + /** |
| 37 | + * Implements hook_uninstall(). |
| 38 | + */ |
| 39 | + function apigee_freeform_doc_uninstall() { |
| 40 | + // Allow to delete a freeform_doc's node type. |
| 41 | + $locked = \Drupal::state()->get('node.type.locked'); |
| 42 | + unset($locked['freeform_doc']); |
| 43 | + \Drupal::state()->set('node.type.locked', $locked); |
| 44 | + } |
0 commit comments