Snippets Collections
phases:
  build:
    commands:
       - composer update --no-interaction --ignore-platform-req=ext-redis --ignore-platform-req=ext-redis
       - bin/console assets:install
       - bin/console pimcore:deployment:classes-rebuild -v -c
       - bin/console cache:clear
artifacts:
  files:
    - '**/*'
//create a button (layout component) in the object class

//example you want to create a slug based on a field name 'title' (text input)
//to save in the field 'url' (text input)
//click on the button will automatically create the slug

//copy and paste the following code in the button handler
((btn)=>{

//get button id
const id = btn.id
//get button element
const button = document.getElementById(id);
//define the current DataObject as workspace in order to find the elements  
const workspace = '_data_object_name'; //ex. News
  
//find the root element of the record
const root = button.closest('div.pimcore_class_' + workspace);

//find the source input field by name with the value to slugify (in this example 'title')
const source = root.querySelector('input[name="title"]');
//find the targe input field by name with the slugified value (in this example 'url')  
const target = root.querySelector('input[name="url"]');

//set the target value with the slugified value
target.value = slugify(source.value);

function slugify(str)
{
    str = str.replace(/^\s+|\s+$/g, '');

    // Make the string lowercase
    str = str.toLowerCase();

    // Remove accents, swap ñ for n, etc
    var from = "ÁÄÂÀÃÅČÇĆĎÉĚËÈÊẼĔȆÍÌÎÏŇÑÓÖÒÔÕØŘŔŠŤÚŮÜÙÛÝŸŽáäâàãåčçćďéěëèêẽĕȇíìîïňñóöòôõøðřŕšťúůüùûýÿžþÞĐđßÆa·/_,:;";
    var to   = "AAAAAACCCDEEEEEEEEIIIINNOOOOOORRSTUUUUUYYZaaaaaacccdeeeeeeeeiiiinnooooooorrstuuuuuyyzbBDdBAa------";
    for (var i=0, l=from.length ; i<l ; i++) {
        str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
    }

    // Remove invalid chars
    str = str.replace(/[^a-z0-9 -]/g, '') 
    // Collapse whitespace and replace by -
    .replace(/\s+/g, '-') 
    // Collapse dashes
    .replace(/-+/g, '-'); 

    return str;
}
});
{% set locale = document.getProperty('language') %}
# RUN TO CREATE A NEW PROJECT
# docker run --rm -v `pwd`:/var/www/html pimcore/pimcore:PHP8.0-fpm composer create-project pimcore/skeleton my-project

cd ./{NAME_OF_THE_PROJECT_FOLDER}

docker-compose up -d

# TO RUN ONLY WITH A LOCAL DATABASE.
# docker-compose exec php-fpm vendor/bin/pimcore-install --mysql-host-socket=db --mysql username=pimcore --mysql-password=pimcore --mysql-database=pimcore

docker-compose exec php-fpm composer install

docker-compose exec php-fpm chown -R www-data:www-data var

/* clone repo */
git clone ...

/* docker up */
docker-compose up -d

/* Install pimcore dependencies*/
docker exec -it php-fpm /bin/bash
composer install

/* Install pimcore and define local db */
docker-compose exec php-fpm vendor/bin/pimcore-install --mysql-host-socket=db --mysql-username=pimcore --mysql-password=pimcore --mysql-database=pimcore

/* change owner to ./var folder */
docker-compose exec php-fpm chown -R www-data:www-data var
star

Tue Mar 28 2023 15:24:21 GMT+0000 (Coordinated Universal Time)

#pimcore #aws #codebuild
star

Sat Nov 05 2022 09:39:40 GMT+0000 (Coordinated Universal Time)

#javascript #pimcore
star

Thu Mar 24 2022 17:00:37 GMT+0000 (Coordinated Universal Time)

#pimcore #twig
star

Wed Mar 23 2022 14:56:15 GMT+0000 (Coordinated Universal Time)

#pimcore #docker #docker-compose
star

Mon Jan 17 2022 08:34:07 GMT+0000 (Coordinated Universal Time)

#docker #pimcore

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension