first commit

This commit is contained in:
Roman Pyrih
2023-07-24 08:30:51 +02:00
commit c2e100a763
7128 changed files with 1622619 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
<?php
use BrizyPlaceholders\ContentPlaceholder;
class Brizy_Content_Placeholders_Permalink extends Brizy_Content_Placeholders_Simple {
/**
* Brizy_Content_Placeholders_Simple constructor.
*
* @param $label
* @param $placeholder
* @param $value
* @param string $display
*/
public function __construct() {
parent::__construct( 'Permalink', 'brizy_dc_permalink', null );
}
/**
* @param ContentPlaceholder $contentPlaceholder
* @param Brizy_Content_Context $context
*
* @return mixed|string
*/
public function getValue(\BrizyPlaceholders\ContextInterface $context, ContentPlaceholder $contentPlaceholder) {
$attributes = $contentPlaceholder->getAttributes();
if ( isset( $attributes['post_id'] ) && (int) $attributes['post_id'] > 0 ) {
return get_permalink( (int) $attributes['post_id'] );
}
return '';
}
}