在PHP中保存项目(无效名称)时出错


Error Saving Item (Invalid Name) in PHP

我正在使用Zoo CCK,并且对代码进行了足够长的处理,使其看起来像我想要的样子。然而,当我提交项目时,我收到了一个我无法理解的错误(标题中)。

为了减少混乱,我应该提到我对文件所做的编辑是添加$message的部分和任何识别它的相关代码

如有任何帮助,我们将不胜感激。以下是文件代码:

错误:保存项目(无效名称)时出错

<?php
// no direct access
defined('_JEXEC') or die('Restricted access');
// register ElementOption class
App::getInstance('zoo')->loader->register('ElementOption', 'elements:option/option.php');
// register ElementRepeatable class
App::getInstance('zoo')->loader->register('ElementRepeatable', 'elements:repeatable/repeatable.php');
/*
Class: ElementSelect
    The select element class
*/
class ElementMessage extends ElementOption implements iSubmittable  {
/*
   Function: edit
       Renders the edit form field.
   Returns:
       String - html
*/
public function edit(){
    $this->app->document->addStylesheet('elements:message/assets/css/submission.css');
    // init vars
    $options_from_config = $this->config->get('option', array());
    $multiple            = $this->config->get('multiple');
    $default             = $this->config->get('default');
    $name                = $this->config->get('name');
    $message         = $this->get('message');
    if (count($options_from_config)) {
        // set default, if item is new
        if ($default != '' && $this->_item != null && $this->_item->id == 0) {
            $this->set('option', $default);
        }
        $options = array();
        if (!$multiple) {
            $options[] = $this->app->html->_('select.option', '', '-' . JText::sprintf('Select %s', $name) . '-');
        }
        foreach ($options_from_config as $option) {
            $options[] = $this->app->html->_('select.option', $option['value'], $option['name']);
        }
        $style = $multiple ? 'multiple="multiple" size="5"' : '';
        $html[] = $this->app->html->_('select.genericlist', $options, $this->getControlName('option', true), $style, 'value', 'text', $this->get('option', array()));
        $html[] = $this->app->html->_('control.text', $this->getControlName('Message'), $this->get('message'), 'name="message" size="30" maxlength="255" placeholder="'.JText::_('Message').'"');
        // workaround: if nothing is selected, the element is still being transfered
        $html[] = '<input type="hidden" name="'.$this->getControlName('select').'" value="1" />';
        return implode("'n", $html);
    }
    return JText::_("There are no options to choose from.");
}
public function hasValue($params = array()) {
    $message = $this->get('message');
    return !empty($message);
}
}

尝试更改:

$message         = $this->get('message');

$message         = $this->config->get('message');