0

Most issues related to Notice: Undefined offset: 1 are concerned with explode (). My issue is when implode() and explode() are used together in arrays. The code I'm having issues with is:

public function renderField($options = array()) {
    if ($this - > hidden) {
        return $this - > getInput();
    }

    if (!isset($options['class'])) {
        $options['class'] = '';
    }

    $options['rel'] = '';

    if (empty($options['hiddenLabel']) && $this - > getAttribute('hiddenLabel')) {
        $options['hiddenLabel'] = true;
    }

    if ($showon = $this - > getAttribute('showon')) {
        $showon = explode(':', $showon, 2);
        $options['class']. = 'showon_'.implode('showon_', explode(',', $showon[1])); // The line I'm having issues with
        $id = $this - > getName($showon[0]);
        $options['rel'] = ' rel="showon_'.$id.
        '"';
        $options['showonEnabled'] = true;
    }

    return JLayoutHelper::render($this - > renderLayout, array('input' => $this - > getInput(), 'label' => $this - > getLabel(), 'options' => $options));
}

The error I'm getting is

Notice: Undefined offset: 1 in /..../..../..../domain.com/libraries/joomla/form/field.php on line 914

This error appears in joomla backend.

kessyjr
  • 1
  • 2
  • did you check the value of `$showon` in every step of the `if`-loop – RST Jan 09 '16 at 10:46
  • @Louy The steps shown above are the only steps in this if loop. And the value of $shown is as it appears there. – kessyjr Jan 09 '16 at 10:54

0 Answers0