Warning: The Facebook Jobs XML Feed is still experimental!
This Connector allows you to publish your Jobs on a xml output feed which will be parsed from the facebook company. To use this connector you need to provide fully configured Facebook App! Before you start be sure you've checked out the Setup Instructions.
First things first. To use this connector, you have to install the league/oauth2-facebook:
composer require league/oauth2-facebook:^2.0
Each Connector needs some Items Resolver
(Find the right object for the right context) and a single Item Transformer
(Transform your object into a valid Facebook xml block in this case full feed specification).
jobs:
data_class: Job
available_connectors:
- connector_name: facebook
connector_item_transformer: App\Transformer\FacebookItemTransformer
connector_items_resolver:
- type: feed
Now head back to the backend (System
=> Jobs Configuration
) and checkout the facebook tab.
- Click on
Install
- Click on
Enable
- Before you hit the
Connect
button, you need to fill you out the Connector Configuration. After that, click "Save". - Click
Connect
This will guide you through the facebook token generation. After hitting the "Connect" button, a new window will open. After a access token has been successfully generated, you can close the window. Click on "Check & Apply Connection" to finalize the connection state.
This Connector requires a fully registered feed. Click on "Add Feed" and start the generation process. First, it will generate a Recruiting Manager Id
which is required by facebook.
If this step was successful, a second call will generate the feed itself. If this was successful too, your connector is fully configured and ready to use.
In our example we have a service class called App\Transformer\FacebookItemTransformer
.
Every Item Transformer has its own logic as you can see here:
<?php
namespace App\Transformer;
use JobsBundle\Context\ResolvedItemInterface;
use JobsBundle\Transformer\ItemTransformerDefinitionInterface;
use JobsBundle\Transformer\ItemTransformerInterface;
use Pimcore\Model\DataObject\MyJobClass;
class FacebookItemTransformer implements ItemTransformerInterface
{
public function transform(ResolvedItemInterface $item, ItemTransformerDefinitionInterface $itemTransformerDefinition): void
{
/** @var MyJobClass $subject */
$subject = $item->getSubject();
$contextDefinition = $item->getContextItem()->getContextDefinition();
$locale = $contextDefinition->getLocale();
$itemTransformerDefinition->setTitle($subject->getTitle());
$itemTransformerDefinition->setSalary($subject->getSalary());
}
}
There is only a simple items resolver required since the facebook connector will output its data via a data feed.
You're done. Go to your job object and enable all required context definitions.