php – Source link plugin – show just anchor/link

I implemented a small source link plugin on my WordPress website via the following codes:

add_action( 'add_meta_boxes', 'wpse_source_link' );

add_action( 'save_post', 'wpse_source_link_save' );

function wpse_source_link() {

        __( 'Link źródłowy', 'myplugin_textdomain' ), 

function wpse_source_meta_box( $post ) {

  wp_nonce_field( plugin_basename( __FILE__ ), 'myplugin_noncename' );

  echo '<label for="source-link">Link</label> ';
  echo '<input type="text" id="source-link"" name="source_link" value="'.
    get_post_meta( $post->ID, '_source_link', true ) .'" size="25" />';

  echo '<label for="source-link-label">Nazwa strony</label> ';
  echo '<input type="text" id="source-link-label"" name="source_link_label" value="'.
    get_post_meta( $post->ID, '_source_link_label', true ) .'" size="25" />';

function wpse_source_link_save( $post_id ) {

  if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) 

  if ( ! wp_verify_nonce( $_POST('myplugin_noncename'), plugin_basename( __FILE__ ) ) )

  if ( current_user_can( 'edit_post', $post_id ) ) {

      update_post_meta( $post_id, '_source_link', sanitize_text_field( $_POST('source_link') ) );
      update_post_meta( $post_id, '_source_link_label', sanitize_text_field( $_POST('source_link_label') ) );

global $post, $pages, $page;

$total = count( $pages );
// Link źródłowy
if ( $total < 2 || $page === $total ) :
    if ( $url = get_post_meta( $post->ID, '_source_link', true ) ) :
        $label = get_post_meta( $post->ID, '_source_link_label', true );
        $label = $label ? $label : $url;
        <div class="source-link">
            <b>Źródło:</b> <a href="<?php echo esc_url( $url ); ?>" rel="nofollow" target="_blank"><?php  
              echo esc_html( $label ); ?></a>
    <?php endif; 

As you can see there are two fields:
Link źródłowy (Source link) and Nazwa strony (website name – anchor). However, at this moment this plugin only works, when both fields have some text inside. Is there any way to make it work also with just anchor/link? I mean, if two fields are completed it should show anchor with link, but if just anchor has some text in it, then it should show only anchor. Same goes for link.

Custom migrate source plugin, extends FieldableEntity class, has migrate status of [error] No migrations found. Why?

I’m writing a migrate source plugin for migrating D7 entityform (entityform module) submissions. If anyone has done this or knows an existing plugin, please let me know.

I am trying to extend the FieldableEntity base class from Drupalmigrate_drupalPluginmigratesourced7FieldableEntity; because I want to use its getFields() and getFieldValues() methods when I override prepareRow() to include custom fields from my D7 entityform.

My problem is that when my source plugin extends FieldableEntity, drush reports (error) No migrations found. for my migration. Importantly, however, if my source plugin instead uses the SqlBase class from DrupalmigratePluginmigratesourceSqlBase, then drush can import all of my entityforms from D7 into D9 contact forms no problem. So it would seem that I am missing something when I try to implement FieldableEntity preventing it from retrieving data for the migration.

Here is my plugin, which shows up fine in drush ms:


namespace Drupalmymodule_migratePluginmigratesource;

use DrupalmigrateRow;
use Drupalmigrate_drupalPluginmigratesourced7FieldableEntity;

 * The 'mymodule_migrate_entityform' source plugin.
 * @MigrateSource(
 *   id = "mymodule_migrate_entityform",
 *   source_module = "mymodule_migrate"
 * )
class Entityform extends FieldableEntity {

   * {@inheritdoc}
  public function query() {
    $query = $this->select('entityform', 'e')
      ->fields('e', (
    return $query;

   * {@inheritdoc}
  public function fields() {
    return array(
      'entityform_id' => $this->t('The ID of the entityform submission.'),
      'type' => $this->t('The entityform type.'),
      'created' => $this->t('The time that the entityform was submitted.'),
      'changed' => $this->t('Last updated time.'),
      'uid' => $this->t('The {users}.uid who submitted the entityform. If set to 0, this entityform was submitted by an anonymous user.'),

   * {@inheritdoc}
  public function getIds() {
    $ids('entityform_id')('type') = 'integer';
    $ids('entityform_id')('alias') = 'e';
    return $ids;

   * {@inheritdoc}
  public function prepareRow(Row $row) {
    $entityform_id = $row->getSourceProperty('entityform_id');
    // Get Field API field values.
    foreach ($this->getFields('entityform', 'BUNDLE_MACHINE_NAME') as $field_name => $field) {
      $row->setSourceProperty($field_name, $this->getFieldValues('entityform', $field_name, $entityform_id));
    return parent::prepareRow($row);


I use this yml migration definition. My migrate destination is D8/D9 contact_message entity.

id: mymodule_contact_message
label: D8 Contact message migration from D7 entityform submission
  plugin: mymodule_migrate_entityform
  id: entityform_id
    plugin: default_value
    source: language
    default_value: "und"
  created: created
  changed: changed
  plugin: entity:contact_message
  default_bundle: MY_DESTINATION_BUNDLE

As stated above, all of this works great when I use SqlBase in my plugin. But with FieldableEntity drush comes back with (error) No migrations found.

documentation – Tools to document code without writing in to the source files

I am searching for tools where I can explain, and write documentation on my code without altering the source files.

I try to write as obvious code as possible so that the code becomes it’s own documentation. But there are always these edge cases where it simply isn’t clear on what the code is doing. Or when we write obvious code, but the context is missing on why a decision was made.

I am searching for a tool, preferably that works with GitHub repositories. Where I can document code, write explanations, etc. Without writing complete stories in to the source files.

I don’t know if this even exists, probably does. So what is a great tool to do so with?



// DoSomething will do something with user, and id
// We decided to parse the AppUser in to the method instead of getting it from the context...
// ... ... this would be faster, bla bla
public void DoSomething(AppUser user, int id) {

Instead of writing a lot of not needed comments in my code. I’d like to somehow document that in the following way: MyClass.DoSomething(AppUser, int):

Here I write my complete text on why this or that for this particular method

what to choose open source or closed source?

It looks like you might have the wrong opinion about this…

It is a general opinion that opensource is usually more secure than closed source because it is exposed to public scrutiny. Bugs are easily found and patched by several developers.

Bugs in Closed source Software are simply hidden. Reverse Engineer some closed source software and you would find lots and lots of juicy 0 Day Vulnerabilities.


database – How to read source code for big projects?

I was trying to read source code for redis db and I could understand the code but there were too many files, and thousands of lines of code which got me confused. I tried reading flockdb which is considerably smaller but it’s written in scala which I don’t know if it’s worth learning. So how should I try going about this? How am I supposed to traverse through the thousands of lines and the file system? Also I don’t need to only understand big projects or even databases for that matter, if there’s any other suggestions of smaller projects that I would be better off starting with I’d appreciate it. The type of open source projects I am trying to study are ones like VPNs, antivirus software and the kind.

uicomponent – how to provide data source for sales order grid using ui component in magento2 frontend

The grid basically should contain sales order basic details such as order number, order status along with it should contain number of invoiced items, number of shipped items, number of invoices along with invoice numbers.

I know how to create ui component, but getting data from other tables such as sales_order_item,invoice table seems difficult.
can anyone help me on this.
Let’s say 1 order contain sku1 10 ,sku2 20,sku3 30 .
Shipped items ( sku1 3 + sku2 4 +sku3 6) = 13
Invoiced items ( sku1 6 + sku2 10 + sku3 10) = 26
cancelled items ( sku1 1 + sku2 6 + sku3 14 ) = 21

Also concern about performance, because for each order we need calculate and need to provide data to the grid.
Offcourse we will add current customer as one filter.
Also we need to list number of invoices for that order,let’s say it contains 4 partial invoices ( 000234,000235,000236,000237)

do we need to create separate read model for using cqrs , message queues?
or any custom indexer is enough?

unity – Can not play a disabled audio source?

I have 5 cube that all 5 cube have audiosource. When my player jump into those cubes, the audiosource is playing(just once). It was working. But then, I decided to organised my hierarchy and audiosource didn’t work well.
When I jump to first cube, the audio is playing but then ıf I try to jump to the other cubes, audio is not working. (Actually the cube is prefab and all 5 cubes are the created from that prefab). It gives “Can not play a disabled audio source” and I don’t know why ? Because I haven’t changed about coding part.

This is my first cube component :

The other 4 cubes (actually they all the same as with the first cube ) : enter image description here

Coding Part :

//Eğer karakter ses efekti tamamlanmadan diğer paddle'a atlarsa paddle ses çıkarmıyor. Bunu düzelt

(SerializeField) AudioSource clickSound;

 bool landedorNot = false;

 void Start()

private void OnCollisionEnter(Collision collision)

    if ( == "Ship New Pos" && landedorNot == false )
        landedorNot = true;
        if (!clickSound.isPlaying)

            clickSound.Play(); // this is where the error occurs according to Unity