public function validateActionsImageStyle()
    {
        $field = 'actions';

        if ($this->isExcluded($field)) {
            return null;
        }

        $actions = $this->getSubmitted($field);

        if ($this->isUpdating() && !isset($actions)) {
            $this->unsetSubmitted($field);
            return null;
        }

        $label = $this->translation->text('Actions');

        if (empty($actions)) {
            $this->setErrorRequired($field, $label);
            return false;
        }

        if (!is_array($actions)) {
            $this->setErrorInvalid($field, $label);
            return false;
        }

        $modified = $errors = array();
        foreach ($actions as $line => $action) {

            $line++;
            $parts = gplcart_string_explode_whitespace($action, 2);
            $action_id = array_shift($parts);
            $value = array_filter(explode(',', implode('', $parts)));

            if (!$this->validateActionImageStyle($action_id, $value)) {
                $errors[] = $line;
                continue;
            }

            $modified[$action_id] = array('value' => $value, 'weight' => $line);
        }

        if (!empty($errors)) {
            $error = $this->translation->text('Error in @num definition', array('@num' => implode(',', $errors)));
            $this->setError($field, $error);
        }

        if ($this->isError()) {
            return false;
        }

        $this->setSubmitted($field, $modified);
        return true;
    }
public function validateActionsImageStyle()
    {
        $field = 'actions';

        if ($this->isExcluded($field)) {
            return null;
        }

        $actions = $this->getSubmitted($field);

        if ($this->isUpdating() && !isset($actions)) {
            $this->unsetSubmitted($field);
            return null;
        }

        $label = $this->translation->text('Actions');

        if (empty($actions)) {
            $this->setErrorRequired($field, $label);
            return false;
        }

        if (!is_array($actions)) {
            $this->setErrorInvalid($field, $label);
            return false;
        }

        $modified = $errors = array();
        foreach ($actions as $line => $action) {

            $line++;
            $parts = gplcart_string_explode_whitespace($action, 2);
            $action_id = array_shift($parts);
            $value = array_filter(explode(',', implode('', $parts)));

            if (!$this->validateActionImageStyle($action_id, $value)) {
                $errors[] = $line;
                continue;
            }

            $modified[$action_id] = array('value' => $value, 'weight' => $line);
        }

        if (!empty($errors)) {
            $error = $this->translation->text('Error in @num definition', array('@num' => implode(',', $errors)));
            $this->setError($field, $error);
        }

        if ($this->isError()) {
            return false;
        }

        $this->setSubmitted($field, $modified);
        return true;
    }
public function validateActionsImageStyle ( ) { $ field = 'actions' ; if ( $ this -> isExcluded ( $ field ) ) { return null ; } $ actions = $ this -> getSubmitted ( $ field ) ; if ( $ this -> isUpdating ( ) && ! isset ( $ actions ) ) { $ this -> unsetSubmitted ( $ field ) ; return null ; } $ label = $ this -> translation -> text ( 'Actions' ) ; if ( empty ( $ actions ) ) { $ this -> setErrorRequired ( $ field , $ label ) ; return false ; } if ( ! is_array ( $ actions ) ) { $ this -> setErrorInvalid ( $ field , $ label ) ; return false ; } $ modified = $ errors = array ( ) ; foreach ( $ actions as $ line => $ action ) { $ line ++ ; $ parts = gplcart_string_explode_whitespace ( $ action , 2 ) ; $ action_id = array_shift ( $ parts ) ; $ value = array_filter ( explode ( ',' , implode ( '' , $ parts ) ) ) ; if ( ! $ this -> validateActionImageStyle ( $ action_id , $ value ) ) { $ errors [ ] = $ line ; continue ; } $ modified [ $ action_id ] = array ( 'value' => $ value , 'weight' => $ line ) ; } if ( ! empty ( $ errors ) ) { $ error = $ this -> translation -> text ( 'Error in @num definition' , array ( '@num' => implode ( ',' , $ errors ) ) ) ; $ this -> setError ( $ field , $ error ) ; } if ( $ this -> isError ( ) ) { return false ; } $ this -> setSubmitted ( $ field , $ modified ) ; return true ; }
Validates image actions
@return boolean|null
Validates image actions