| @@ -6,8 +6,11 @@ | ||
| 6 | 6 | use ImportWP\Common\Importer\Template\Template; |
| 7 | 7 | use ImportWP\Common\Model\ImporterModel; |
| 8 | 8 | use ImportWP\Container; |
| 9 | 9 | |
| 10 | +/** | |
| 11 | + * @deprecated 2.14.0 | |
| 12 | + */ | |
| 10 | 13 | class AddonBase implements AddonInterface |
| 11 | 14 | { |
| 12 | 15 | /** |
| 13 | 16 | * @var callable |
| @@ -140,8 +143,24 @@ | ||
| 140 | 143 | } |
| 141 | 144 | |
| 142 | 145 | $group_fields = $section->fields(); |
| 143 | 146 | $group_fields = $this->_register_fields($group_fields, $template, $importer_model); |
| 147 | + | |
| 148 | + add_filter('iwp/template/permission_fields', function ($permission_fields) use ($section) { | |
| 149 | + | |
| 150 | + $section_id = $section->get_id(); | |
| 151 | + $section_label = $section->data('name'); | |
| 152 | + | |
| 153 | + if (!isset($permission_fields[$section_label])) { | |
| 154 | + $permission_fields[$section_label] = []; | |
| 155 | + } | |
| 156 | + | |
| 157 | + foreach ($section->fields() as $field) { | |
| 158 | + $permission_fields[$section_label][$section_id . '.' . $field->get_id()] = $field->data('name'); | |
| 159 | + } | |
| 160 | + | |
| 161 | + return $permission_fields; | |
| 162 | + }); | |
| 144 | 163 | |
| 145 | 164 | |
| 146 | 165 | $fields = array_merge($fields, [ |
| 147 | 166 | $template->register_group($section_data['name'], $section_id, (array)$group_fields, $section->settings()) |