Frontend link v zgornji vrstici
parent
d2a6db7d27
commit
f67a9f86b7
|
@ -0,0 +1,20 @@
|
|||
uuid: 9576d52b-0e7a-482d-b817-5f50440b7b1f
|
||||
langcode: sl
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- yufu_admin
|
||||
theme:
|
||||
- gin
|
||||
id: gin_frontendlink
|
||||
theme: gin
|
||||
region: breadcrumb
|
||||
weight: 0
|
||||
provider: null
|
||||
plugin: yufu_admin_frontend_link
|
||||
settings:
|
||||
id: yufu_admin_frontend_link
|
||||
label: 'Frontend link'
|
||||
label_display: '0'
|
||||
provider: yufu_admin
|
||||
visibility: { }
|
|
@ -0,0 +1,20 @@
|
|||
uuid: d841654b-cd40-4ec1-827b-ec710f8dbc8f
|
||||
langcode: sl
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- yufu_admin
|
||||
theme:
|
||||
- olivero
|
||||
id: olivero_frontendlink
|
||||
theme: olivero
|
||||
region: secondary_menu
|
||||
weight: 0
|
||||
provider: null
|
||||
plugin: yufu_admin_frontend_link
|
||||
settings:
|
||||
id: yufu_admin_frontend_link
|
||||
label: 'Frontend link'
|
||||
label_display: '0'
|
||||
provider: yufu_admin
|
||||
visibility: { }
|
|
@ -10,3 +10,11 @@ Obveščanje preko mailov, ko se spremeni revizija koncepta.
|
|||
2. Kot urednik objavimo predlagane spremembe.
|
||||
- Fino bi bilo imet pregled (view) predlaganih in še ne objavljenih sprememb.
|
||||
3. Pogledamo v mailhog, če so se maili poslali. (ddev status)
|
||||
|
||||
## Frontend link
|
||||
|
||||
Definiramo ga v drupal nastavitvah za site:
|
||||
|
||||
```php
|
||||
$settings['yufu_frontend'] = 'http://localhost:3000';
|
||||
```
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Drupal\yufu_admin\Plugin\Block;
|
||||
|
||||
use Drupal\Core\Block\BlockBase;
|
||||
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
|
||||
use Drupal\Core\Site\Settings;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Provides a frontend link block.
|
||||
*
|
||||
* @Block(
|
||||
* id = "yufu_admin_frontend_link",
|
||||
* admin_label = @Translation("Frontend link"),
|
||||
* category = @Translation("yufu"),
|
||||
* )
|
||||
*/
|
||||
final class FrontendLinkBlock extends BlockBase implements ContainerFactoryPluginInterface {
|
||||
|
||||
private $frontendLink = '';
|
||||
|
||||
/**
|
||||
* Constructs the plugin instance.
|
||||
*/
|
||||
public function __construct(
|
||||
array $configuration,
|
||||
$plugin_id,
|
||||
$plugin_definition,
|
||||
private readonly Settings $settings,
|
||||
) {
|
||||
parent::__construct($configuration, $plugin_id, $plugin_definition);
|
||||
|
||||
$this->frontendLink = $settings->get('yufu_frontend', FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition): self {
|
||||
return new self(
|
||||
$configuration,
|
||||
$plugin_id,
|
||||
$plugin_definition,
|
||||
$container->get('settings'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function build(): array {
|
||||
$build['content'] = [
|
||||
'#markup' => "<a target=\"_blank\" href=\"{$this->frontendLink}\">{$this->t('Frontend')}</a>"
|
||||
];
|
||||
return $build;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue