This topic contains 2 replies, has 1 voice, and was last updated by zhex900 6 years, 10 months ago.
- Topic
Hi,
How do I add an extension to CalendarEventApiType. I have successfully implemented a CalendarEventTypeExtension. I want to copy the same implementation into CalendarEventApiTypeExtension. However I cannot get it to work. No function in CalendarEventApiTypeExtension is fired.
Is there anything different to the way CalendarEventApiTypeExtension should be implemented?
12345678910111213141516#form.ymlcampus_calendar.calendar_event.form.extension.type:class: 'CampusCRM\CampusCalendarBundle\Form\Extension\CalendarEventTypeExtension'public: truearguments:- "@service_container"tags:- { name: form.type_extension, alias: oro_calendar_event }campus_calendar.calendar_event.api.form.extension.type:class: 'CampusCRM\CampusCalendarBundle\Form\Extension\CalendarEventApiTypeExtension'public: truearguments:- "@service_container"tags:- { name: form.type_extension, alias: oro_calendar_event_api }123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081//Form/Extension/CalendarEventApiTypeExtension.phpclass CalendarEventApiTypeExtension extends AbstractTypeExtension{/** @var ContainerInterface */private $container;/*** @param ContainerInterface $container*/public function __construct(ContainerInterface $container){$this->container = $container;}/*** Returns the name of the type being extended.** @return string The name of the type being extended*/public function getExtendedType(){return 'oro_calendar_event_api';}/*** {@inheritdoc}*/public function configureOptions(OptionsResolver $resolver){$resolver->setDefaults(['allow_extra_fields' => true,'allow_change_calendar' => false,'layout_template' => false,'data_class' => 'Oro\Bundle\CalendarBundle\Entity\CalendarEvent','intention' => 'calendar_event','csrf_protection' => false,]);}/*** {@inheritdoc}*/public function buildForm(FormBuilderInterface $builder, array $options){$builder->remove('title');$builder->remove('attendees');$builder->add('title','text',array('required' => false,'data' => 'Default Title','label' => 'oro.calendar.calendarevent.title.label'))->add($builder->create('attendees','oro_collection',['property_path' => 'attendees','type' => 'campus_calendar_event_attendees_api','error_bubbling' => false,'options' => ['required' => false,'label' => 'oro.calendar.calendarevent.attendees.label',],])->addEventSubscriber(new AttendeesSubscriber()));file_put_contents('/tmp/new.log','CalendarEventApiTypeExtension: '. PHP_EOL,FILE_APPEND);$builder->addEventSubscriber(new CalendarEventApiTypeSubscriber($this->container));}}
The forum ‘OroCRM – Programming Questions’ is closed to new topics and replies.