public function setWidgets(array $widgets)
    {
        foreach ($widgets as $widgetIdent => $widgetStruct) {
            if (!is_array($widgetStruct)) {
                throw new InvalidArgumentException(sprintf(
                    'The attachment widget "%s" must be an array of widget settings',
                    $widgetIdent
                ));
            }

            if (isset($widgetStruct['ident'])) {
                $widgetIdent = $widgetStruct['ident'];
                unset($widgetStruct['ident']);
            }

            if (!is_string($widgetIdent)) {
                throw new InvalidArgumentException(
                    'The attachment widget identifier must be a string'
                );
            }

            $this->widgets[$widgetIdent] = $widgetStruct;
        }

        return $this;
    }
public function setWidgets(array $widgets)
    {
        foreach ($widgets as $widgetIdent => $widgetStruct) {
            if (!is_array($widgetStruct)) {
                throw new InvalidArgumentException(sprintf(
                    'The attachment widget "%s" must be an array of widget settings',
                    $widgetIdent
                ));
            }

            if (isset($widgetStruct['ident'])) {
                $widgetIdent = $widgetStruct['ident'];
                unset($widgetStruct['ident']);
            }

            if (!is_string($widgetIdent)) {
                throw new InvalidArgumentException(
                    'The attachment widget identifier must be a string'
                );
            }

            $this->widgets[$widgetIdent] = $widgetStruct;
        }

        return $this;
    }
public function setWidgets ( array $ widgets ) { foreach ( $ widgets as $ widgetIdent => $ widgetStruct ) { if ( ! is_array ( $ widgetStruct ) ) { throw new InvalidArgumentException ( sprintf ( 'The attachment widget "%s" must be an array of widget settings' , $ widgetIdent ) ) ; } if ( isset ( $ widgetStruct [ 'ident' ] ) ) { $ widgetIdent = $ widgetStruct [ 'ident' ] ; unset ( $ widgetStruct [ 'ident' ] ) ; } if ( ! is_string ( $ widgetIdent ) ) { throw new InvalidArgumentException ( 'The attachment widget identifier must be a string' ) ; } $ this -> widgets [ $ widgetIdent ] = $ widgetStruct ; } return $ this ; }
Set attachment widget structures.

@param  array $widgets One or more widget structures.
@throws InvalidArgumentException If the widget identifier or structure is invalid.
@return AttachmentsConfig Chainable
Set attachment widget structures .