reinstalled all contribs with composer

need to run :
drush ev 'drupal_flush_all_caches();'
drush cr
and restart nginx and php-fpm before loading the website
This commit is contained in:
2019-04-30 19:27:47 +02:00
parent e1f9bb3cd0
commit 9da6cf9927
373 changed files with 3392 additions and 5 deletions
@@ -0,0 +1,59 @@
<?php
namespace Drupal\edlp_studio;
use Drupal\Core\Entity\EntityAccessControlHandler;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Access\AccessResult;
/**
* Access controller for the Chutier entity.
*
* @see \Drupal\edlp_studio\Entity\Chutier.
*/
class ChutierAccessControlHandler extends EntityAccessControlHandler {
/**
* {@inheritdoc}
*/
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
/** @var \Drupal\edlp_studio\Entity\ChutierInterface $entity */
switch ($operation) {
case 'view':
if (!$entity->isPublished()) {
if($account->hasPermission('view own unpublished chutier entities') && $account->isAuthenticated() && $account->id() == $entity->getOwnerId() ){
return AccessResult::allowed()->cachePerPermissions()->cachePerUser()->addCacheableDependency($entity);
}else{
return AccessResult::allowedIfHasPermission($account, 'view any unpublished chutier entities');
}
}
return AccessResult::allowedIfHasPermission($account, 'view published chutier entities');
case 'update':
if($account->hasPermission('edit own chutier entities') && $account->isAuthenticated() && $account->id() == $entity->getOwnerId() ){
return AccessResult::allowed()->cachePerPermissions()->cachePerUser()->addCacheableDependency($entity);
}else{
return AccessResult::allowedIfHasPermission($account, 'edit any chutier entities');
}
case 'delete':
if($account->hasPermission('delete own chutier entities') && $account->isAuthenticated() && $account->id() == $entity->getOwnerId() ){
return AccessResult::allowed()->cachePerPermissions()->cachePerUser()->addCacheableDependency($entity);
}else{
return AccessResult::allowedIfHasPermission($account, 'delete chutier entities');
}
}
// Unknown operation, no opinion.
return AccessResult::neutral();
}
/**
* {@inheritdoc}
*/
protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
return AccessResult::allowedIfHasPermission($account, 'add chutier entities');
}
}
@@ -0,0 +1,56 @@
<?php
namespace Drupal\edlp_studio;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\Routing\AdminHtmlRouteProvider;
use Symfony\Component\Routing\Route;
/**
* Provides routes for Chutier entities.
*
* @see \Drupal\Core\Entity\Routing\AdminHtmlRouteProvider
* @see \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider
*/
class ChutierHtmlRouteProvider extends AdminHtmlRouteProvider {
/**
* {@inheritdoc}
*/
public function getRoutes(EntityTypeInterface $entity_type) {
$collection = parent::getRoutes($entity_type);
$entity_type_id = $entity_type->id();
if ($settings_form_route = $this->getSettingsFormRoute($entity_type)) {
$collection->add("$entity_type_id.settings", $settings_form_route);
}
return $collection;
}
/**
* Gets the settings form route.
*
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type.
*
* @return \Symfony\Component\Routing\Route|null
* The generated route, if available.
*/
protected function getSettingsFormRoute(EntityTypeInterface $entity_type) {
if (!$entity_type->getBundleEntityType()) {
$route = new Route("/admin/structure/{$entity_type->id()}/settings");
$route
->setDefaults([
'_form' => 'Drupal\edlp_studio\Form\ChutierSettingsForm',
'_title' => "{$entity_type->getLabel()} settings",
])
->setRequirement('_permission', $entity_type->getAdminPermission())
->setOption('_admin_route', TRUE);
return $route;
}
}
}
@@ -0,0 +1,49 @@
<?php
namespace Drupal\edlp_studio;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityListBuilder;
use Drupal\Core\Link;
/**
* Defines a class to build a listing of Chutier entities.
*
* @ingroup edlp_studio
*/
class ChutierListBuilder extends EntityListBuilder {
/**
* {@inheritdoc}
*/
public function buildHeader() {
$header['id'] = $this->t('Chutier ID');
$header['name'] = $this->t('Name');
$header['user'] = $this->t('User');
// $header['default'] = $this->t('User id');
return $header + parent::buildHeader();
}
/**
* {@inheritdoc}
*/
public function buildRow(EntityInterface $entity) {
/* @var $entity \Drupal\edlp_studio\Entity\Chutier */
$row['id'] = $entity->id();
$row['name'] = Link::createFromRoute(
$entity->label(),
'entity.chutier.edit_form',
['chutier' => $entity->id()]
);
$row['user'] = Link::createFromRoute(
$entity->getOwner()->getUserName(),
'entity.user.canonical',
['user' => $entity->getOwnerId()]
);
// $row['uid'] = $entity->getOwnerId();
return $row + parent::buildRow($entity);
}
}
@@ -0,0 +1,59 @@
<?php
namespace Drupal\edlp_studio;
use Drupal\Core\Entity\EntityAccessControlHandler;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Access\AccessResult;
/**
* Access controller for the Composition entity.
*
* @see \Drupal\edlp_studio\Entity\Composition.
*/
class CompositionAccessControlHandler extends EntityAccessControlHandler {
/**
* {@inheritdoc}
*/
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
/** @var \Drupal\edlp_studio\Entity\CompositionInterface $entity */
switch ($operation) {
case 'view':
if (!$entity->isPublished()) {
if($account->hasPermission('view own unpublished composition entities') && $account->isAuthenticated() && $account->id() == $entity->getOwnerId() ){
return AccessResult::allowed()->cachePerPermissions()->cachePerUser()->addCacheableDependency($entity);
}else{
return AccessResult::allowedIfHasPermission($account, 'view any unpublished composition entities');
}
}
return AccessResult::allowedIfHasPermission($account, 'view published composition entities');
case 'update':
if($account->hasPermission('edit own composition entities') && $account->isAuthenticated() && $account->id() == $entity->getOwnerId() ){
return AccessResult::allowed()->cachePerPermissions()->cachePerUser()->addCacheableDependency($entity);
}else{
return AccessResult::allowedIfHasPermission($account, 'edit any composition entities');
}
case 'delete':
if($account->hasPermission('delete own composition entities') && $account->isAuthenticated() && $account->id() == $entity->getOwnerId() ){
return AccessResult::allowed()->cachePerPermissions()->cachePerUser()->addCacheableDependency($entity);
}else{
return AccessResult::allowedIfHasPermission($account, 'delete composition entities');
}
}
// Unknown operation, no opinion.
return AccessResult::neutral();
}
/**
* {@inheritdoc}
*/
protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
return AccessResult::allowedIfHasPermission($account, 'add composition entities');
}
}
@@ -0,0 +1,56 @@
<?php
namespace Drupal\edlp_studio;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\Routing\AdminHtmlRouteProvider;
use Symfony\Component\Routing\Route;
/**
* Provides routes for Composition entities.
*
* @see \Drupal\Core\Entity\Routing\AdminHtmlRouteProvider
* @see \Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider
*/
class CompositionHtmlRouteProvider extends AdminHtmlRouteProvider {
/**
* {@inheritdoc}
*/
public function getRoutes(EntityTypeInterface $entity_type) {
$collection = parent::getRoutes($entity_type);
$entity_type_id = $entity_type->id();
if ($settings_form_route = $this->getSettingsFormRoute($entity_type)) {
$collection->add("$entity_type_id.settings", $settings_form_route);
}
return $collection;
}
/**
* Gets the settings form route.
*
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type.
*
* @return \Symfony\Component\Routing\Route|null
* The generated route, if available.
*/
protected function getSettingsFormRoute(EntityTypeInterface $entity_type) {
if (!$entity_type->getBundleEntityType()) {
$route = new Route("/admin/structure/studio/{$entity_type->id()}/settings");
$route
->setDefaults([
'_form' => 'Drupal\edlp_studio\Form\CompositionSettingsForm',
'_title' => "{$entity_type->getLabel()} settings",
])
->setRequirement('_permission', $entity_type->getAdminPermission())
->setOption('_admin_route', TRUE);
return $route;
}
}
}
@@ -0,0 +1,40 @@
<?php
namespace Drupal\edlp_studio;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityListBuilder;
use Drupal\Core\Link;
/**
* Defines a class to build a listing of Composition entities.
*
* @ingroup edlp_studio
*/
class CompositionListBuilder extends EntityListBuilder {
/**
* {@inheritdoc}
*/
public function buildHeader() {
$header['id'] = $this->t('Composition ID');
$header['name'] = $this->t('Name');
return $header + parent::buildHeader();
}
/**
* {@inheritdoc}
*/
public function buildRow(EntityInterface $entity) {
/* @var $entity \Drupal\edlp_studio\Entity\Composition */
$row['id'] = $entity->id();
$row['name'] = Link::createFromRoute(
$entity->label(),
'entity.composition.edit_form',
['composition' => $entity->id()]
);
return $row + parent::buildRow($entity);
}
}
@@ -0,0 +1,176 @@
<?php
namespace Drupal\edlp_studio\Controller;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\User\UserDataInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Drupal\edlp_studio\Entity\Chutier;
/**
* Class ChutierController.
*/
class ChutierController extends ControllerBase {
protected $user;
protected $userdata;
/**
* Class constructor.
*/
public function __construct(AccountInterface $account, UserDataInterface $userdata) {
$this->user = $account;
$this->userdata = $userdata;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
// Instantiates this form class.
return new static(
// Load the service required to construct this class.
$container->get('current_user'),
$container->get('user.data')
);
}
/**
* AdddContent.
*
* @return json
* Return status.
*/
public function AddRemoveContent($action, $id, $cid) {
$this->error_message = null;
$status = 'ok';
// get current user :
// done by DependencyInjection of AccountInterface
// TODO: use the send chutier instead of default
// check if default chutier exists ? yes use it : no create and use it.
$this->checkChutier();
// dpm($this->chutier);
// check if $id exists, is a document, and does not already exist in chutier
switch($action){
case 'add':
$this->validateNewDoc($id);
if(!$this->error_message){
// add $id to documents field
$this->addNewDoc($id);
$message = t('Node @id added to chutier.', array('@id'=>$id));
}else{
$status = "error";
}
break;
case 'remove':
$this->removeDoc($id);
$message = t('Node @id removed to chutier.', array('@id'=>$id));
break;
}
$url = Chutier::getActionsUrl($id, $this->user->id());
$new_link_build = array(
'#title' => t("Chutier."),
'#type' => 'link',
'#url' => $url,
'#options'=>array(
'attributes' => array(
'data-drupal-link-system-path' => $url->getInternalPath()
)
)
);
$new_link = render($new_link_build);
if($status == 'error'){
$message = $this->error_message;
}
// JSON
$response = new JsonResponse();
$data = array(
'status' => $status,
'message' => $message,
'new_link' => $new_link,
'action_done' => $action,
);
$response->setData($data);
return $response;
// classic html
// return array(
// '#markup'=>'Status : ' . $status . ' | Message : ' . $message,
// );
}
private function addNewDoc($id){
$this->chutier->documents->appendItem($id);
$this->chutier->save();
}
private function removeDoc($id){
$values = array_column($this->chutier->documents->getValue(), 'target_id');
$index = array_search($id,$values);
$this->chutier->documents->removeItem($index);
$this->chutier->save();
}
private function validateNewDoc($id){
$node = entity_load('node', $id);
if($node){
// TODO: get node bundle by settings (@see readme)
if($node->getType() == 'enregistrement'){
$docs = array_column($this->chutier->documents->getValue(), 'target_id');
if( in_array($id, $docs) ){
$this->error_message = t("Node '@title'(@id) already exists in chutier '@name'(@cid)", array(
'@title'=>$node->getTitle(),
'@id'=>$id,
'@name' => $this->chutier->getName(),
'@cid' => $this->chutier->id())
);
}
}else{
$this->error_message = t("Node @title (@id) is not an Enregistrement (@type)", array(
'@title'=>$node->getTitle(),
'@id'=>$id,
'@type' => $node->getType())
);
}
}else{
$this->error_message = t("Node @id does not exists", array('@id'=>$id));
}
}
private function checkChutier(){
$default_chutier_id = $this->userdata->get('edlp_studio', $this->user->id(), 'default_chutier');
// dpm($this->default_chutier_id);
$this->chutier = entity_load('chutier', $default_chutier_id);
// if default chutier does not exists, create, save and record it
if(!$this->chutier){
$this->createDefaultChutier();
}
}
private function createDefaultChutier(){
// dpm('createDefaultChutier');
$this->createChutier();
$this->userdata->set('edlp_studio', $this->user->id(), 'default_chutier', $this->chutier->id());
}
public function createChutier(){
$chutier = array(
'id' => NULL,
'uid' => $this->user->id(),
'status' => TRUE,
'name' => t('Default'),
);
$this->chutier = entity_create('chutier', $chutier);
$this->chutier->save();
}
}
@@ -0,0 +1,207 @@
<?php
namespace Drupal\edlp_studio\Controller;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\User\UserDataInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\JsonResponse;
use Drupal\Core\Url;
use Drupal\edlp_studio\Entity\Compositon;
/**
* Class CompositionController.
*/
class CompositionController extends ControllerBase {
protected $user;
protected $userdata;
/**
* Class constructor.
*/
public function __construct(AccountInterface $account, UserDataInterface $userdata) {
$this->user = $account;
$this->userdata = $userdata;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
// Instantiates this form class.
return new static(
// Load the service required to construct this class.
$container->get('current_user'),
$container->get('user.data')
);
}
/**
* AdddContent.
*
* @return json
* Return status.
*/
public function CompositionActionJson($action, $cid, Request $request) {
$this->error_message = null;
$status = 'ok';
$message = 'Hello';
$response = new JsonResponse();
switch($action){
case 'create':
$name = $request->query->get('new_name');
if($name){
$this->createComposition($name);
}else{
$this->error_message = t("Composition creation needs a name as query paramater!");
}
break;
case 'open':
if($cid){
$this->openComposition($cid);
}else{
$this->error_message = t("Composition opening needs a cid as url paramater!");
}
break;
case 'save':
if($cid){
$name = $request->query->get('new_name');
$documents = $request->query->get('documents');
$this->saveComposition($cid, $name, $documents);
}else{
$this->error_message = t("Composition saving needs a cid as query paramater!");
}
break;
case 'delete':
if($cid){
$this->deleteComposition($cid);
}else{
$this->error_message = t("Composition deletion needs a cid as url paramater!");
}
break;
}
if($this->error_message){
$status = 'error';
$message = $this->error_message;
}
$data = array(
'action' => $action,
'status' => $status,
'message' => $this->error_message
);
if($status == 'ok'){
switch ($action) {
case 'create':
$url = Url::fromRoute('entity.composition.canonical', ['composition' => $this->compo->id()], ['absolute' => TRUE]);
$title = $this->compo->getName();
$new_link_build = array(
'#title' => $title,
'#type' => 'link',
'#url' => $url,
'#options'=>array(
'attributes' => array(
'data-drupal-link-system-path' => $url->getInternalPath(),
'cid' => $this->compo->id(),
'class' => ['composition-link'],
'title'=>$title,
),
),
);
$delete_url = Url::fromRoute('edlp_studio.composition_controller_action_ajax', ['action' => 'delete', 'cid' => $this->compo->id()], ['absolute' => TRUE]);
$deletelink_build = array(
'#title' => t('Delete'),
'#type' => 'link',
'#url' => $delete_url,
'#options'=>array(
'attributes' => array(
'data-drupal-link-system-path' => $delete_url->getInternalPath(),
'cid' => $this->compo->id(),
'class' => ['delete-composition-link'],
'title'=>t('Delete @title', array('@title'=>$title)),
),
),
);
$data += array(
'new_name' => $title,
'new_link' => render($new_link_build),
'delete_link' => render($deletelink_build),
);
break;
case 'open':
$this->getRendredComposition();
$data += array(
'compo' => $this->rendered_compo,
);
break;
case 'save':
$data += array(
'name'=>$name,
'documents'=>$documents
);
break;
}
}
$response->setData($data);
return $response;
// // classic html
// return array(
// '#markup'=>'Status : ' . $status . ' | Message : ' . $message,
// );
}
private function createComposition($name){
$compo = array(
'id' => NULL,
'uid' => $this->user->id(),
'status' => TRUE,
'name' => $name,
);
$this->compo = entity_create('composition', $compo);
$this->compo->save();
}
private function getRendredComposition(){
$view_builder = \Drupal::entityTypeManager()->getViewBuilder('composition');
$compobuild = $view_builder->view($this->compo, 'studio_ui');
$this->rendered_compo = render($compobuild);
}
private function openComposition($cid){
$this->compo = entity_load('composition', $cid);
}
private function saveComposition($cid, $name = "", $new_documents = array()){
$this->compo = entity_load('composition', $cid);
if($name != ""){
$this->compo->setName($name);
}
$documents = array();
if(count($new_documents)){
foreach ($new_documents as $nid) {
$documents[] = ['target_id'=>$nid];
}
}
$this->compo->set('documents', $documents);
$this->compo->save();
}
private function deleteComposition($cid){
$this->compo = entity_load('composition', $cid);
$this->compo->delete();
}
}
@@ -0,0 +1,201 @@
<?php
namespace Drupal\edlp_studio\Controller;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\User\UserDataInterface;
use Drupal\Core\Url;
use Drupal\Core\Language\LanguageInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
// use Drupal\Core\Cache\CacheableJsonResponse;
// use Drupal\Core\Cache\CacheableMetadata;
use Drupal\core\render\RenderContext;
use Drupal\edlp_studio\Entity\Chutier;
/**
* Class StudioUIController.
*/
class StudioUIController extends ControllerBase {
protected $user;
protected $userdata;
/**
* Class constructor.
*/
public function __construct(AccountInterface $account, UserDataInterface $userdata) {
$this->user = $account;
$this->userdata = $userdata;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
// Instantiates this form class.
return new static(
// Load the service required to construct this class.
$container->get('current_user'),
$container->get('user.data')
);
}
/**
* Studio-ui.
*
* @return array
* Return renderable array.
*/
public function StudioUI() {
return $this->buildStudioUI();
}
/**
* Studio-ui.
*
* @return array
* Return renderable array.
*/
public function StudioUIJson() {
$renderable = $this->buildStudioUI();
$rendered = render($renderable);
$data = ['rendered'=>$rendered];
// translations links
// use Drupal\Core\Url;
// use Drupal\Core\Language\LanguageInterface;
$route_name = 'edlp_studio.studio_ui';
$links = \Drupal::languageManager()->getLanguageSwitchLinks(LanguageInterface::TYPE_URL, Url::fromRoute($route_name));
if (isset($links->links)) {
$translations_build = [
'#theme' => 'links__language_block',
'#links' => $links->links,
'#attributes' => ['class' => ["language-switcher-{$links->method_id}",],],
'#set_active_class' => TRUE,
];
$translations_rendered = \Drupal::service('renderer')->executeInRenderContext(new RenderContext(), function () use ($translations_build) {return render($translations_build);});
$data['translations_links'] = $translations_rendered;
}
// JSON
$response = new JsonResponse();
$response->setData($data);
return $response;
}
public function StudioChutierUIJson(){
$renderable = $this->buildChutierUI();
$rendered = render($renderable);
// TODO: make response cachable
// JSON
$response = new JsonResponse();
$response->setData([
'rendered'=> $rendered,
]);
return $response;
}
private function buildStudioUI(){
return [
'#theme' => 'edlp_studio_ui',
'#chutier_ui' => $this->buildChutierUI(),
'#composition_ui' => $this->buildCompostionUI(),
];
}
private function buildChutierUI(){
// get his docs in chutier
$documents_nids = Chutier::getUserChutiersContents($this->user->id());
// dpm($documents_nids);
$documents = entity_load_multiple('node', $documents_nids);
// build content renderable array
$chutier_ui = array(
"#theme"=>'edlp_chutier_ui',
'#title' => t('Favorites'),
"#document_nodes" => $documents,
'#uid' => $this->user->id(),
);
return $chutier_ui;
}
private function buildCompostionUI(){
// build content renderable array
$composition_ui = array(
"#theme"=>'edlp_composition_ui',
"#title" => t('Composition'),
"#compositions" => $this->buildCompostionsList(),
"#composer_header" => t("Create a new playlist, then drag and drop your bookmarked sounds on the timeline below"),
"#lastcomposition" => $this->getLastCompo(),
'#composer_actions' => array(
'play_composition'=>array(
"#type"=>'container',
"#attributes"=>array(
"class"=>array("compo-player-controls")
)
),// TODO: add social media links (what about composition visibility uotside studio_ui ?)
),
);
return $composition_ui;
}
private function buildCompostionsList(){
// get compositions
$query = \Drupal::entityQuery('composition')
->condition('user_id', $this->user->id());
$compos_ids = $query->execute();
// dpm($compos_ids);
if(!count($compos_ids)){
// create default compos
$def_compos = \Drupal::entityManager()
->getStorage('composition')
->create(array(
'name' => 'composition',
'uid' => $this->user->id()
)
);
$def_compos->save();
$compos_ids = array($def_compos->id());
}
$compos = entity_load_multiple('composition', $compos_ids);
$createurl = Url::fromRoute('edlp_studio.composition_controller_action_ajax', ['action' => 'create'], ['absolute' => TRUE]);
return array(
'#theme' => 'edlp_compositions_list',
'#composition_entities' => $compos,
'#new_composition_url' => $createurl,
);
}
private function getLastCompo(){
// just get the last compositions
$query = \Drupal::entityQuery('composition')
->condition('user_id', $this->user->id())
->range(0,1)
->sort('created');
$compos_id = $query->execute();
if(count($compos_id)){
$lastcompo = entity_load('composition', array_pop($compos_id));
}else{
$lastcompo = null;
}
return $lastcompo;
}
}
@@ -0,0 +1,295 @@
<?php
namespace Drupal\edlp_studio\Entity;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Entity\ContentEntityBase;
use Drupal\Core\Entity\EntityChangedTrait;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\user\UserInterface;
use Drupal\Core\Url;
/**
* Defines the Chutier entity.
*
* @ingroup edlp_studio
*
* @ContentEntityType(
* id = "chutier",
* label = @Translation("Chutier"),
* handlers = {
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
* "list_builder" = "Drupal\edlp_studio\ChutierListBuilder",
* "views_data" = "Drupal\edlp_studio\Entity\ChutierViewsData",
*
* "form" = {
* "default" = "Drupal\edlp_studio\Form\ChutierForm",
* "add" = "Drupal\edlp_studio\Form\ChutierForm",
* "edit" = "Drupal\edlp_studio\Form\ChutierForm",
* "delete" = "Drupal\edlp_studio\Form\ChutierDeleteForm",
* },
* "access" = "Drupal\edlp_studio\ChutierAccessControlHandler",
* "route_provider" = {
* "html" = "Drupal\edlp_studio\ChutierHtmlRouteProvider",
* },
* },
* base_table = "chutier",
* admin_permission = "administer chutier entities",
* entity_keys = {
* "id" = "id",
* "label" = "name",
* "uuid" = "uuid",
* "uid" = "user_id",
* "langcode" = "langcode",
* "status" = "status",
* },
* links = {
* "canonical" = "/admin/structure/studio/chutier/{chutier}",
* "add-form" = "/admin/structure/studio/chutier/add",
* "edit-form" = "/admin/structure/studio/chutier/{chutier}/edit",
* "delete-form" = "/admin/structure/studio/chutier/{chutier}/delete",
* "collection" = "/admin/structure/studio/chutier",
* },
* field_ui_base_route = "chutier.settings"
* )
*/
class Chutier extends ContentEntityBase implements ChutierInterface {
use EntityChangedTrait;
/**
* {@inheritdoc}
*/
public static function preCreate(EntityStorageInterface $storage_controller, array &$values) {
parent::preCreate($storage_controller, $values);
$values += [
'user_id' => \Drupal::currentUser()->id(),
];
}
/**
* {@inheritdoc}
*/
public function getName() {
return $this->get('name')->value;
}
/**
* {@inheritdoc}
*/
public function setName($name) {
$this->set('name', $name);
return $this;
}
/**
* {@inheritdoc}
*/
public function getCreatedTime() {
return $this->get('created')->value;
}
/**
* {@inheritdoc}
*/
public function setCreatedTime($timestamp) {
$this->set('created', $timestamp);
return $this;
}
/**
* {@inheritdoc}
*/
public function getOwner() {
return $this->get('user_id')->entity;
}
/**
* {@inheritdoc}
*/
public function getOwnerId() {
return $this->get('user_id')->target_id;
}
/**
* {@inheritdoc}
*/
public function setOwnerId($uid) {
$this->set('user_id', $uid);
return $this;
}
/**
* {@inheritdoc}
*/
public function setOwner(UserInterface $account) {
$this->set('user_id', $account->id());
return $this;
}
/**
* {@inheritdoc}
*/
public function isPublished() {
return (bool) $this->getEntityKey('status');
}
/**
* {@inheritdoc}
*/
public function setPublished($published) {
$this->set('status', $published ? TRUE : FALSE);
return $this;
}
/**
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields = parent::baseFieldDefinitions($entity_type);
$fields['user_id'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Authored by'))
->setDescription(t('The user ID of author of the Chutier entity.'))
->setRevisionable(TRUE)
->setSetting('target_type', 'user')
->setSetting('handler', 'default')
->setTranslatable(TRUE)
->setDisplayOptions('view', [
'label' => 'hidden',
'type' => 'author',
'weight' => 0,
])
->setDisplayOptions('form', [
'type' => 'entity_reference_autocomplete',
'weight' => 5,
'settings' => [
'match_operator' => 'CONTAINS',
'size' => '60',
'autocomplete_type' => 'tags',
'placeholder' => '',
],
])
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$fields['name'] = BaseFieldDefinition::create('string')
->setLabel(t('Name'))
->setDescription(t('The name of the Chutier entity.'))
->setSettings([
'max_length' => 50,
'text_processing' => 0,
])
->setDefaultValue('')
->setDisplayOptions('view', [
'label' => 'above',
'type' => 'string',
'weight' => -4,
])
->setDisplayOptions('form', [
'type' => 'string_textfield',
'weight' => -4,
])
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE)
->setRequired(TRUE);
$fields['status'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Publishing status'))
->setDescription(t('A boolean indicating whether the Chutier is published.'))
->setDefaultValue(TRUE)
->setDisplayOptions('form', [
'type' => 'boolean_checkbox',
'weight' => -3,
]);
$fields['created'] = BaseFieldDefinition::create('created')
->setLabel(t('Created'))
->setDescription(t('The time that the entity was created.'));
$fields['changed'] = BaseFieldDefinition::create('changed')
->setLabel(t('Changed'))
->setDescription(t('The time that the entity was last edited.'));
$fields['documents'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Documents'))
->setDescription(t('Documents from collection.'))
->setSetting('target_type', 'node')
->setSetting('handler', 'default')
// TODO: check node content type by settings @see readme
->setSetting('handler_settings',['target_bundles'=>['enregistrement'=>'enregistrement']] )
->setCardinality(BaseFieldDefinition::CARDINALITY_UNLIMITED)
->setDisplayOptions('view', array(
'label' => 'hidden',
'type' => 'enregistrement',
'weight' => 0,
))
->setDisplayOptions('form', array(
'type' => 'entity_reference_autocomplete',
'weight' => 5,
'settings' => array(
'match_operator' => 'CONTAINS',
'size' => '60',
'autocomplete_type' => 'tags',
'placeholder' => '',
),
))
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
return $fields;
}
/**
* {@inheritdoc}
*/
public static function getUserChutiersContents($uid){
// TODO: use query if we use more than one chutier
// $query = \Drupal::entityQuery('chutier')
// ->condition('user_id', $uid);
//
// $chutiers_nids = $query->execute();
// $chutiers = entity_load_multiple('chutier', $chutiers_nids);
//
// $contents = array();
// foreach ($chutiers as $id => $chutier) {
// $contents[$id] = array_column($chutier->documents->getValue(), 'target_id');
// }
/** @var UserDataInterface $userData */
$userData = \Drupal::service('user.data');
$default_chutier_id = $userData->get('edlp_studio', $uid, 'default_chutier');
if($chutier = entity_load('chutier', $default_chutier_id)){
return array_column($chutier->documents->getValue(), 'target_id');
}else{
return array();
}
}
/**
* {@inheritdoc}
*/
public static function getActionsUrl($id, $uid){
$contents = self::getUserChutiersContents($uid);
// dpm($contents);
if(array_search($id, $contents) === false){
$action = 'add';
}else{
$action = 'remove';
}
$args = array(
'action'=>$action,
'id'=>$id
);
$url = Url::fromRoute('edlp_studio.chutier_controller_ajax_add_content', $args, array(
'attributes' => array(
'class' => ['chutier-icon','chutier-link','chutier-ajax-link'],
'action' => $action,
'target_id' => $id,
)
));
return $url;
}
}
@@ -0,0 +1,105 @@
<?php
namespace Drupal\edlp_studio\Entity;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\EntityChangedInterface;
use Drupal\user\EntityOwnerInterface;
/**
* Provides an interface for defining Chutier entities.
*
* @ingroup edlp_studio
*/
interface ChutierInterface extends ContentEntityInterface, EntityChangedInterface, EntityOwnerInterface {
// Add get/set methods for your configuration properties here.
/**
* Gets the Chutier name.
*
* @return string
* Name of the Chutier.
*/
public function getName();
/**
* Sets the Chutier name.
*
* @param string $name
* The Chutier name.
*
* @return \Drupal\edlp_studio\Entity\ChutierInterface
* The called Chutier entity.
*/
public function setName($name);
/**
* Gets the Chutier creation timestamp.
*
* @return int
* Creation timestamp of the Chutier.
*/
public function getCreatedTime();
/**
* Sets the Chutier creation timestamp.
*
* @param int $timestamp
* The Chutier creation timestamp.
*
* @return \Drupal\edlp_studio\Entity\ChutierInterface
* The called Chutier entity.
*/
public function setCreatedTime($timestamp);
/**
* Returns the Chutier published status indicator.
*
* Unpublished Chutier are only visible to restricted users.
*
* @return bool
* TRUE if the Chutier is published.
*/
public function isPublished();
/**
* Sets the published status of a Chutier.
*
* @param bool $published
* TRUE to set this Chutier to published, FALSE to set it to unpublished.
*
* @return \Drupal\edlp_studio\Entity\ChutierInterface
* The called Chutier entity.
*/
public function setPublished($published);
/**
* get the contents in user's chutiers
*
* @param int $uid
* user id
*
* @return array
* associative array of contents by chutiers
*
*/
public static function getUserChutiersContents($uid);
/**
* get the contents in user's chutiers
*
* @param int $id
* content id
*
* @param int $uid
* user id
*
* @return Drupal\Core\Url
* depending on action is add or remove
*
*/
public static function getActionsURL($id, $uid);
}
@@ -0,0 +1,24 @@
<?php
namespace Drupal\edlp_studio\Entity;
use Drupal\views\EntityViewsData;
/**
* Provides Views data for Chutier entities.
*/
class ChutierViewsData extends EntityViewsData {
/**
* {@inheritdoc}
*/
public function getViewsData() {
$data = parent::getViewsData();
// Additional information for Views integration, such as table joins, can be
// put here.
return $data;
}
}
@@ -0,0 +1,243 @@
<?php
namespace Drupal\edlp_studio\Entity;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Entity\ContentEntityBase;
use Drupal\Core\Entity\EntityChangedTrait;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\user\UserInterface;
/**
* Defines the Composition entity.
*
* @ingroup edlp_studio
*
* @ContentEntityType(
* id = "composition",
* label = @Translation("Composition"),
* handlers = {
* "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
* "list_builder" = "Drupal\edlp_studio\CompositionListBuilder",
* "views_data" = "Drupal\edlp_studio\Entity\CompositionViewsData",
*
* "form" = {
* "default" = "Drupal\edlp_studio\Form\CompositionForm",
* "add" = "Drupal\edlp_studio\Form\CompositionForm",
* "edit" = "Drupal\edlp_studio\Form\CompositionForm",
* "delete" = "Drupal\edlp_studio\Form\CompositionDeleteForm",
* },
* "access" = "Drupal\edlp_studio\CompositionAccessControlHandler",
* "route_provider" = {
* "html" = "Drupal\edlp_studio\CompositionHtmlRouteProvider",
* },
* },
* base_table = "composition",
* admin_permission = "administer composition entities",
* entity_keys = {
* "id" = "id",
* "label" = "name",
* "uuid" = "uuid",
* "uid" = "user_id",
* "langcode" = "langcode",
* "status" = "status",
* },
* links = {
* "canonical" = "/composition/{composition}",
* "add-form" = "/composition/add",
* "edit-form" = "/composition/{composition}/edit",
* "delete-form" = "/composition/{composition}/delete",
* "collection" = "/admin/structure/studio/composition",
* },
* field_ui_base_route = "composition.settings"
* )
*/
class Composition extends ContentEntityBase implements CompositionInterface {
use EntityChangedTrait;
/**
* {@inheritdoc}
*/
public static function preCreate(EntityStorageInterface $storage_controller, array &$values) {
parent::preCreate($storage_controller, $values);
$values += [
'user_id' => \Drupal::currentUser()->id(),
];
}
/**
* {@inheritdoc}
*/
public function getName() {
return $this->get('name')->value;
}
/**
* {@inheritdoc}
*/
public function setName($name) {
$this->set('name', $name);
return $this;
}
/**
* {@inheritdoc}
*/
public function getCreatedTime() {
return $this->get('created')->value;
}
/**
* {@inheritdoc}
*/
public function setCreatedTime($timestamp) {
$this->set('created', $timestamp);
return $this;
}
/**
* {@inheritdoc}
*/
public function getOwner() {
return $this->get('user_id')->entity;
}
/**
* {@inheritdoc}
*/
public function getOwnerId() {
return $this->get('user_id')->target_id;
}
/**
* {@inheritdoc}
*/
public function setOwnerId($uid) {
$this->set('user_id', $uid);
return $this;
}
/**
* {@inheritdoc}
*/
public function setOwner(UserInterface $account) {
$this->set('user_id', $account->id());
return $this;
}
/**
* {@inheritdoc}
*/
public function isPublished() {
return (bool) $this->getEntityKey('status');
}
/**
* {@inheritdoc}
*/
public function setPublished($published) {
$this->set('status', $published ? TRUE : FALSE);
return $this;
}
/**
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields = parent::baseFieldDefinitions($entity_type);
$fields['user_id'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Authored by'))
->setDescription(t('The user ID of author of the Composition entity.'))
->setRevisionable(TRUE)
->setSetting('target_type', 'user')
->setSetting('handler', 'default')
->setTranslatable(TRUE)
->setDisplayOptions('view', [
'label' => 'hidden',
'type' => 'author',
'weight' => 0,
])
->setDisplayOptions('form', [
'type' => 'entity_reference_autocomplete',
'weight' => 5,
'settings' => [
'match_operator' => 'CONTAINS',
'size' => '60',
'autocomplete_type' => 'tags',
'placeholder' => '',
],
])
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$fields['name'] = BaseFieldDefinition::create('string')
->setLabel(t('Name'))
->setDescription(t('The name of the Composition entity.'))
->setSettings([
'max_length' => 50,
'text_processing' => 0,
])
->setDefaultValue('')
->setDisplayOptions('view', [
'label' => 'above',
'type' => 'string',
'weight' => -4,
])
->setDisplayOptions('form', [
'type' => 'string_textfield',
'weight' => -4,
])
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE)
->setRequired(TRUE);
$fields['status'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Publishing status'))
->setDescription(t('A boolean indicating whether the Composition is published.'))
->setDefaultValue(TRUE)
->setDisplayOptions('form', [
'type' => 'boolean_checkbox',
'weight' => -3,
]);
$fields['created'] = BaseFieldDefinition::create('created')
->setLabel(t('Created'))
->setDescription(t('The time that the entity was created.'));
$fields['changed'] = BaseFieldDefinition::create('changed')
->setLabel(t('Changed'))
->setDescription(t('The time that the entity was last edited.'));
$fields['documents'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Documents'))
->setDescription(t('Documents from collection.'))
->setSetting('target_type', 'node')
->setSetting('handler', 'default')
->setSetting('handler_settings',['target_bundles'=>['enregistrement'=>'enregistrement']] )
->setCardinality(BaseFieldDefinition::CARDINALITY_UNLIMITED)
->setDisplayOptions('view', array(
'label' => 'hidden',
'type' => 'enregistrement',
'weight' => 0,
))
->setDisplayOptions('form', array(
'type' => 'entity_reference_autocomplete',
'weight' => 5,
'settings' => array(
'match_operator' => 'CONTAINS',
'size' => '60',
'autocomplete_type' => 'tags',
'placeholder' => '',
),
))
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
return $fields;
}
}
@@ -0,0 +1,77 @@
<?php
namespace Drupal\edlp_studio\Entity;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\EntityChangedInterface;
use Drupal\user\EntityOwnerInterface;
/**
* Provides an interface for defining Composition entities.
*
* @ingroup edlp_studio
*/
interface CompositionInterface extends ContentEntityInterface, EntityChangedInterface, EntityOwnerInterface {
// Add get/set methods for your configuration properties here.
/**
* Gets the Composition name.
*
* @return string
* Name of the Composition.
*/
public function getName();
/**
* Sets the Composition name.
*
* @param string $name
* The Composition name.
*
* @return \Drupal\edlp_studio\Entity\CompositionInterface
* The called Composition entity.
*/
public function setName($name);
/**
* Gets the Composition creation timestamp.
*
* @return int
* Creation timestamp of the Composition.
*/
public function getCreatedTime();
/**
* Sets the Composition creation timestamp.
*
* @param int $timestamp
* The Composition creation timestamp.
*
* @return \Drupal\edlp_studio\Entity\CompositionInterface
* The called Composition entity.
*/
public function setCreatedTime($timestamp);
/**
* Returns the Composition published status indicator.
*
* Unpublished Composition are only visible to restricted users.
*
* @return bool
* TRUE if the Composition is published.
*/
public function isPublished();
/**
* Sets the published status of a Composition.
*
* @param bool $published
* TRUE to set this Composition to published, FALSE to set it to unpublished.
*
* @return \Drupal\edlp_studio\Entity\CompositionInterface
* The called Composition entity.
*/
public function setPublished($published);
}
@@ -0,0 +1,24 @@
<?php
namespace Drupal\edlp_studio\Entity;
use Drupal\views\EntityViewsData;
/**
* Provides Views data for Composition entities.
*/
class CompositionViewsData extends EntityViewsData {
/**
* {@inheritdoc}
*/
public function getViewsData() {
$data = parent::getViewsData();
// Additional information for Views integration, such as table joins, can be
// put here.
return $data;
}
}
@@ -0,0 +1,15 @@
<?php
namespace Drupal\edlp_studio\Form;
use Drupal\Core\Entity\ContentEntityDeleteForm;
/**
* Provides a form for deleting Chutier entities.
*
* @ingroup edlp_studio
*/
class ChutierDeleteForm extends ContentEntityDeleteForm {
}
@@ -0,0 +1,50 @@
<?php
namespace Drupal\edlp_studio\Form;
use Drupal\Core\Entity\ContentEntityForm;
use Drupal\Core\Form\FormStateInterface;
/**
* Form controller for Chutier edit forms.
*
* @ingroup edlp_studio
*/
class ChutierForm extends ContentEntityForm {
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
/* @var $entity \Drupal\edlp_studio\Entity\Chutier */
$form = parent::buildForm($form, $form_state);
$entity = $this->entity;
return $form;
}
/**
* {@inheritdoc}
*/
public function save(array $form, FormStateInterface $form_state) {
$entity = $this->entity;
$status = parent::save($form, $form_state);
switch ($status) {
case SAVED_NEW:
drupal_set_message($this->t('Created the %label Chutier.', [
'%label' => $entity->label(),
]));
break;
default:
drupal_set_message($this->t('Saved the %label Chutier.', [
'%label' => $entity->label(),
]));
}
$form_state->setRedirect('entity.chutier.canonical', ['chutier' => $entity->id()]);
}
}
@@ -0,0 +1,53 @@
<?php
namespace Drupal\edlp_studio\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
/**
* Class ChutierSettingsForm.
*
* @ingroup edlp_studio
*/
class ChutierSettingsForm extends FormBase {
/**
* Returns a unique string identifying the form.
*
* @return string
* The unique string identifying the form.
*/
public function getFormId() {
return 'chutier_settings';
}
/**
* Form submission handler.
*
* @param array $form
* An associative array containing the structure of the form.
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
// Empty implementation of the abstract submit class.
}
/**
* Defines the settings form for Chutier entities.
*
* @param array $form
* An associative array containing the structure of the form.
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*
* @return array
* Form definition array.
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$form['chutier_settings']['#markup'] = 'Settings form for Chutier entities. Manage field settings here.';
return $form;
}
}
@@ -0,0 +1,15 @@
<?php
namespace Drupal\edlp_studio\Form;
use Drupal\Core\Entity\ContentEntityDeleteForm;
/**
* Provides a form for deleting Composition entities.
*
* @ingroup edlp_studio
*/
class CompositionDeleteForm extends ContentEntityDeleteForm {
}
@@ -0,0 +1,50 @@
<?php
namespace Drupal\edlp_studio\Form;
use Drupal\Core\Entity\ContentEntityForm;
use Drupal\Core\Form\FormStateInterface;
/**
* Form controller for Composition edit forms.
*
* @ingroup edlp_studio
*/
class CompositionForm extends ContentEntityForm {
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
/* @var $entity \Drupal\edlp_studio\Entity\Composition */
$form = parent::buildForm($form, $form_state);
$entity = $this->entity;
return $form;
}
/**
* {@inheritdoc}
*/
public function save(array $form, FormStateInterface $form_state) {
$entity = $this->entity;
$status = parent::save($form, $form_state);
switch ($status) {
case SAVED_NEW:
drupal_set_message($this->t('Created the %label Composition.', [
'%label' => $entity->label(),
]));
break;
default:
drupal_set_message($this->t('Saved the %label Composition.', [
'%label' => $entity->label(),
]));
}
$form_state->setRedirect('entity.composition.canonical', ['composition' => $entity->id()]);
}
}
@@ -0,0 +1,53 @@
<?php
namespace Drupal\edlp_studio\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
/**
* Class CompositionSettingsForm.
*
* @ingroup edlp_studio
*/
class CompositionSettingsForm extends FormBase {
/**
* Returns a unique string identifying the form.
*
* @return string
* The unique string identifying the form.
*/
public function getFormId() {
return 'composition_settings';
}
/**
* Form submission handler.
*
* @param array $form
* An associative array containing the structure of the form.
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
// Empty implementation of the abstract submit class.
}
/**
* Defines the settings form for Composition entities.
*
* @param array $form
* An associative array containing the structure of the form.
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The current state of the form.
*
* @return array
* Form definition array.
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$form['composition_settings']['#markup'] = 'Settings form for Composition entities. Manage field settings here.';
return $form;
}
}
@@ -0,0 +1,72 @@
<?php
namespace Drupal\edlp_studio\Plugin\Block;
use Drupal\Core\Session\AccountProxy;
use Drupal\Core\Session\AccountProxyInterface;
use Drupal\Core\Block\BlockBase;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Url;
/**
* Provides a 'StudioLinkBlock' block.
*
* @Block(
* id = "edlp_studio_link_block",
* admin_label = @Translation("Studio link block"),
* )
*/
class StudioLinkBlock extends BlockBase implements ContainerFactoryPluginInterface{
protected $user;
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
// Instantiates this form class.
return new static(
$configuration,
$plugin_id,
$plugin_definition,
$container->get('current_user')
);
}
/**
* @param array $configuration
* @param string $plugin_id
* @param mixed $plugin_definition
* @param \Drupal\Core\Session\AccountProxyInterface $account
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, AccountProxyInterface $account) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->user = $account;
}
/**
* {@inheritdoc}
*/
public function build() {
$build = [];
if($this->user->id()){
$url = Url::fromRoute('edlp_studio.studio_ui');
$build['edlp_studio_link_block'] = array(
'#title' => "Studio",
'#type' => 'link',
'#url' => $url,
'#options'=>array(
'attributes' => array(
'data-drupal-link-system-path' => $url->getInternalPath(),
'class' => array('ajax-link'),
'alt' => t('The studio displays your bookmarked sounds. You can save them and create your own playlists'),
)
)
);
}
return $build;
}
}