Automattic\WooCommerce\Internal\Admin\BlockTemplates
AbstractBlock::__construct()
Block constructor.
Метод класса: AbstractBlock{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$AbstractBlock = new AbstractBlock(); $AbstractBlock->__construct( $config, $root_template, $parent );
- $config(массив) (обязательный)
- The block configuration.
- $root_template(BlockTemplateInterface) (обязательный)
- The block template that this block belongs to.
- $parent(BlockContainerInterface|null)
- The parent block container.
По умолчанию: null
Код AbstractBlock::__construct() AbstractBlock:: construct WC 8.7.0
public function __construct( array $config, BlockTemplateInterface &$root_template, ContainerInterface &$parent = null ) { $this->validate( $config, $root_template, $parent ); $this->root_template = $root_template; $this->parent = is_null( $parent ) ? $root_template : $parent; $this->name = $config[ self::NAME_KEY ]; if ( ! isset( $config[ self::ID_KEY ] ) ) { $this->id = $this->root_template->generate_block_id( $this->get_name() ); } else { $this->id = $config[ self::ID_KEY ]; } if ( isset( $config[ self::ORDER_KEY ] ) ) { $this->order = $config[ self::ORDER_KEY ]; } if ( isset( $config[ self::ATTRIBUTES_KEY ] ) ) { $this->attributes = $config[ self::ATTRIBUTES_KEY ]; } if ( isset( $config[ self::HIDE_CONDITIONS_KEY ] ) ) { foreach ( $config[ self::HIDE_CONDITIONS_KEY ] as $hide_condition ) { $this->add_hide_condition( $hide_condition['expression'] ); } } if ( isset( $config[ self::DISABLE_CONDITIONS_KEY ] ) ) { foreach ( $config[ self::DISABLE_CONDITIONS_KEY ] as $disable_condition ) { $this->add_disable_condition( $disable_condition['expression'] ); } } }