Skip to content
Snippets Groups Projects
Commit d41b1848 authored by Chris Leppanen's avatar Chris Leppanen
Browse files

Issue #1166100 by twistor | Niklas Fiekas: Fixed Notices and warnings on...

Issue #1166100 by twistor | Niklas Fiekas: Fixed Notices and warnings on mapping page, when no content type is selected for NodeProcessor.
parent 8ebf8255
No related branches found
No related tags found
No related merge requests found
......@@ -182,8 +182,6 @@ class FeedsNodeProcessor extends FeedsProcessor {
public function configForm(&$form_state) {
$form = parent::configForm($form_state);
$form['bundle']['#title'] = t('Content type');
$author = user_load($this->config['author']);
$form['author'] = array(
'#type' => 'textfield',
......@@ -273,7 +271,7 @@ class FeedsNodeProcessor extends FeedsProcessor {
$type = node_type_get_type($this->bundle());
$targets = parent::getMappingTargets();
if ($type->has_title) {
if ($type && $type->has_title) {
$targets['title'] = array(
'name' => t('Title'),
'description' => t('The title of the node.'),
......
......@@ -552,7 +552,7 @@ abstract class FeedsProcessor extends FeedsPlugin {
$form['bundle'] = array(
'#type' => 'select',
'#options' => $this->bundleOptions(),
'#title' => t('Bundle'),
'#title' => !empty($info['bundle name']) ? $info['bundle name'] : t('Bundle'),
'#required' => TRUE,
'#default_value' => $this->bundle(),
);
......@@ -619,6 +619,16 @@ abstract class FeedsProcessor extends FeedsPlugin {
* FALSE otherwise.
*/
public function getMappingTargets() {
// The bundle has not been selected.
if (!$this->bundle()) {
$info = $this->entityInfo();
$bundle_name = !empty($info['bundle name']) ? drupal_strtolower($info['bundle name']) : t('bundle');
$plugin_key = feeds_importer($this->id)->config['processor']['plugin_key'];
$url = url('admin/structure/feeds/' . $this->id . '/settings/' . $plugin_key);
drupal_set_message(t('Please <a href="@url">select a @bundle_name</a>.', array('@url' => $url, '@bundle_name' => $bundle_name)), 'warning', FALSE);
}
return array(
'url' => array(
'name' => t('URL'),
......
......@@ -22,6 +22,7 @@ class FeedsTermProcessor extends FeedsProcessor {
protected function entityInfo() {
$info = parent::entityInfo();
$info['label plural'] = t('Terms');
$info['bundle name'] = t('Vocabulary');
return $info;
}
......@@ -82,15 +83,6 @@ class FeedsTermProcessor extends FeedsProcessor {
) + parent::configDefaults();
}
/**
* Override parent::configForm().
*/
public function configForm(&$form_state) {
$form = parent::configForm($form_state);
$form['bundle']['#title'] = t('Vocabulary');
return $form;
}
/**
* Override setTargetElement to operate on a target item that is a taxonomy term.
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment