OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform OroPlatform – How do I? Questions Trying add Xing to social_url_format

This topic contains 3 replies, has 3 voices, and was last updated by  Yurii Muratov 6 years, 1 month ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #36562

    SkaiBoa
    Participant

    Hi,

    I want to expand the definitions in the File vendor/oro/crm/src/Oro/Bundle/ContactBundle/DependencyInjection/Configuration.php.

    Try this in my Bundle:

    class Configuration implements ConfigurationInterface
    {
    /**
    * {@inheritDoc}
    */
    public function getConfigTreeBuilder()
    {
    $treeBuilder = new TreeBuilder();
    $rootNode = $treeBuilder->root('oro_contact');
    SettingsBuilder::append(
    $rootNode,
    [
    'social_url_format' => [
    'value' => ['xing' => 'https://xing.com/profile/%%username%%']
    ]
    ]
    );
    return $treeBuilder;
    }

    But it doesnt work. Then i try this:

    $treeBuilder = new TreeBuilder();
    $rootNode = $treeBuilder->root('oro_contact')
    ->children()
    ->arrayNode('social_url_format');
    SettingsBuilder::append(
    $rootNode,
    [
    'xing' => [
    'value' => ['value' => 'https://xing.com/profile/%%username%%']
    ]
    ]
    );
    return $treeBuilder;
    }

    Doesnt work either.

    Can you give me a hint what i’m doing wrong ?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #36563

    adriwan_kenoby
    Participant

    According to the doc, “Each option can get a default value and a type (one of scalar, boolean or array). The default type if none is specified is scalar”, so if you want to declare some array type config you should try :

    Moreover I don’t think that you can use associative array in conf

    https://oroinc.com/orocrm/doc/2.0/book/configuration

    #36564

    SkaiBoa
    Participant

    Thx for your answer. That was a poor wording on my side for my problem.
    I found in vendor/oro/crm/src/Oro/Bundle/ContactBundle/DependencyInjection/Configuration.php following

    There are four connections to social media but not Xong. Now I want to add it.
    My last try:

    There are no errors through this configuration. But when I try to use Xing for social_url_format I will get:


    An exception has been thrown during the rendering of a template ("Unknown social network type "xing"").

    Maybe my configuration sucks or I miss some other for using Xing in social_url_format.

    #36565

    Yurii Muratov
    Participant

    Hello, @SkaiBoa.

    Unfortunately, symfony does not support adding new parameters to the bundle configuration from another bundle and current configuration of ContactBundle does not allow to add custom format strings via bundle configuration.

    But in your case, you can add your formatter string throw compiler pass.

    Here is an example of such compiler:

    And the adding this compiler at the Bundle class:

    We will have a look at ContactBundle configuration and fix the impossibility to add and modify the social_url_format strings without additional code. (internal ID – CRM-8770)

Viewing 3 replies - 1 through 3 (of 3 total)

The forum ‘OroPlatform – How do I? Questions’ is closed to new topics and replies.

Back to top