Back to Menu class

Method bind

public mixed
bind
(mixed $array, mixed $ignore = '')
Overloaded bind function
Parameters
  • array $array Named array
  • mixed $ignore An optional array or space separated list of properties to ignore while binding.
Returns
  • mixed Null if operation was satisfactory, otherwise returns an error
Since
  • 1.5
-
  • \Joomla\CMS\Table\Table::bind()
Class: Menu
Project: Joomla

Method bind - Source code

/**
 * Overloaded bind function
 *
 * @param   array  $array   Named array
 * @param   mixed  $ignore  An optional array or space separated list of properties to ignore while binding.
 *
 * @return  mixed  Null if operation was satisfactory, otherwise returns an error
 *
 * @see     Table::bind()
 * @since   1.5
 */
public function bind($array, $ignore = '')
{
    // Verify that the default home menu is not unset
    if ($this->home == '1' && $this->language === '*' && $array['home'] == '0') {
        $this->setError(Text::_('JLIB_DATABASE_ERROR_MENU_CANNOT_UNSET_DEFAULT_DEFAULT'));
        return false;
    }
    // Verify that the default home menu set to "all" languages" is not unset
    if ($this->home == '1' && $this->language === '*' && $array['language'] !== '*') {
        $this->setError(Text::_('JLIB_DATABASE_ERROR_MENU_CANNOT_UNSET_DEFAULT'));
        return false;
    }
    // Verify that the default home menu is not unpublished
    if ($this->home == '1' && $this->language === '*' && $array['published'] != '1') {
        $this->setError(Text::_('JLIB_DATABASE_ERROR_MENU_UNPUBLISH_DEFAULT_HOME'));
        return false;
    }
    if (isset($array['params']) && \is_array($array['params'])) {
        $registry = new Registry($array['params']);
        $array['params'] = (string) $registry;
    }
    return parent::bind($array, $ignore);
}