public function attachmentGroup()
    {
        if ($this->group === null) {
            $config = $this->attachmentsMetadata();
            $group  = AttachmentContainerInterface::DEFAULT_GROUPING;

            if (isset($config['group'])) {
                $group = $config['group'];
                // If the 'default_group' is not set, search for it.
            } elseif (isset($config['default_group'])) {
                $group = $config['default_group'];
            // If the 'default_group' is not set, search for it.
            } elseif (isset($config['default_widget'])) {
                $widget   = $config['default_widget'];
                $metadata = $this->metadata();
                $found    = false;
                if (isset($metadata['admin']['form_groups'][$widget]['group'])) {
                    $group = $metadata['admin']['form_groups'][$widget]['group'];
                    $found = true;
                }

                if (!$found && isset($metadata['admin']['forms'])) {
                    foreach ($metadata['admin']['forms'] as $form) {
                        if (isset($form['groups'][$widget]['group'])) {
                            $group = $form['groups'][$widget]['group'];
                            $found = true;
                            break;
                        }
                    }
                }

                if (!$found && isset($metadata['admin']['dashboards'])) {
                    foreach ($metadata['admin']['dashboards'] as $dashboard) {
                        if (isset($dashboard['widgets'][$widget]['group'])) {
                            $group = $dashboard['widgets'][$widget]['group'];
                            $found = true;
                            break;
                        }
                    }
                }
            }

            if (!is_string($group)) {
                throw new UnexpectedValueException('The attachment grouping must be a string.');
            }

            $this->group = $group;
        }

        return $this->group;
    }
public function attachmentGroup()
    {
        if ($this->group === null) {
            $config = $this->attachmentsMetadata();
            $group  = AttachmentContainerInterface::DEFAULT_GROUPING;

            if (isset($config['group'])) {
                $group = $config['group'];
                // If the 'default_group' is not set, search for it.
            } elseif (isset($config['default_group'])) {
                $group = $config['default_group'];
            // If the 'default_group' is not set, search for it.
            } elseif (isset($config['default_widget'])) {
                $widget   = $config['default_widget'];
                $metadata = $this->metadata();
                $found    = false;
                if (isset($metadata['admin']['form_groups'][$widget]['group'])) {
                    $group = $metadata['admin']['form_groups'][$widget]['group'];
                    $found = true;
                }

                if (!$found && isset($metadata['admin']['forms'])) {
                    foreach ($metadata['admin']['forms'] as $form) {
                        if (isset($form['groups'][$widget]['group'])) {
                            $group = $form['groups'][$widget]['group'];
                            $found = true;
                            break;
                        }
                    }
                }

                if (!$found && isset($metadata['admin']['dashboards'])) {
                    foreach ($metadata['admin']['dashboards'] as $dashboard) {
                        if (isset($dashboard['widgets'][$widget]['group'])) {
                            $group = $dashboard['widgets'][$widget]['group'];
                            $found = true;
                            break;
                        }
                    }
                }
            }

            if (!is_string($group)) {
                throw new UnexpectedValueException('The attachment grouping must be a string.');
            }

            $this->group = $group;
        }

        return $this->group;
    }
public function attachmentGroup ( ) { if ( $ this -> group === null ) { $ config = $ this -> attachmentsMetadata ( ) ; $ group = AttachmentContainerInterface :: DEFAULT_GROUPING ; if ( isset ( $ config [ 'group' ] ) ) { $ group = $ config [ 'group' ] ; // If the 'default_group' is not set, search for it. } elseif ( isset ( $ config [ 'default_group' ] ) ) { $ group = $ config [ 'default_group' ] ; // If the 'default_group' is not set, search for it. } elseif ( isset ( $ config [ 'default_widget' ] ) ) { $ widget = $ config [ 'default_widget' ] ; $ metadata = $ this -> metadata ( ) ; $ found = false ; if ( isset ( $ metadata [ 'admin' ] [ 'form_groups' ] [ $ widget ] [ 'group' ] ) ) { $ group = $ metadata [ 'admin' ] [ 'form_groups' ] [ $ widget ] [ 'group' ] ; $ found = true ; } if ( ! $ found && isset ( $ metadata [ 'admin' ] [ 'forms' ] ) ) { foreach ( $ metadata [ 'admin' ] [ 'forms' ] as $ form ) { if ( isset ( $ form [ 'groups' ] [ $ widget ] [ 'group' ] ) ) { $ group = $ form [ 'groups' ] [ $ widget ] [ 'group' ] ; $ found = true ; break ; } } } if ( ! $ found && isset ( $ metadata [ 'admin' ] [ 'dashboards' ] ) ) { foreach ( $ metadata [ 'admin' ] [ 'dashboards' ] as $ dashboard ) { if ( isset ( $ dashboard [ 'widgets' ] [ $ widget ] [ 'group' ] ) ) { $ group = $ dashboard [ 'widgets' ] [ $ widget ] [ 'group' ] ; $ found = true ; break ; } } } } if ( ! is_string ( $ group ) ) { throw new UnexpectedValueException ( 'The attachment grouping must be a string.' ) ; } $ this -> group = $ group ; } return $ this -> group ; }
Retrieve the widget's attachment grouping.

@throws UnexpectedValueException If the grouping is invalid.
@return string
Retrieve the widget s attachment grouping .