How to fix images in visual composer don't expaned layout - html

I create an element but textarea_html container image overflowed. Help me fix error.
Image overflows
code param teaxtarea_html
array(
'type' => 'textarea_html',
'holder' => 'div',
'heading' => __( 'Text', 'japan-language' ),
'param_name' => 'content',
'value' => __( 'Default value', 'japan-language' ),
'description' => __( 'Box Text', 'japan-language' ),
'admin_label' => false,
'weight' => 0,
'group' => 'Custom Group',
)

Related

Yii2 logout Method Not Allowed (#405)

I'm using adminlte advanced template for backend. I want to add logout in the left column.
I've read other posts and I understand I've to add data method post. I've added it in following line in left.php file, but it doesn't work. How to make it work?
<?= dmstr\widgets\Menu::widget(
[
'options' => ['class' => 'sidebar-menu tree', 'data-widget'=> 'tree'],
'items' => [
['label' => 'Logout', 'icon' => 'file-code-o', 'url' => ['/site/logout'], 'data-method'=>'post'],
]
) ?>
It is extending the yii\widgets\Menu and you need to specify the template to modify or add any attribute to the link as the data-method="post" needs to be added to your link you should change the code to the following
echo
dmstr\widgets\Menu::widget(
[
'options' => ['class' => 'sidebar-menu tree', 'data-widget'=> 'tree'],
'items' => [
['label' => 'Logout', 'icon' => 'file-code-o', 'url' => ['/site/logout'], 'template'=>'{label}'],
]
);
You can add a form in to your click field:
$items[] = [
[
'label' => 'Logout',
'icon' => 'file-code-o',
'url' => ['/site/logout'],
'template' => Html::beginForm(array('site/logout')) .
Html::submitButton('Logout') . Html::endForm(),
],
];

How to remove default upload field label?

In one of my uploader field, I see a caption displays as the field label which I have failed to change or remove.
Seriously I don't know where it comes from
How to disappear that default label? What to change in my html code? Actually i am using twig php to call the field from an Class object.
profile.html.twig
<div class="row">
<div class="col-md-12 text-center">
<h4>{{user.civilite}} {{ user.nom }} {{ user.prenom }}</h4>
</div>
<div class="col-md-12">
<img class="img-responsive" id="profile-image" src="{{ asset('uploads/profile/images') }}/{{ user.imageprofil }}" alt="">
</div>
</div>
ProfileFormType.php
public function buildForm(FormBuilderInterface $builder, array $options) {
$builder->add('imageProfil')->add('imageFile', VichImageType::class, array('label' => false, 'required' => false ))
->add('civilite', ChoiceType::class, array('choices' => array('M.' => 'M', 'Mme.' => 'Mme'),
'attr' => array(
'class' => 'form-control',
'placeholder' => 'Nom de Famille',
'style' => "margin-bottom:5px;"
)))
->add('nom', TextType::class, array('label' => 'Nom de Famille', 'attr' => array(
'class' => 'form-control',
'placeholder' => 'Nom de Famille',
'style' => "margin-bottom:5px;"
)))
->add('prenom', TextType::class, array('label' => 'Prénom', 'attr' => array(
'class' => 'form-control',
'placeholder' => 'Prénom',
'style' => "margin-bottom:5px;"
)))
->add('email', EmailType::class, array('label' => 'Email', 'attr' => array(
'class' => 'form-control',
'placeholder' => 'Email',
'style' => "margin-bottom:5px;"
)))
Where i can code to disappear the label caption?
i.e. "Aucun fichier choisi"
Solution
<style>
#app_user_profile_imageFile_file {
display: block;
color: transparent;
}
#app_user_profile_imageProfil{
width: 100px;
}
</style>
This is native part of webkit browsers.
You can't remove it the normal way, but you can trick the browser not to show it with little bit of css - just make the font color transparent.
input[type='file'] {
color: transparent;
}
Just add option parameter ['label' => false]

Yii2 ?: condition in layouts/main.php

I want to write a condition like this, for example:
Yii::$app->user->isGuest ? (
['label' => 'Sign Up', 'url' => ['/site/signup']]
):(
//do nothing
)
Can ?: condition be without else part?
EDIT:
It is sent to the array 'items' => [] and that's why the code below doesn't work:
if(Yii::$app->user->isGuest)(
['label' => 'Sign Up', 'url' => ['/site/signup']];
)
The full code:
NavBar::begin([
//somecode
]);
echo Nav::widget([
'options' => ['class' => 'navbar-nav navbar-right'],
'items' => [
Yii::$app->user->isGuest ? (
['label' => 'Sign Up', 'url' => ['/site/signup']]
):(
//HOW TO DO NOTHING HERE???
)
],
]);
it's possibe if you use condition in array,..
maybe you can check this link.
Conditionally show items of Nav widget
maybe useful
CMIIW
You may write this as -
['label' => 'Sign Up', 'url' => ['/site/signup'], 'visible' => Yii::$app->user->isGuest ]

How to add wordpress custom HTML to wp_nav_menu?

The default wordpress HTML output for nav
is ul tag and li tag...
I want to use my custom nav. For example
<nav class="nav">
About Us
News
Departments
Contact
</nav>
Wordpress has some default args for the menu that you can change
<?php
$args = array(
'theme_location' => '',
'menu' => '',
'container' => 'div',
'container_class' => '',
'container_id' => '',
'menu_class' => 'menu',
'menu_id' => '',
'echo' => true,
'fallback_cb' => 'wp_page_menu',
'before' => '',
'after' => '',
'link_before' => '',
'link_after' => '',
'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>',
);
echo wp_nav_menu( $args );
?>
In the wp-includes/nav-menu-template.php file you can change even more things. But if you change code in the corefiles than it may be overwritten by future upgrades, so be carefull.

Yii2 - NavBar widget hyperlink to div

anyone knows how can i in Yii2 using the navbar widget make a hyperlink to a div that is above the 100% height screen and is hidden in order that the screen scrolls down to it?
The code i'm using for the navbar is the standard one that comes with yii in layout.php
['label' => 'Contact', 'url' => ['/site/contact']],
I substitute 'url' => ['/site/contact']], --> by something like 'url' => ['#divid']],
But it doesn't works.
Many thanks in advance for an answer.
Just specify url as a string:
['label' => 'Contact', 'url' => '#divId'],
Url parameter is processed by Url::to() method, you can see there how string is interpreted:
a normal string: it will be returned as is.
Thank you very much for your help, it works. I was trying to do this
<body data-spy="scroll" data-target="#navbar" data-offset="50">
<?php $this->beginBody() ?>
<div class="wrap">
<?php
NavBar::begin([
//'brandLabel' => Yii::$app->name,
'brandLabel' => '<img src="SLOGAN.png" style="display:inline; vertical-align:top; margin-top:20px; margin-left: 10px;"/>',
'brandUrl' => Yii::$app->homeUrl,
'options' => [
'class' => 'navbar navbar-fixed-top navbar-inverse',
'id'=>'navbar'
],
]);
echo Nav::widget([
'options' => ['class' => 'nav navbar-nav navbar-left'],
'items' => [
['label' => 'HOME', 'url' => '#section1'],
['label' => 'ABOUT', 'url' => '#section2'],
['label' => 'SERVICES', 'url' =>'#section3'],
['label' => 'FAQS', 'url' => '#section4'],
['label' => 'CONTACTS', 'url' => '#section5'],