PluginProbe
Import WP – CSV & XML Import Export for WordPress / 2.8.3
Import WP – CSV & XML Import Export for WordPress v2.8.3
2.15.1 2.15.0 2.14.24 2.14.23 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.9.0 2.9.1 All 144 releases
jc-importer / class / Common / Addon / AddonBaseGroup.php

AddonBaseGroup.php in Import WP – CSV & XML Import Export for WordPress 2.8.3, at class/Common/Addon/AddonBaseGroup.php

58 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace ImportWP\Common\Addon;
4
5 class AddonBaseGroup extends AddonBaseContainer implements AddonGroupInterface
6 {
7 /**
8 * @var callable
9 */
10 protected $_process_callback;
11
12 protected $_is_field_processable = false;
13
14 protected $_id;
15
16 public function _enable_processing()
17 {
18 $this->_is_field_processable = true;
19 }
20
21 public function _is_processing_enabled()
22 {
23 return $this->_is_field_processable;
24 }
25
26 public function __construct($addon, $id, $data)
27 {
28 $this->_id = $id;
29 parent::__construct($addon, array_merge($data, ['type' => 'group']));
30 }
31
32 public function _process($object_id, $data, $importer_model, $template)
33 {
34 if (!is_null($this->_process_callback) && is_callable($this->_process_callback)) {
35 call_user_func($this->_process_callback, new AddonGroupDataApi($this->addon(), $this, $object_id, $this->get_id(), $data, $importer_model, $template));
36 }
37 }
38
39 public function save($callback)
40 {
41 $this->_process_callback = $callback;
42 return $this;
43 }
44
45 public function get_id()
46 {
47 return $this->_id;
48 }
49
50 /**
51 * @return AddonBaseField[]
52 */
53 public function fields()
54 {
55 return isset($this->_data['fields']) ? $this->_data['fields'] : [];
56 }
57 }
58