EditorJS/BlockHandler.php
private function expandToolSettings($rule)
    {
        if (is_string($rule)) {
            // 'blockName': 'string' – tool with string type and default settings
            $expandedRule = ["type" => $rule];
        } elseif (is_array($rule)) {
            if ($this->isAssoc($rule)) {
                $expandedRule = $rule;
            } else {
                // 'blockName': [] – tool with canBeOnly and default settings
                $expandedRule = ["type" => "string", "canBeOnly" => $rule];
            }
        } else {
            throw new EditorJSException("Cannot determine element type of the rule `$rule`.");
        }

        return $expandedRule;
    }
private function expandToolSettings($rule)
    {
        if (is_string($rule)) {
            // 'blockName': 'string' – tool with string type and default settings
            $expandedRule = ["type" => $rule];
        } elseif (is_array($rule)) {
            if ($this->isAssoc($rule)) {
                $expandedRule = $rule;
            } else {
                // 'blockName': [] – tool with canBeOnly and default settings
                $expandedRule = ["type" => "string", "canBeOnly" => $rule];
            }
        } else {
            throw new EditorJSException("Cannot determine element type of the rule `$rule`.");
        }

        return $expandedRule;
    }
private function expandToolSettings ( $ rule ) { if ( is_string ( $ rule ) ) { // 'blockName': 'string' – tool with string type and default settings $ expandedRule = [ "type" => $ rule ] ; } elseif ( is_array ( $ rule ) ) { if ( $ this -> isAssoc ( $ rule ) ) { $ expandedRule = $ rule ; } else { // 'blockName': [] – tool with canBeOnly and default settings $ expandedRule = [ "type" => "string" , "canBeOnly" => $ rule ] ; } } else { throw new EditorJSException ( "Cannot determine element type of the rule `$rule`." ) ; } return $ expandedRule ; }
Expand shortified tool settings

@param $rule – tool settings

@throws EditorJSException

@return array – expanded tool settings
Expand shortified tool settings