wieni / wmsingles

Singles are node types used for one-off pages that have unique content requirements
MIT License
1 stars 1 forks source link

Warning generated in overview controller #4

Closed ghost closed 7 years ago

ghost commented 7 years ago

The $list is not initialized to array. So if there are no singles to get then a warning is popped.

-- Added $list = [];

    /**
     * Get all single content types.
     * @return array|mixed
     */
    public function getAllSingles()
    {
        $list = &drupal_static(__FUNCTION__);
        if (!isset($list)) {
            $list = [];
            /** @var NodeTypeInterface $type */
            foreach (NodeType::loadMultiple() as $type) {
                if ($this->isSingle($type)) {
                    $list[$type->get('type')] = $type;
                }
            }
        }
        return $list;
    }
RobinHoutevelts commented 7 years ago

❤️

spoit commented 7 years ago

Thx! @RobinHoutevelts will follow up :)