fewbricks\bricks\brick::get_child_brick PHP Méthode

get_child_brick() protected méthode

Returns an instance of a class with the name of $brick_class_name as an ACF layout in flexible content.
protected get_child_brick ( string $brick_class_name, $name, boolean $is_layout = false, boolean $is_sub_field = false ) : mixed
$brick_class_name string The name of the class to get.
$name
$is_layout boolean
$is_sub_field boolean
Résultat mixed
    protected function get_child_brick($brick_class_name, $name, $is_layout = false, $is_sub_field = false)
    {
        $brick_class_name = 'fewbricks\\bricks\\' . $brick_class_name;
        // If we have not forced either sub field or layout
        if (!$is_layout && !$is_sub_field) {
            $is_layout = $this->is_layout;
            $is_sub_field = $this->is_sub_field;
            $name = $this->name . '_' . $name;
        }
        /** @noinspection PhpUndefinedMethodInspection */
        return (new $brick_class_name($name))->set_is_layout($is_layout)->set_is_sub_field($is_sub_field)->set_is_option($this->is_option);
    }