0

I developed one custom module which will display a list of entries from my custom table. Now i need to add two buttons on top of the grid as "Clear out Unpublished" , "Clear All"

  1. Clear out unpublished - will remove all the status 0 entries from my custom table.
  2. Clear All - will remove all the entries from my custom table.

I tried below code to get the queue item id which is stored in database table. but i am unable to get it. I am getting the data object which is stored in database table but not queue id. I want this queue id to reference with my custom table. Any body can help me on this?

public function processItem($item) {
     try{

     $query_queue = \Drupal::database()->select('mytable')
                  ->condition('queue_id' , $item->id)
                  ->execute();
     if($query_queue->status=='failed' || $query_queue->status=='')
         {

         \Drupal::logger('myqueue')->notice("Created an quote service successfully. ID ".$this->queueService->getQuoteId());
          \Drupal::database()->update('mytable')
                ->condition('queue_id' , $item->id)
                ->fields([
                'status' => 'success',
                    ])
                ->execute();
         }

     } catch (Exception $e) {

     \Drupal::logger('myqueue')->notice("Failed to create Queue");

     }

Here $item returning entire data i am storing in queue object. I need database table id of that particular process item.

closed as too broad by leymannx, Kevin, kiamlaluno Oct 6 at 12:26

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    But you have the buttons already? – leymannx Oct 5 at 16:06
  • Welcome to Drupal Answers! Since this is a question about code, we need to see the code you wrote. As it is, the question is a bit too broad. We cannot describe here how to add a submission handler in a form implemented from a module. We would copy-paste what the Drupal.org documentation already says, as you didn't make clear what exactly you don't understand. I don't know how to implement different actions is a broad statement. – kiamlaluno Oct 6 at 12:25
  • i modified question with code that i tried. plz allow my question as it is urgent for me. – user3463733 Oct 10 at 2:50

Browse other questions tagged or ask your own question.