3 namespace Drupal\action\Plugin\migrate\source;
5 use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
6 use Drupal\migrate\Row;
9 * Drupal action source from database.
13 * source_provider = "system"
16 class Action extends DrupalSqlBase {
21 public function query() {
22 return $this->select('actions', 'a')
29 public function fields() {
31 'aid' => $this->t('Action ID'),
32 'type' => $this->t('Module'),
33 'callback' => $this->t('Callback function'),
34 'parameters' => $this->t('Action configuration'),
36 if ($this->getModuleSchemaVersion('system') >= 7000) {
37 $fields['label'] = $this->t('Label of the action');
40 $fields['description'] = $this->t('Action description');
48 public function getIds() {
49 $ids['aid']['type'] = 'string';
56 public function prepareRow(Row $row) {
57 $aid = $row->getSourceProperty('aid');
58 if (is_numeric($aid)) {
59 if ($this->getModuleSchemaVersion('system') >= 7000) {
60 $label = $row->getSourceProperty('label');
63 $label = $row->getSourceProperty('description');
65 $row->setSourceProperty('aid', $label);