public function getSidebar($sidebar_name)
    {
        $registered_sidebars = json_decode($this->drivers->getDriver()->wpcli('sidebar', 'list', [
            '--format=json',
        ])['stdout']);

        $sidebar_id = null;

        foreach ($registered_sidebars as $sidebar) {
            if ($sidebar_name === $sidebar->name) {
                $sidebar_id = $sidebar->id;
                break;
            }
        }

        if ($sidebar_id === null) {
            throw new UnexpectedValueException(sprintf('[W506] Sidebar "%s" does not exist', $sidebar_name));
        }

        return $sidebar_id;
    }
public function getSidebar($sidebar_name)
    {
        $registered_sidebars = json_decode($this->drivers->getDriver()->wpcli('sidebar', 'list', [
            '--format=json',
        ])['stdout']);

        $sidebar_id = null;

        foreach ($registered_sidebars as $sidebar) {
            if ($sidebar_name === $sidebar->name) {
                $sidebar_id = $sidebar->id;
                break;
            }
        }

        if ($sidebar_id === null) {
            throw new UnexpectedValueException(sprintf('[W506] Sidebar "%s" does not exist', $sidebar_name));
        }

        return $sidebar_id;
    }
public function getSidebar ( $ sidebar_name ) { $ registered_sidebars = json_decode ( $ this -> drivers -> getDriver ( ) -> wpcli ( 'sidebar' , 'list' , [ '--format=json' , ] ) [ 'stdout' ] ) ; $ sidebar_id = null ; foreach ( $ registered_sidebars as $ sidebar ) { if ( $ sidebar_name === $ sidebar -> name ) { $ sidebar_id = $ sidebar -> id ; break ; } } if ( $ sidebar_id === null ) { throw new UnexpectedValueException ( sprintf ( '[W506] Sidebar "%s" does not exist' , $ sidebar_name ) ) ; } return $ sidebar_id ; }
Gets a sidebar ID from its human-readable name

@param string $sidebar_name The name of the sidebar (e.g. 'Footer', 'Widget Area', 'Right Sidebar')

@throws UnexpectedValueException If the sidebar is not registered

@return string The sidebar ID
Gets a sidebar ID from its human - readable name