public function CustomPub::fields in Custom Publishing Options 8
Returns available fields on the source.
Return value
array Available fields in the source, keys are the field machine names as used in field mappings, values are descriptions.
Overrides MigrateSourceInterface::fields
File
- src/
Plugin/ migrate/ source/ d7/ CustomPub.php, line 33
Class
- CustomPub
- Drupal 7 custom_pub from database.
Namespace
Drupal\custom_pub\Plugin\migrate\source\d7Code
public function fields() {
$fields = [
'nid' => $this
->t('Node ID'),
];
// Get the options
$publishing_options = unserialize($this
->getDatabase()
->select('variable', 'v')
->fields('v', [
'value',
])
->condition('name', 'custom_pub_types')
->execute()
->fetchField());
foreach ($publishing_options as $key => $publishing_option) {
$fields[$key] = $publishing_option['name'];
}
return $fields;
}