texts:
I am a newbie. I have experience working with Twig but in Drupal it is used in another way.

I have seen a lot of code like that

<section{{ attributes.addClass(classes) }}>

And of course I read this article https://www.drupal.org/docs/8/theming-drupal-8/using-attributes-in-templates

There are a lot of examples and that is great.

But why do I need this, how could I use them to improve readability and flexebility ?

You should agree that attributes.addClass(classes) method is doing something like adding class to the existing attributes, but not returning the output of all attributes.

Could you tell me please why this attributes variable is useful, how can I use it to provide better decoupling or whatever it is used for. Why not just to keep classes directly in a template file, is it possible to add them from admin panel ?
Thanks


texts: How to allow access to create terms in a specific vocabulary?

texts:
If you remove "Administer vocabularies and terms" from a role in Drupal 8.4, but you want to give access to a role for a specific Vocabulary, there is no out-of-the-box way to do this for "create" access for terms in specific vocabularies.

For example, for a Vocabulary called "Author".

You are given the option to "Delete terms from Author" and "Edit terms in Author", but no option to "Create terms in Author".

How would you add this option a role in Drupal 8 after you have removed the "Administer vocabularies and terms" permission?


texts: Services, android application and Leaflet map

texts:
I have a tricky question. I have a content type with a map where the user can provide a location by putting a marker on a leaflet map.
I am building an android app through witch the user will also be able to add new content, but I am stuck. I cannot find the right format of the location on the map to be sent. I use Services and build a json file. I have tried WKT and Geojson for latitude and longitude to be sent but without any luck. Does anyone know which format has to be used when the input for the site is a leaflet map??


texts: How to add html head link tag when a specific block is loaded

texts:
I have a custom block with its own twig template file.

I want to add an html head link tag when this block is loaded.
ex: <link rel="import" href="test.html">

In the twig template I can use attach_library to add css/js to , but I don't know how to add html imports in twig.

Is it possible to achieve this using mytheme_preprocess_block function, or any other hook?

I can add the html head link tag in mytheme_page_attachments_alter but I don't know how to limit this to only when my custom block is loaded.

Thank you.


texts: select list - content outputs key instead of label

texts:
Drupal 7 v. 7.34 - content type. In my content type I use at least 3 fields with select lists. In each case the key is output instead of the label. I would expect the label to be displayed to the user.
E.g. the field 'theme' has the following available options:

wedding|wedding first dance
dancepromo|let's dance

The content shows 'wedding' instead of 'wedding first dance' and 'dancepromo' instead of 'let's dance'.

What am I doing wrong ?
Should I change the key|label order to label|key ?


texts: How to show another user the goals I completed?

texts:
I have a view that shows the goals (created using the Goals module) I've completed. For this I use the view that comes with the Goals module (and which only shows the Goals completed by the current user).

But I'd like that other users could see that view too whenever other users browse my account. So that another user can see which goals I completed (instead of showing the goals completed by that other user).

So I'm looking for help about:

placing the view.
making it visible to other users whenever they browse my profile.


texts: Simplenews + Mime Mail + SMTP = occasional blank email

texts:
I have a client site that uses the Simplenews module with the Mime Mail and SMTP Authentication modules. The subscriber list has a little over 300 email addresses, and when newsletters go out the cron sends out batches of 100 messages per hour. Things usually go off without a hitch, but with the last newsletter one of the batches sent contained blank messages. I have been unable to reproduce the problem. Someone else reported the same problem here:

https://www.drupal.org/node/2378147

. . . but has of yet there has been no response, and I'm not convinced the problem lies with the Simplenews module itself. Has anyone else seen anything like this problem?


texts:
I want to make a new content type called Event, I have other fields in Event, but the field I am having trouble is Keynote Speakers.

Speakers are different content types and have their own fields like Name, Address.

In Event content type I have a field entity reference for this speakers content type, where Multiple Speakers could be added. I want to have a Checkbox near every speaker which would say Key Speaker as Title and could be checked to make the speakers as Key Speaker.

I tried this with Field Collection Module, where I made a collection type of Speakers and inserted the Entity Reference for Speaker as a field value. I created a new Boolean field with checkbox, but that went on to be

My quest is to make that Keynote Speaker as a separate title and have a checkboxes near every Speaker, if checked they'll be added as Keynote Speaker. Like:

How do I achieve this ?


texts: 8 How do I display "Showing content between date1 and date2" on the current pager item?

texts:
I am creating a list of content with a mini pager. I can't seem to find an option to print the date range of all the nodes being displayed in the current pager item. The content type has a date field. I would like to say "Showing content between date1 and date2" on each pager item based on the date field in the content type.

Clarification:
Except the date1 and date2 are the same field. This approach would not print the date range automatically based on a single date field... Let's say I have 100 node items with a NewsDate field. On each page, filter should show the the most recent to the latest date on top of each page. "Showing pages between "date range".


texts: How to display a message according to the country of the store?

texts:
On Drupal 8, I installed Drupal Commerce 2
I want to modify the TWIG file of the products to show "Made in France", if the store country is France and made in Belgium, if the store country is Belgium.
How to display a message according to the country of the store ?
I would like to do this in the products TWIG file and in the stores TWIG file.
There is certainly a condition to be met but I do not know which one.
commerce-store--online--full.html.twig :
  {% if  (how to make the condition to check the store country) FR %}

        ENTREPRISE FRANÇAISE

  {% elseif (how to make the condition to check the store country) BE %}

        ENTREPRISE BELGE

  {% endif %}


texts: Example of entity-within-entity subform processing

texts:
Suppose that, in Drupal 7, EntityA includes one or more instances of EntityB.

Is there an example of building the create/edit form for EntityA that includes one or more edit forms for EntityB, and that can ajax in a new create form for a new EntityB?


texts: Redirect after comment submit according to value of query string in comment form URL?

texts:
For redirecting user to some page after comment submit my below code is working fine :

function my_module_form_alter(&$form, $form_state, $form_id) {
   if ($form_id == "comment_node_link_form") {
      $form['#submit'][] = 'my_module_submit';
  }
}

function my_module_submit($form, &$form_state) {
    $form_state['redirect'] = 'newsroom/en';
}

For Comment links I am sending some query string in comment form URL and want to redirect to user to page after comment according to query string value, How can we fetch the query string value to pass it to redirect on hook_submit

http://www.example.com/comment/reply/208943?destination=newsroom#comment-form

http://www.example.com/comment/reply/208943?destination=sections#comment-form

How can we fetch value of destination  and pass it to redirect in hook_submit

Please suggest ! Thanks!

UPDATE :  I have tried adding hidden field but not able to access it in hook_submit it shows null :

function my_module_form_alter(&$form, $form_state, $form_id) {
       if ($form_id == "comment_node_link_form") {

           $form['redirect_to'] = array(
             '#type' => 'hidden',
             '#value' => $_GET['destination'],
           );

          $form['#submit'][] = 'my_module_submit';
      }
    }


texts:
I'm trying to create a content type that allows me to post multiple images from an external database in this sort of style: http://www.newageman.co.uk/14-time-travelling-celebrities

In an ideal world this is what I would like my group of fields to look like in the article creation screen.

Any idea how I would achieve this using best practices? To post articles like this I'm currently using a piece of php code but it's confusing for my contributors, so would like to use fields. I've never made a module or custom field before.

Essentially I am trying to recreate what this PHP does:
The input

<?php $folder = ''; ?>
<?php $location = ''; ?>
<?php
$title01 = '';
$content01 = ''; ?>

The output

1. <?php echo "$title01"; ?>

<img src="/sites/default/files/foldered_images/<?php echo "$folder"; ?>/<?php echo "$location"; ?>_01.jpg" />

<?php echo "$content01"; ?>


texts:
I'm trying to set up a new D8 site. It needs to include some "subscriber only" type functionality. There is one content type which is little more than a title, a file, and one extra field for sorting purposes. There is also a View to make this visible to the end user. What I'm trying to do is let the unauthenticated site visitors see the list, but not download anything while the authenticated users in a specific Role are allowed to download those files. The site's owner will be taking care of adding people to it manually. It isn't too frequent of an event, apparently.
I see how to make the View itself only available to people in that Role. I see how to make content as a whole unavailable to the unauthenticated (Anonymous Users) in /admin/people/permissions. Am I going to have to disable Anonymous Users' access to all content and then enable it one content type at a time?  Or is there a better way to achieve the goal?
I'm open to scraping the approach I've taken (Content Type, File field, and a View) and doing something else entirely if it would be better.
Note: We're currently using private files as the default storage location.


texts: How to get a content type name out of view programmatically

texts:
How to get a content type name out of view/views programmatically?

I have a view views_of_articles of (content type article), what I need is which hook I should to use to return the content type for each view.

In my case I want to return (article) from views_of_articles.


texts: Block visibily condition programatically

texts:
I want to display a block I implemented in a module when $_SESSION['Group_id'] is set.

How can I achieve this?


texts: Alternate way to get form without using drupal_get_form

texts: I want to get a custom addto_cart_form in one of (commerce_addto_cart_confirmation) the popup. I used drupal_get_form to get that but unfortunately I cant able get the form on popup. I asked those question here but not get any response also. So now I want is there any alternate solution to get form. refer my old question1 and question2here. Thanks for any suggestion.


texts: $form_state['redirect'] disables saving node

texts:
I'm having a node form in tabs using field_groups. I can access a tab directly by going to the url node/{nodeid}/edit#some_id_in_that_tab.

I want to make a button that submits the form and goes to the next tab. So I added a submit button to the form:

 $form['actions']['nexttab'] = Array (
                   "#type" => "submit",
                   "#value" => "nexttab",
                   "#weight" => 10,
                   "#submit" => Array ("dzh_2012_form_nexttab")
                    );

In the function dzh_2012_form_nexttab I've put:

$form_state['redirect'] = the_url_described_above

When I click this nexttab button I get redirected to the right tab but the form isn't saving.

If I add:

$form_state['rebuild'] = TRUE;

The form is saved but the redirect isn't working anymore.

Any idea to have both: save the form and redirect it?

Thanks in advance for your answer/effort.

--
Willem


texts: How to check if current page is a group entity?

texts:
Im using drupal 7 and group module

I am trying to run some code only if the current page is a group.

here is my code

<?php
$arg = arg(0);
$arg1 = arg(1);
global $user;
if($arg ='group' && is_numeric($arg1)) {
    $group = group_load($arg1);
    if($group->getMember($user->uid)) {
       print ('user is member');
    };
};
?>

If this is placed on a group page it will print user is member if the current user is a member. If the current user isn't a member it will not show anything. Which is what it is supposed to do.

If I navigate to a none group page I get an error 'Error: Call to a member function getMember()',  but the if statement should prevent this?

How do I check if the current page is a group entity?

Thanks

Edit

I wanted to return true if a group page and user is a member of the group.
Using menu_get_object by Jaypan I used the code below to show. Im checking if page is group if so loading the group then checking if the user is a member of the group.

if (!empty(menu_get_object('group')))
   {
   $group = group_load(arg(1));
   if($group->getMember($user->uid)) {
       return TRUE;
    }
}


texts:
We're upgrading our site from D7 to D8, which has vocabulary containing multi-level parent-child hierarchy. The list is too long (around 5K-10K terms) to import manually.

We've tried using migrate in D8 Core and extending it using migrate_plus and migrate_tools module. These works really well when there is no term hierarchy.

How can we get it working for importing term with hierarchy. The value it accepts for parent is term id. If we pass the parent name (as we're importing it for first-time), it creates the term at root level. Are we missing anything? If we can not do this only with these modules,  how can we extend these modules. References would also greatly appreciated.


texts: term references field not loading terms in node edit form

texts:
In latest D7, I have a field which holds term references. In a cck content item, I can see the label of the field, but not the term options - they're just not loading (neither in checkbox, select or autocomplete widget).
Whereas in other parts of the site (eg dependency settings), the widget loads well with the available options.
I've disabled the form column module, changed to a different theme, as I thought might have something to do with this, nothing. no luck. I'm lost.


texts: Generate Taxonomy Terms from Node Content Automatically

texts: In Wordpress there was a plugin that could auto-create tags based on node content . I don't know how it did this but perhaps it looked up the most common words in the body content and used them as the tags. I have some posts that have lost their tags and it would be great to be able to auto generate some new ones from posts with a script rather than having to go back through and manually do them.


texts: Send email when a user has finished watching something

texts:
A user watched a video (added listening event to id of video via jwplayer), and a person is notified of said user finishing the video.

jwplayer('some-id-of-video').onComplete( function() {
  //$.ajax or .post whatever to send email to a person to let them know without refreshing page
});

I want to just add this script to this page (this functionality is only needed for this ONE VIDEO). How do I link the PHP code to send the email? Not a form everything will be a standard response.

This  does not work.

$message = array(
  'to' => 'email address',
  'subject' => 'subject text',
  'body' => 'body text',
  'headers' => 'header text'
);

drupal_mail_send($message);

Where do I put this? Is this wrong? And if it is wrong, what do I need to fix it? How can I call this code from AJAX?


texts: How to use map base field definition in a custom content entity form

texts:
I have a custom content entity and i'd like to use a map BaseFieldDefinition type to hold an arbitrary number of options.

This is in my custom content entity baseFieldsDefinitions():

$fields['options'] = BaseFieldDefinition::create('integer')
      ->setLabel(t('Task options'))
      ->setDescription(t('The task options.'))
      ->setSettings(array(
           'type' => 'map',
            'default_value' => null
       ));

How do I display this as part of the entity form?

My instinct is that I'd need to create a custom widget, custom formatter and add the following to the base field definition:

->setDisplayOptions('form', array(
         'type' => 'custom_widget',
          'weight' => -6,
  ))

Any direction would be much appreciated.


texts: Form loaded with ajax call not having autocomplete enabled

texts:
I have a form (loaded by obiumap function) that have a section loaded ( by function obiumap_addobj() ) with a $.ajax call from jQuery script (addobj.js) by clicking a button (addobj_btn). This new section is loaded in an

existing div (addobj-container) but without autocomplete functionality and also without default_value.

This is main form:

function obiumap($form, &$form_state) {
drupal_add_js(drupal_get_path('module', $this->modName) . '/addobj.js');
global $user;

$form=array();
$form['uid'] = array(
'#type' => 'hidden',
'#title' => 'uid',
'#default_value' => '3',
'#id' => 'uid',
);
$form=array();
$form['name'] = array(
'#type' => 'textfield',
'#title' => 'name',
'#id' => 'name',
);
$form['addobj_btn'] = array(
     '#type' => 'button',
     '#value' => t('Add new objects'),
     '#id' => 'addobj_btn'
);
$form['addobj-container'] = array(
        '#markup' =>  '

'
);
die(drupal_render_children($form));
}

This is section definition loaded via ajax:

function obiumap_addobj($form, &$form_state){
global $user;
$form=array();
$form['uid'] = array(
'#type' => 'textfield',
'#title' => 'uid',
'#default_value' => '10',
'#id' => 'uid',
);
$form['fldset_addobj'] = array(
'#type' => 'fieldset',
'#title' => t('Add new object'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['fldset_addobj']['objname'] = array(
'#type' => 'textfield',
'#id' => 'objname',
'#title' => t('Object name'),
'#autocomplete_path' => 'obimap/obiumap_addobj',
'#required' => TRUE,
);
 $form['fldset_addobj']['submit'] = array(
'#type' => 'submit',
'#value' => 'Add object',
'#id' => 'addobj_btn'
);
die(drupal_render_children($form));
}

and this is addobj.js

function addItems(arg1, arg2) {
jQuery(document).ready(function() {
jQuery('#addobj_btn').click(function() {
var formURL = 'obiumap_addobj';
jQuery("#obiumap").submit(function(){
 return false;
 });
    jQuery.ajax(
    {
        url : formURL,
        type: "GET",
        data : { uid: jQuery('input[name=uid]').val() },
        success:function(data, textStatus, jqXHR)
        {
            jQuery('#addobj-container').html(data);
            console.log("###### Drupal.attach #####");
            Drupal.attachBehaviors("#addobj-container");
        },
        error: function(jqXHR, textStatus, errorThrown)
        {
        }
    });

});

});
}

I really need autocomplete for that field but I don't now how to activate it.


texts:
I'm creating a support site for a hosting company in D7 and one of the features that they have asked for is for drupal to ping each of the servers, (I have a content type called Server which has ipaddresses attached to it) and report back the status.  I want to set it up as cron job.  Is there a module for Drupal that I can add that gives me this feature?  if not can you give me any pointers how to get started on building one?

Thanks

Kieran Briggs


texts: Change theme_image_widget in other theme

texts:
I have a site, where I want to alter the form of the image widget.

I have a admin theme and overlay activated. The Admin theme is set to the default 'seven' theme from the core (V7.14)

Now I want to write

function seven_image_widget($vars){
    $vars['element']['alt']['#title'] = 'Foo';
    return theme_image_widget($vars);
}

If I add this in the template.php of seven theme, it works, if I put it in my custom theme, it does not work.
Can I access this theme hook of seven theme from my theme in any way?  I don't want to change the core themes code.


texts: I want to uninstall l10n_client which may be duplicated

texts:
I use composer.
The L10n_client module could not be updated or occasionally not found.
I feel that the names of L10n_client or l10n_client_ui are different.
It is a similar atmosphere as below.
https://www.drupal.org/node/2658756
I do not know if it is the same cause.
Since Composer update can not be done, I have memories that I executed composer require as override.

I got a message to install the l10n_client module under some circumstances, so I ran the installation on admin/modules, but an error was returned.
Localization Client Interface The module is unchecked.
Localization Client Contributor module is not installed.
Error message is ‘Unable to install Localization Client Interface, l10n_client_ui.settings already exists in active configuration.’

How can I solve it?

Environment:Drupal 8.4.2


texts: Why can anonymous users access private files using the system URL?

texts:
I have a private organic group with a private organic groups post. I have properly setup my private files system. If an image is uploaded to the private folder an anonymous user can still access it with the following URL:

/system/files/private/assets/image.jpg

However they are given a Forbidden: You don't have permission to access this on this server when access the URL this way:

/sites/default/files/private/assets/image.jpg

My guess is that Drupal is not doing it's job in the first instance; as I haven't set up private file system properly and Apache is doing it's job in the second URL due to the htaccess file in there.

Any pointers?


texts: Drush installation problem - Non-empty values for magic_quotes_gpc

texts:
I have successfully installed and configured Drush and i am able to work with it.

Unfortunately, I am getting an error like this:

  The following restricted PHP modes have non-empty values:
  magic_quotes_gpc. This configuration is incompatible with drush.

I have tried this

magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off

in my php.ini and still I am getting the error. What could be the reason? How can I fix this?


texts:
I'm using Drupal 7 and trying to filter my content based on taxonomy, but it looks like I can only filter based on status and type. Is there a setting or module that would offer more options to filter content by?

Thanks!


texts: Keep something in cache even after flushing the cache from the Drupal back-end (not drush)

texts:
I have a particular use case where we use a cache warmer to keep a custom resource in cache (/api/the-url/xxx). The cache warming is done with a bash script that is added to the crontab and runs at night.

For this particular use case I want /api/the-url/xxx to stay in cache even if admins flush the cache in the Drupal back-end.

For now I wrote 2 queries:

One query that moves all the /api/the-url/xxx from cached_data to cached_data_temp on flush cache.

/**
 * Copies xxx cache from "cache_data" to "cache_data_temp".
 * @param $cid
 */
public function copyCacheDataToTempDataCache($cid) {
    $select = $this->connection->select('cache_data', 'c');
    $select->fields('c');
    $select->condition('cid', $cid . '%', 'LIKE');
    $query = $this->connection->insert('cache_data_temp')->from($select);
    $query->execute();
}

One query to move all the /api/the-url/xxx from the cached_data_temp after the flush cache.

/**
 * Copies xxx cache from "cache_data_temp" to "cache_data".
 */
public function copyTempCacheToCacheData() {
    // Select query to fetch all rows.
    $select = $this->connection->select('cache_data_temp', 'c');
    $select->fields('c');
    // Insert rows into "cache_data".
    $query = $this->connection->insert('cache_data')->from($select);
    $query->execute();
    // Empty table.
    $this->connection->truncate('cache_data_temp')->execute();
 }

I've implemented hook_cache_flush which implements the following:

/**
 * Implements hook_cache_flush.
 */
function MY_MODULE_cache_flush() {
    // Before cache is cleared, get all CID's that start with route:api/the-url/%
    // And store it in "cache_data_temp" table.
    $manager = Drupal::service('xxx.manager');
    $manager->copyCacheDataToTempDataCache('route:api/the-url/');
}

And to rebuild the cache:

/**
 * Implements hook_rebuild.
 */
function MY_MODULE_rebuild() {
    // On info rebuild, put back all data stored in "cache_data_temp" in cache_data.
    $manager = Drupal::service('xxx.manager');
    $manager->copyTempCacheToCacheData();
}

Technically everything works fine. The data is kept in cache_data on flush (after moving it to the temp table) but it seems the cache is invalidated. What am I missing here?


texts: How to display a block only for an article with a specific node id?

texts:
I have quickly seen view reference and context module. Though they can display a view or block to a specific content type, I'm not sure if they can do it within a specific node.

As an example: I want to display a block only for an article with node id 3.

Can that be done?


texts: How to remove duplicate results from views block?

texts:
How to remove duplicate results from views block ?
I have tried aggregation method and query distint but none of them working.

As previously i did the same by using the below code, but how to use the same code in drupal 8 ?

  function bootstrap_views_pre_render(&$view) {
      $used_nids = array();
       $new_view_result = array();

   if ($view->name == 'view_name') {
foreach ($view->result as $row) {
    if (!in_array($row->nid, $used_nids)) {
      $new_view_result[] = $row;
      $used_nids[] = $row->nid;
    }
}

$view->result = $new_view_result;
 }
  }

Is there any other possible solution of my problem ?


texts:
Is it possible to have a slideshow slide content constantly without stopping and no pause? That means it would always slide in fixed speed. I'd be using the scrollLeft effect or something like that.

It doesn't have to be Views Slideshow module, but it has to be Views displayed content which would scroll constantly from right to left.

Or should I just drop that and implement some custom javascript?


texts: What is the "right" way to track a custom patch to a contributed module?

texts:
I need to apply this patch to my site:
http://drupal.org/node/483176#comment-5939648

What is the "right" or "responsible" way to track this change? We use Git for version control.


texts:
I am using Drupal Commerce.
Images are in product entities.
I have imported my products and nodes with feeds, but now I am working on SEO of my website, I have realised that my 'title' and 'alt' tags are empty.
I am looking for a process to update these tags with the image title :

With Feeds I haven't found the way to update these tags ?
I tried (How to bulk update image alt and title?) with VBO but it doesn't work.

This issue sounds common and trivial but I can't find a solution. Am I missing something ? Is there an other way to automatically replace title and alt image tags with image field title ?

Thank you for your help


texts: How to attach an existing file upload field to another existing form?

texts:
I have workflow installed and want to add a file upload field from an existing node to the workflow form (the same node I'm pushing through workflow). Here is how I attached the field to the workflow form:

$tmpform = array();
$tmpform_state = array();
$node = node_load($form['node']['#value']->nid);
field_attach_form('node', $node, $tmpform, $tmpform_state);
$workflow_state = $node->workflow;

// File upload field
$form['field_anr_upload_invoice'] = $tmpform['field_anr_upload_invoice'];
$form_state['field']['field_anr_upload_invoice'] = $tmpform_state['field']['field_anr_upload_invoice'];

I've added text fields, taxonomy fields, etc and I can run them through validation and submit no problem using this same method and this is pretty much all I had to do but I run into a problem (I think) with ajax. The upload field will display but when I "Choose file" and click "Upload" I get an ajax error.

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'workflow_tab_form' not found or invalid function name in drupal_retrieve_form() (line 799 of DIR/www/includes/form.inc).
Notice: Undefined index: node in combine_forms_form_alter() (line 16 of DIR/www/sites/all/modules/custom/combine_forms/combine_forms.module).
Notice: Trying to get property of non-object in combine_forms_form_alter() (line 16 of DIR/www/sites/all/modules/custom/combine_forms/combine_forms.module).
EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7710 of DIR/www/includes/common.inc).

Any thoughts?


texts: Two login forms on a same page (user/login)

texts:
I've used hook_form_FORM_ID_alter() to alter the user/login form.
Now I have to create another form that will have different submit handler because will be connecting with web service.

The hook_form_FORM_ID_alter() is altering the existing default login form and cannot create another form.
We have sellers and customers users.

The reason for creating 2 forms is: On the first form the submit handler is connecting with the web service for the customers method and the submit handler of the second one it should connect with the method web service for the sellers.
Is it possible to do this?


texts: How do I import blogs from Drupal 6 to 7?

texts: How can I import blogs that were created in a Drupal 6 site to a Drupal 7 site? I'm not looking to upgrade the Drupal 6 site because the Drupal 7 site is a complete redesign of the old one and I wanted a clean start. I would like to not have to manually copy all of the blogs to the new site.


texts: Problem with form submit handler using system_settings_form for module admin

texts:
I have a module which creates an admin backend.  I create the form as below.  The submit handler is called, but for some reason there is no form state.

Any idea what's wrong please?

     //in hook menu
    'page arguments' => array('carousel_form'),

    function carousel_form($form, &$form_state) {
       $form = array();

      /* first fieldset */
      $form['fieldset_1'] = array(
      '#type' => 'fieldset',
      '#title' => t('Carousel slide 1'),
      '#description' => t('Configure the first slide of the carousel here'),
      '#required' => TRUE,
      '#collapsible' => TRUE,
      '#collapsed' => FALSE,
       );
       //more fields etc etc

      $form['#submit'][] = 'my_custom_handler';

      return system_settings_form($form);
      }

      //create a handler

      function my_custom_handler($form, &$form_state) {
      $file = file_load($form_state['fieldset_1']['pic_1']);
      //causes error, Undefined index: fieldset_1

      }


texts: Is there a way to use wildcards in block restrictions first?

texts:
I know that for restricting blocks to only certain pages you can do a path such as:
blog/*

I'd like to know if anyone knows a way to do a path such as:
*/blog

Basically, due to views not being able to use contextual links as the first URL argument (www.example.com/%/events is not a valid URL but www.example.com/events/% is) - I would like to be able to have an * first since I plan on having multiple contextual views that would have different first terms, but the same second term.  It would just allow me to write one line of restrictions vs. a line or 5 for each view.

Anyone know if this is possible in a Drupal 7 environment?

Thanks!


texts: How to track the published/unpublished status for node revisions?

texts:
I am ultimately looking for a way to create a report in Views showing what nodes were active on the site at what times but thus far have been unable to accomplish this. I've done a fair bit of research and experimentation but it seems the main obstacle is that node revisions in Drupal don't capture whether the node was published or not at the time of the revision. Can anyone offer some guidance on how to do such a thing in Drupal 7?

As an example for clarification - though not my exact situation - imagine a classifieds site where the managers need to know how many listings (i.e nodes) were currently published (not published on a particular date, but "live" on the site) for the month of January. Or, perhaps to see what listings were active the week of January 1st-7th, who posted them, and what the headlines were.

Any pointers in the right direction? Or is this something reasonably achievable with custom development (I am just a site builder not a developer!).


texts: Filter child field options by a parent field

texts:
There are many scenes, each assigned by an entity reference field to exactly one show. Same for set pieces.

Show
—Scene
—Set piece

I am using entity references rather than taxonomy so that non-technical users can add shows, scenes and set pieces easily.  And when users add content, they select a reference to show it belongs to, and optionally a particular scene and optionally a particular set piece.

When they select the show on the first field, how can I have scene and set piece fields under it only show the scene and set piece options for that show?


texts: "exceeded the maximum file size" error even when uploading small files

texts:
This error in my Drupal 7 site happens when I try to upload an image through image_field field. This is the error:

  An unrecoverable error occurred. The uploaded file likely exceeded
  the maximum file size (64 MB) that this server supports.

Although I am trying to upload a small 5KB photo, this problem exists. I know this is kind of common problem, but can't understand why this happens for as small images as 5KB!

How I can fix this? At first I thought this issue may have been temporary and does appear to have resolved itself this morning but again it happens.


texts: Show 1 random node out of the 5 most recent in views

texts:
I would like to create a block on my homepage where I show my visitors the most recent node (of a specific content-type) I've created. The block should load the 5 most recent nodes but only show one of them on page load.

I've managed to show a random product on page load, but the views takes a random node from all my nodes of that content-type. Is there a way I can limit the nodes, where the random block can chose from, to 5?


texts: Can two nodes have same URL using Pathauto?

texts:
I know that Drupal allows same url for multiple nodes.
But I've a scenario: a registered user creates and submits an article as an unpublished node and assigned an URL by pathauto based on its title.
At the same time another user creates an article with same title in unpublished form. Will it too have same url?

I'll not "publish" those nodes anytime. I'll (as an admin) simply create a new node and copy paste contents.


texts: Qualifying product:commerce_price for a product in a custom template with multiple product reference fields

texts:
My Drupal website is configured with Commerce, Entity Registrations, Commerce Registration, and Commerce Backoffice.

My task is to implement registering and paying for a boatbuilding workshop that a person has the option of attending by him/herself or with a second person attending as an assistant.  The second person can attend at half price.  The workshop is limited to the number of boats being built… not the number of people attending

I first tried solving this by implementing two product variations, one for the primary attendee billed at full price, and the other for the assistant billed at half price, but found that I could not adequately control the slot limit as it based at the product variation level, and not at the product level…. e.g. the slot limit would allow double the intended slot limit, one slot set for each of the two product variations.

I then tried solving it by creating a single product to represent an attending assistant, and then adding that product reference to the content type for the workshop product.  Sort of a sub-product of a product kind-of-thing.

So the product display page has two “Add to Cart” buttons one for the workshop and one for the optional attending assistant

I found that this works and let’s me control the slot limit as desired however there is a problem. The problem is that when coding the custom template for this product and displaying the price of the workshop and the price of the optional second attendee, I don’t know how to distinguish between the two (  field product:commerce_price )

So here’s my question:

Is there a way to qualify/distinguish the product:commerce_price field in a custom template for a product with a product reference field defined from the product variations associated with the product?
In other worlds, how do I qualify the following code snippet  to either reference the price of the product variation or the price of the product reference field in my product node?

        <?php print render($content['product:commerce_price']); ?>

Im thinking that there must be some way to distinguish between the two because when clicking on either of the two “add to cart” buttons… the appropriate price does indeed get added.


texts: Root term in Pathauto only works for child terms?

texts:
My taxonomy structure looks like this:

Film
- Short film
- Special film

Using Pathauto, I would like the url to always include the root term.

So for nodes tagged with 'film' the path is: film/node-title. For nodes tagged with 'short film' the path is also: film/node-title

I thought the 'root term' token would do the trick, setting pathauto pattern to: [node:field-category:root:name]/[node:title]

But it only works for children. If a film is tagged 'film', the token isn't used for some reason. Perhaps I am misunderstanding the meaning of 'root'?


texts:
Is it possible to stop the cron on the main web server and run it on another web server that is using the same codebase, same MySQL server and same Memcache sever?

The cron web server will run import and other heavy operations that Drupal is doing during Cron.

Is anyone doing this? Also some tips for the implementation of the shared codebase(performance wise) would help.


texts:
Is there a way to change the default search settings of the built in search module to default search to phrase match?

Phrase search as in by default terms would be searched with exact match:

"foo bar" over "foo" "bar"

The client doesn't seem to like the way the out of the box search works.


texts: How to get a patch for the Views module reviewed and committed to the project?

texts:
Recently I found an issue with the Drupal Views module. I have submitted a patch to fix it.

Does anyone know what the process is to:

get this issue (and related patch) reviewed?
ultimately get the patch committed to the project?

Due to the amount of open issues (like over 3.700 ...) it appears the maintainers for Views are possibly dealing with more complex issues, or there might be a views project specific process to get a patch committed?

Does anyone know the answer to my questions?

Note: The specific issue I have fixed can be found at https://www.drupal.org/node/2428065, so if anyone could check this any confirm on the issue if this is fixed that would be appreciated.


texts: Hook to run code after a rule has been executed

texts: I have a module which performs a specific task. The task itself runs fine, though it also needs to be exectued when a specific rule is triggered. Is there a hook for rules which I can use in my module to check if a specific rule has been fired?


texts: How to show kint debug info from a module on a page?

texts:
In D8 I would like to display an array in the message part of a page. I did several things but could not get it work. What to do?

I installed the devel and kint modules.

I currently have changed  in services.yml the settings into:

debug: true
auto_reload: true
cache: false

In the twig template I added

{{kint("I'm working from the page.html.twig")}}

This is displayed in the browser, so the current theme is displaying it which proves kint is working and the correct theme is used.

So now In my module file I have

$data_array = json_decode($data,true);
kint($data_array);
var_dump($data_array);
return $data_array;

The var_dump gives a lot of data in a array. However the kint is not displayed.

How to get the kint displayed this array?


texts: How to translate !title field is required

texts:
I want to translate '!title field is required.'.
I can see it in 'admin/config/regional/translate/translate' but if I put a translation, it will override the name/label of each field.

So it is taking '!title field is required.' as one string. But I just want to translate 'field is required' and field names separately.

For example a Name and Email required in a form should display same translation but replacing !title with the name of the field.

How to do that.


texts: What does rc stand for? when to use alpha, beta and dev instead?

texts:
how to name your projects

project_name-7.25-1.0-alpha
project_name-7.25-1.0-beta1
project_name-7.25-1.0-dev2
project_name-7.25-1.0-rc3
project_name-7.25-1.0-stable4
project_name-7.25-1.0-unstable5

following best practices?


texts: upgrading from D6 to D7: Is lower version updated required?

texts:
I have a doubt in upgrading a project from D6 to D7.

If I am upgrading a project from D6 to D7 is it neccessary to upgrade version by version or we can directly upgrade to D7.

For example if I am suppose to upgrade a project from version 6.20 do I need to upgrade it to version 6.22 first or I can upgrade directly to D7 ?


texts: Set path for favicon.ico and apple-touch-icon.png

texts:
I would like my favicon.ico to be accessible by http://example.com/favicon.ico and http://example.com/apple-touch-icon.png, but I can't manage that.
I tried few things, but nothing helped. My favicon.ico/apple-touch-icon.png is located in the theme root folder.

How can I achieve this?


texts: After Upgrading from D7 to D8, D8 does not look like D7 at all

texts:
I have successfully performed a D7 -> D8 migration of my company site. Everything seemed to go well, but when I'm accessing the Drupal 8 site, the entire design is pretty much gone.

How can I get the old design back again for Drupal 8?


texts: Is it possible to create in Drupal a multiple pages on single page

texts:
Please check screenshot , without moving to any new URl when i click on Q&A it shows at right side the result even i can edit and save without going to new URL, everything happens on same page
Is it possible in Drupal to do that


texts: Drupal_get_title() but for another field by name?

texts:
If I use drupal_get_title() I can print the title of the page to the page body. Custom content types that I'm using have many fields like subtitle, url redirects, etc. How would I go about printing those to the page body just like drupal_get_title() allows me to do for the page title?

I've reviewed the forum for other solutions. field_get_items() and $content['field_name'] aren't working for me. I think what I want to do is simple but most of the examples pertain to database manipulation.


texts: Include a CKEditor Plugin in an Install Profile / Distribution

texts:
I am working on an install profile that needs some CKEditor plugins. For example. the template plugin. You can add the module no problem:

composer require drupal/wysiwyg_templates

Getting the JS plugin seems to be a bit harder. There seem to be 3 options:

Using composer:

{
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        {
            "type": "package",
            "package": {
                "name": "ckeditor/templates",
                "type": "drupal-library",
                "version": "4.5.7",
                "dist": {
                    "type": "zip",
                    "url": "http://download.ckeditor.com/templates/releases/templates_4.5.7.zip",
                    "reference": "master"
                }
            }
        }
    ]
}

Using a manual install:

  Download a tarball from the CKEditor site and unpack it into the web/sites/libraries directory.

Ship plugins within the codebase:

Drupal core ships with some libraries in its codebase, are distributions allowed to do that too? (In this case, CKEditor plugins are GPL code.)

The problem with approach 1 is that all projects based on your distribution need to have that in their composer.json file too. If you wanted a couple of plugins, you how have to include an extra 12-or-so lines in every composer.json that uses your project. If you wish to add a new library you break all existing projects.

The problem with approach 2 is that you're adding a manual setup step in addition to composer install. Very undesirable.

The problem with approach 3 is that it might not be allowed, and you might have trouble getting contrib modules to find these libraries based on the install location in vendor. Still, it seems like the only option that might allow you to work around the boilerplate and manual download/update issues.

If there are any examples of a distribution handling this nicely that would be appreciated.


texts: How to remove specific meta-tag from header section of page?

texts:
How to remove specific meta-tag from header section of page ?

I am trying to remove

<link rel="delete-form-edit" href="/node/11/delete" />

tag from header section of the page ,but no luck.

As there is no tag as shown above  found on html.html.twig file header section ,its automatically generating.


texts: How to add JavaScript code to a webform?

texts:
I want to add JavaScript code to a webform. For example, to add things like onclick, onchange, mouseover function to webform's textbox, textarea, select, email, etc.

How do I do so?


texts: Drush set block setting only working for one value

texts:
If I disable the powered by block, and use drush to enable it, the block shows back up again. I use:

root@vagrant-ubuntu-trusty-64:/var/www/drupal# drush config-get
block.block.bootstrap_powered status
'block.block.bootstrap_powered:status': false

root@vagrant-ubuntu-trusty-64:/var/www/drupal# drush config-set
block.block.bootstrap_powered status true
Do you want to update status key in block.block.bootstrap_powered config? (y/n): y
root@vagrant-ubuntu-trusty-64:/var/www/drupal# drush config-get
block.block.bootstrap_powered status
'block.block.bootstrap_powered:status': true

root@vagrant-ubuntu-trusty-64:/var/www/drupal#

However, disabling doesn't work and the block continues to show:

root@vagrant-ubuntu-trusty-64:/var/www/drupal# drush config-set
block.block.bootstrap_powered status false
Do you want to update status key in block.block.bootstrap_powered config? (y/n): y
root@vagrant-ubuntu-trusty-64:/var/www/drupal# drush config-get
block.block.bootstrap_powered status
'block.block.bootstrap_powered:status': true

root@vagrant-ubuntu-trusty-64:/var/www/drupal#

Thoughts on what I'm doing wrong here? Using Drupal 8.


texts:
I have a php code written in index.php that contain a form with method post.

It also read from an external database and fill a table.
To load this form I created a .module file with 2 functions _menu and _block, but I am not able to load the form (index.php)
I need to load the form and to open it in the main content of the drupal page
i used :

header("location
drupal_goto(
$external_link

but nothing is going right and it open in new blank page not in the main content like i want.

please it is urgent
any help


texts: How to access Field-settings in the widget formatter

texts:
I am writing a cck-widget/field and formatter. My field-settings contains a "base_url" setting. If I draw that out:

http://example.com/ [_some/path/to/a/file.avi________]

http://example.com is the base_url. some/path/to/a/file.avi is what user provides and gets stored in database.

The formatter should append that base_url to the user-supplied values:

function theme_video_url_formatter_embed($element) {
   return "$element['base_url']/$element['#item']['safe']";
}

How can I pass the variable from field-setting $base_url along, so it ends up in that formatter-theme-function?


texts:
I'm fairly new to D7 and I don't know where to start. I have a "Event" CT(ContentType) with many fields in it. Dates, prices, text, html description.

I need to put some fields in a plaintext email and send it to a specific adress. Thats the data export for a ticket system. Some of these fields need to be reformatted. Date => Timestamp, MD5 Hash etc. Textblob with HTML Tags => plaintext, etc.

Also it needs to be saved. So the User can see if its already submitted.

I'm a bit overwhelmed where to start. I think a module and drupal_mail() is the right way to start. How would you do it (General direction)?

Thx in advance
T


texts: Get the path to current page which has an overlay

texts:
I have a page on which there is an overlay. I'm able to get the overlay's path using current_path(). How can I get the page's path on which the overlay is loaded.

Any ideas ?

Thanks


texts: Drush doesn't download module version specified as dependency

texts:
My module has a dependency to specific version of Media module (7.x-2.0-alpha4) and I have specified that in my info file as documented in Writing module .info files (Drupal 7.x) documentation, just like this:

name = mymodule
description = MyModule description.
package = Media

dependencies[] = file_entity
dependencies[] = media (7.x-2.0-alpha4)
dependencies[] = media_internet
dependencies[] = views

When I try to enable my module with it's dependencies drush en -y mymodule, Drush downloads current stable version of media module (7.x-1.5) instead of the specified one and then enabling my module fails because of unmet dependency. I'm doing this on plain Drupal installation v7.34, DevDesktop stack v 2 RC build Mar 18 2015, Drush v7.0.0-alpha9 (from DevDesktop).

I have also tried to specify the version as (2.0-alpha4) and (2.x) - without success.

What am I doing wrong? Thanks for any hints!


texts: remote Drush stops because of " headers already sent"

texts:
I am struggling with a remote drush error since days, and don't find the cause. I already checked the Internet up and down for an answer, but could not find a solution for my problem (here,here and many more):

I have one specific D7 setup that I remotely manage by drush, running Drush 8 on both sides (started with 7 on both sides, and upgraded meanwhile both to 8)
My local Drush can do a drush @anysite_in_aliases status and it works, so I assume there is no problem at my local drush.
My remote drush can do that as well - if I log in at my remote server and call drush status in the drupal directory, it works.

Only if I call drush @specialsite status I get this:

Drush command terminated abnormally due to an unrecoverable error.                                          [error]

I tried to use --debug on it, the relevant part is:

Drush bootstrap phase : bootstrap_drupal_database() [0.28 sec, 8.04 MB]                                 [bootstrap]
Successfully connected to the Drupal database. [0.28 sec, 8.04 MB]                                      [bootstrap]
Find command files for phase 4 (max=7) [0.28 sec, 8.04 MB]                                                  [debug]
Drush bootstrap phase : bootstrap_drupal_full() [0.28 sec, 8.04 MB]                                     [bootstrap]
Cannot modify header information - headers already sent by (output started at                             [warning]
phar:///home/example/bin/drush/includes/output.inc:41) common.inc:705 [1.16 sec, 32.14 MB]
Drush command terminated abnormally due to an unrecoverable error. [1.17 sec, 32.68 MB]                     [error]
End redispatch via drush_invoke_process(). [3.62 sec, 7.99 MB]                                             [notice]

And here I stuck. I know that there must be a whitespace before/after a php tag somewhere, or an error message that is sent before the header. But I can't find out where I can get nearer to the culprit.
I've read up and down all the causes for that error - but my problem is: WHAT causes that error??

BTW: I am using Uberspace as server (CentOS 6), already thought maybe is drush called as php-cgi?? How do I check this?

My aliases lines:

$aliases['example.live'] = array(
  'uri' => 'http://example.org',
  'root' => '/var/www/virtual/example/html',
  'remote-host' => 'example.org',
  'remote-user' => 'example',
);

Could anybody enlighten me?


texts:
I have a Drupal website which uses webforms and a custom module to manage the access in their submissions using hook_webform_submission_access.

While successfully restricting the access of a webform submission to a user, though, when they view the "Results" tab (or the "Table) the access filter isn't triggered as these tables are generated by Views.

How can I add a filter to the default "Webform submissions" view in order not to show the ones that the user has no access on?

PS: I know I can use hook_views_pre_render and unset the rows from the results, but I believe a filter would be a better and more elegant solution.


texts:
I am trying to ajaxify my site. every path should be ajaxified (view-pages, nodes, user-pages, etc)

I simply start with adding the class use-ajax to my links.

As a result I get an Error:

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /kategorie/studie
StatusText: OK
ResponseText:
Page title
@import url("http://local/modules/system/system.base.css?nc1ppj");
@import ...
...

I figured out that the status of the ajax request is parsererror and I found out that this probably has to do with the standart ajax-options:

dataType: 'json',
type: 'POST'

I assume that the response is not json. But shouldnt be the core standard functionality running out of the box? Or am I missing something?


texts:
When trying to run `Drush pm-update' in a site i get the error

Command pm-update needs the following modules installed/enabled to run: update.                              [error]
The drush command 'pm-update' could not be executed.

Oddly this command was recently working (on other sites in the same core installation), and further more I have no idea where to find or what is this 'update' module. Can anyone point me in the right direction?


texts: How do I create a rule to display a system message to users that an event is now over?

texts:
I have an event content type with a date field. Is there a rule I can create that will display a system message to the user that "This event is now over." based on comparing the current date and the date in the date field?

EDIT:


texts: Count of nodes filter in views for a taxonomy with depth

texts:
sorry for my English.
In views, Drupal 8/9, is it possible to have the count of nodes for a taxonomy-term with depth?
I would like to have it for the filters in views.
I can't find any modules to get this information.
Maybe I don't know how to look or a complex module gives this possibility but I couldn't find it.
Aggregation doesn't really help me. Performance is not a problem.


texts: How to detect Adblock on my Drupal website?

texts:
I want to be able to detect if the user is using adblock plus or any blocking ad extension. How can I do this in Drupal ?

Why ? I'm building a website that is going to contain ads on a block (so far I do not think I would use the adsense module) that block would only be display it to anonymous users. If the user have adblock plus enable on their browser, I would like to show another block that said something similar to this "If you enjoy our content free to ads you should become a member of this site. Ads help us creating more content." I would set a link on that block to encourage user to buy a role to help that website.

So far I notice there is a very popular question at Stackoverflow "How to detect Adblock on my website?". But I was wondering if there is a module or better Drupal way to detect if the user is using adblock plus.


texts: Selecting nodes by content type and value of a custom field

texts:
I need to select nodes (1) of a certain content type and (2) satisfying a test against a custom field's value. Pseudo-code would be:

select all nodes of type TYPE_X which are published and where MY_FIELD = 'x'

I tried that with the EntityFieldQuery suggested here: How do I query a content type with custom fields in the 'condition' statement
but Drupal/php crashes with "Fatal error: Allowed memory size of x bytes exhausted..."

So - what would be the correct code to use? I would appreciate a query which takes revisions into account.


texts:
I've created a custom module that creates 2 content types in it's .install file (with node_type_save). This works fine, but now i have trouble implanting the hook_xxxx system. As the content types are already defined there is little need hook_node_info to define them again in the .module file, and even if i wanted to this will not work.

Now i can get around this by using hook_node_xxxx but i wonder if this is the right approach. It seems a bit dodgy to use the general hooks in a module which just defined those hooks.

Here is the code:

<?php

/**
 * Implements hook_install().
 */
function vakantie_install() {

    $t = get_t();
    $content_types = array(
        'name1' => 'vakantie_blok',
        'name2' => 'vakantie_pagina',
    );

    $types = array(
        array(
            'type' => $content_types['name1'],
            'name' => $t('Vakantie Blok'),
            'base' => 'node_content',
            'description' => $t('Maak een Vakantie Blok item.'),
            'custom' => 0,
            'modified' => 1,
            'locked' => 0,
        ),
        array(
            'type' => $content_types['name2'],
            'name' => $t('Vakantie Pagina'),
            'base' => 'node_content',
            'description' => $t('Maak een Vakantie Pagina item.'),
            'custom' => 0,
            'modified' => 1,
            'locked' => 0,
        ),
    );

    foreach ($types as $type) {
        $type = node_type_set_defaults($type);
        node_type_save($type);
        node_add_body_field($type, $t('Inhoud'));
    }

    foreach ($content_types as $type) {
        // add persistent variables that control settings
        variable_set('additional_settings__active_tab_' . $type, 'edit-menu');
        // 0 = disabled, 1 = optional, 2 = required
        variable_set('node_preview_' . $type, 1);
        // array(0 => 'status', 1 => 'promote', 2 => 'sticky', 3 => 'revision') remove to uncheck
        variable_set('node_options_' . $type, array());
        // 1 = Display author and date information, 0 = none
        variable_set('node_submitted_' . $type, 0);
        variable_set('menu_options_' . $type, array());
        variable_set('menu_parent_' . $type, 'main-menu:0');
    }
}

/**
 * Implements hook_uninstall().
 */
function vakantie_uninstall() {

    $content_types = array(
        'name1' => 'vakantie_blok',
        'name2' => 'vakantie_pagina',
    );

    // gather all job nodes created and delete them
    $sql = 'SELECT nid FROM {node} n WHERE n.type = :type1 OR n.type = :type2';
    $result = db_query($sql, array(':type1' => $content_types['name1'], ':type2' => $content_types['name2']));
    $nids = array();
    foreach ($result as $row) {
        $nids[] = $row->nid;
    }
    node_delete_multiple($nids);

    // remove persistant variables that control settings
    foreach ($content_types as $type) {
        variable_del('additional_settings__active_tab_' . $type);
        variable_del('node_preview_' . $type);
        variable_del('node_options_' . $type);
        variable_del('node_submitted_' . $type);
        variable_del('menu_options_' . $type);
        variable_del('menu_parent_' . $type);
    }

    // delete our content type
    node_type_delete($content_types['name1']);
    node_type_delete($content_types['name2']);
}

Here the .module:

<?php

function vakantie_node_view($node, $view_mode, $langcode) {
    if($node->type == 'vakantie_blok') {

        $extra_field = 'test_extra';

        $node->content['test'] = array(
            '#markup' => $extra_field,
            '#weight' => 1,
        );

        $node->content['test2'] = array(
            '#markup' => $extra_field,
            '#weight' => -1,
        );
    }
}


texts: Organic Groups Create Content Link does not appear

texts: When I log in with my administrator account I am able to see the Create Content Link in my Organic Group. But when I am logged in with another account - permission to create content for content types is set - the create content link does not appear. I also activated entityreference prepopulate. Does anyone know what the problem could be?


texts: How do I remove comments from an existing webform?

texts:
After the fact, I learned how to make comments <hidden> by default for new webforms. However, for the forms I've already created, there is no option to remove comments. How do I remove comments for these already published forms? Do I have to make a whole new form, or edit the database directly somehow?

Thanks for any help, and please let me know if there is any other information I need to provide.


texts:
I could explain everything, but that will take me a while, so, long story short.

I need one node to have 2 path alises (Not re-direction) 2 path aliases, and this is what I need to do, to show some fields in my view or hide them.

The idea is if I access from one view I need to show some fields, or If I join from another one I should hide it


texts:
Is there a way to fully translate the contact message forms in Drupal 8? In the content language screen, the contact message bundle is marked as translation is not supported.

Edit: To clarify, I would like to translate the fields of the form. As some answers note, the fields can be translated via the regular field translation, but I am running into an issue whereby translations are replaced by the English version when the cache is cleared. By going to /admin/config/regional/content-language and saving the form, the translations are back.

(Note that the default language on the site is not English.)


texts: Can I use views_bulk_operations with the D7 core toolbar module?

texts:
I'm building a site right now where I'd prefer to use views_bulk_operations to administer the standard content overview (admin/content) and user overview pages (admin/people). My trouble is that I also want to use the toolbar module (or something like it) to give my site admins the ability to easily browse to the pages generated by views_bulk_operations (admin/content2 and admin/people2). It doesn't seem possible right now.

Any ideas? Or, perhaps, any alternatives to the core toolbar module? Thanks!


texts: How can I save all taxonomy terms automatically?

texts:
I'am using hook_taxonomy_term_presave to redirect file urls to another link.

In order to see the changes I need to go to : Mysite/taxonomy/term/10/edit and save the page.

I need to do this operation for all taxonmy terms of my website, is there a way to do this automatically whithout editing every page and save it ?

Thanks.


texts: Is there a module that will allow me to display a field dependent on what language is selected? I have a field that I'd only like to show for Swiss pages. I tried the Conditional Fields module but it doesn't let me select the language field as the dependent.


texts: Cannot log in to Drupal running alongside WordPress multi-site

texts:
I have a Drupal site (7) that I've migrated to a new server. I have a WordPress multi-site install on this server that looks like this at the moment:

example.com
store.example.com

I used to have a forum.example.com, but frankly the available WordPress forum options leave a lot to be desired, so I moved my old Drupal forum instead of migrating.

The issue is that I cannot log in to Drupal, from any account, even using a Drush generated link.

I've tried clearing caches, truncating session tables, adding $base_url in the settings.php file, setting session.name on both the WordPress and Drupal installations.
I'm at a loss. I've been banging my head against this for 4 hours now. I switched to a secondary domain (forum.example2.com) and it works perfectly; so all I can come up with is that there is some sort of collision between the two frameworks with either the sessions or the cookies.

Why cannot I log in with any account? How can I fix this?

Edit:
To be clear, if I change Apache to point a different domain to this installation, everything works fine. I installed Flarum in place of drupal, and am able to log in. This problem is only present when the two frameworks are drupal and WordPress, and they are subdomains of the same main domain

Setting the user manually also doesn't work, for example:

global $user;
if(ip_address() == 'my.ip.address'){
   $user = user_load(1);
}

If I dump the user object after this it is loaded, but the next page load still leaves my as an anonymous user.


texts: How to view what query was ran when a form is submitted?

texts:
Im using drupal 7, I'm trying to find out where abouts in the database certain values are submitted.

Is it possible to view what sql query was ran after a form was submitted?

Thanks for any help


texts:
I'm trying to add custom class to an image.

The image is generated with a image field called "field_hero" so i'm trying to add a class to this image that is generated from that specific field.

Right now, I've tried with :

function mytheme_preprocess_image(&$variables) {
  $element = $variables['element'];
  if (isset($element['#field_name'])) {
    if ($element['#field_name'] == 'field_hero') {
       $variables['attributes']['class'][] = 'custom-class';
    }
  }
}

I can actually add a class with $variables['attributes']['class'][]

But with the if statements it doesn't work because it doesn't go through.

How can i make it work?


texts: How to add a PayPal Express Checkout button to cart or order_information pages

texts:
I don't see that it's possible to have a "PayPal Express Checkout" button in commerce 2.x using commerce_paypal (out-of-the-box at least).  Even if using Express Checkout, the customer still needs to select it from the "order_information" screen, complete billing info, and then

Is there a way to do this?


texts:
I have created a content type in which I have a field that is a select box.
Now I want to change all the default values of that select box.

I know hook_form_alter() will work this, but I have no idea on how to change this.
Is anybody able to give me an idea?


texts:
I have a field in one of my content types called lab_test_id. When Editors add content of that type they enter all the ids of the lab tests associated with that node. I need to be able to take that id, call that lab test database, and display the lab test fields I get back.

Can I accomplish that by changing the display of the lab_test_id field via hook_field_display_alter or should I find another way to accomplish that?


texts:
I'm trying to enable a submenu item through context rules.

However, the Context is consistently trying to select only the top parent item, and not the submenu. I tried few times on completely clean installs with the same results.

Am I doing something wrong or it should be working this way?

How can I otherwise open a submenu item with context rules?

Thanks!


texts: Domain Access and One.com hosting (funny subdomain rewrite)

texts:
I have a D7 installation that uses Domain Access to distinguish between a main website example.com and a minisite event.example.com. They share the same document root / Drupal installation and the same database. I use Domain Path to have subdomain-specific aliases.

This worked fine, until I decided to move this website to a webspace at One.com. They do this thing were you can create a subdomain just by creating a directory in the document root. So /folder/ can automatically be accesssed in three ways:

http://folder.example.com/
http://example.com/folder/
http://www.example.com/folder/

By default, there is an A wildcard DNS-record for *.example.com.

The relevant part of my /.htaccess currently looks like this:

Options +FollowSymLinks

<IfModule mod_rewrite.c>
  RewriteEngine on

  #strip www.
  RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]

  #pass all requests that do not refer to files to index.php
  RewriteCond %{HTTP_HOST} ^(event\.)?example\.com [NC]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^ index.php [L]
</IfModule>

This messes up all static files on event.example.com. When http://event.example.com/sites/default/files/css/css_*.css is accessed, Apache tries to find an /event/ directory, which doesn't exist and gives a 404.

I attempted to fix this by symlinking /event/ to /. Now the static files work, but domain paths on event.example.com no longer work (they all give 404s) and links tend to get rewritten to http://event.example.com/event/somelink.

I also tried to fix this by adding the following, but that didn't help.

RewriteCond %{REQUEST_URI} ^/event(.*)$ [NC]
RewriteRule ^ http%{ENV:protossl}://event.example.com%1 [L,R=301]

Any ideas?


texts: Using entries from custom block library in twig template?

texts:
I have two custom library blocks for the footer of a website I am developing. The idea is that admins may change the footer quite freely with a wysiwyg editor without any theme changes.

The problem is that I don't find any way to use only the contents of the custom library blocks (without the Drupal generated layout destructing code) in the footer twig.

Am I trying to do something impossible or just missing something obvious?

wbr

hank


texts: Using Drupal console, can I gitignore console folder?

texts:
I'm working on a Drupal 8 project, and installed Drupal console globally on my system.

The command drupal init created a console folder at the root of Drupal.

It seems to be used as a cache directory. Well it's a guess from what I see inside it.

Can I safely add this directory to my .gitignore file? Or should I commit it?


texts: How are user.tokens.inc and other similar files included?

texts: I notice that many core modules in Drupal 7 implement hook_token_info and hook_tokens in a hook.tokens.inc file, but I can't figure out how this file is included. Should I be doing the same with my own module? How can I be sure it will be loaded?


texts: INVALID_SERVICE Error Code on CAS forced login page

texts:
i have configured a forced login for the /intranet page

/fr/admin/config/people/cas

I have created a menu link to that page /intranet

when clicking on it , the cas creadential are asked and it returns an

  INVALID_SERVICE
   error

http://mywebsitedomainfr/casservice?q=fr%2Fcasservice&returnto=http%3A%2F%mywebsitedomain%2Ffr%2Fintranet%3Fq%3Dfr%252Fintranet&ticket=ST-74551-ESB2kMRXfQ5UcMbqajPd-mycasserver||0||Validation response received from CAS server: #012#012#012#012#011#012#011#011Le ticket &#039;ST-74551-ESB2kMRXfQ5UcMbqajPd-mycasserver&#039; ne correspond pas au service demandé. Le service original était &#039;http://mywebsitedomain/fr/casservice?returnto=http%3A//mywebsitedomain/fr/intranet%3Fq%3Dfr%252Fintranet&#039; et le service demandé était &#039;http://mywebsitedomain/fr/casservice?q=fr/casservice&amp;returnto=http%3A//mywebsitedomain/fr/intranet%3Fq%3Dfr%252Fintranet&#039;.
Error when validating ticket: Error Code INVALID_SERVICE: Le ticket 'ST-74551-ESB2kMRXfQ5UcMbqajPd-mycasserveur ne correspond pas au service demandé. Le service original était 'http://mywebsitedomain/fr/casservice?returnto=http%3A//mywebsitedomain/fr/intranet%3Fq%3Dfr%252Fintranet' et le service demandé était 'http://mywebsitedomain/fr/casservice?q=fr/casservice&returnto=http%3A//mywebsitedomain/fr/intranet%3Fq%3Dfr%252Fintranet'.
http://mywebsitedoamin/fr/casservice?q=fr%2Fcasservice&returnto=http%3A%2F%2Fmywebsitedomain %2Ffr%2Fintranet%3Fq%3Dfr%252Fintranet&ticket=ST-74551-ESB2kMRXfQ5UcMbqajPd-mycasserverdomain||0||Converting query parameter 'returnto' to 'destination'.
http://mywebsite domain/fr/intranet?q=fr%2Fintranet&q=fr%2Fintranet||0||Temp disable flag set, skipping CAS subscriber.


texts: How to share structures (content types) across multiple sites?

texts:
Info:
I have DRUPAL6.26 with subdomains all install in a single database. Each site has a prefix for its tables.

My situation:
I have shared users between subdomains by sharing the {users},{sessions},{profile} tables in settings.php.

My questions:

How can I share structures (Content types in my case) only across multiple sites/subdomains without their original content ?
Can I use it for content types by sharing the table: node_type and all CCK FIELDS tables.
Or could there be another way to achieve this ?


texts:
I've got Panels working with Organic Groups (d7) using the documentation about "Drupal 7 Panels integration guide (OG 7.x-1.x)". It describes how to create a node panel that detects when you are viewing a group and then displays the layout accordingly.

This is great, however, I would now would like to create a new variant that would allow more specific customization of a specific group. Say for example I have a special group called "Education" that would need to arrange their group home page slightly different from others.

I have made some adjustments to what I think would do the trick, but it does not work. Here is what I have done:

Cloned the original varient from the documentation
Under Contexts, added a new context "Organic groups group" and specified the group id of the "Education" Group
Under Selection rules, added a new "Context exists", and selected my context created in the above step
Made some adjustments to layout
Saved, and reordered variants to make this one come first

This worked.... however for some reason it applies to all groups not just to my "Education" group. Again, I would like to have a custom layout for my "Education" group, and have a default layout for the rest. I'm still new at panels, can anyone spot what I'm doing wrong based on my description?


texts:
i would like to hide the post information for my content type,  but programmatically.

I don't find where the author and date information
 is stocked in the database, and I would like to hide it.

How can I achieve this?


texts: No Emails sent on User Creation in D8 through Rest API

texts:
I'm working in Drupal 8.2.4 currently and building a headless webapp using Rest Web Services module for the endpoints I need.
I'm using the endpoint /entity/user to create users, however the default welcome emails are not getting sent out by Drupal when I create the users.

I do have the emails set up to be sent properly and I know this because if I create a user like normal in Drupal with "Notify user of new account" checked, it does send the email. Is there some simple way that I am just missing to get this to work?

I have also tried using hook_ENTITY_TYPE_insert using _user_mail_notify to trigger the email to be sent, however this is not working either for what I want. My code is as follows:

/**
 * Implements hook_ENTITY_TYPE_insert().
 * When a new user is created, do things.
 */
function custom_rules_user_insert(Drupal\Core\Entity\EntityInterface $entity)
{
  _user_mail_notify('register_no_approval_required', $entity);
}

Am I doing something wrong, is there a simple way to get this to work or does this just not work at all yet in Drupal 8? I will also need to set up Pass Reset emails, so any feedback would be appreciated.


texts:
I've created a class that extend the 'FormBase' class to create a form where I can upload a XLSX file to import into custom DB table.

To process the import I would use the 'Drupal batch process' to show to the user the progress of import.

These are the methods I wrote.

    class CommissionerImportUmpiresListForm extends FormBase {

      public function submitForm(array &$form, \Drupal\Core\Form\FormStateInterface $form_state) {
        $form_file = $form_state->getValue('my_file', 0);
        if (isset($form_file[0]) && !empty($form_file[0])) {
          $f = File::load($form_file[0]);
          $f->setPermanent();
          $f->save();
          $this->setSheetData($this->commissioner_read_file($f->getFileURI()));
          $orig = $this->getSheetData();
          $clean = array_shift($orig);
          $this->setSheetData($orig);
          $operations = [];
          $c = count($this->getSheetData());
          foreach ($this->getSheetData() as $row) {
            $operations[] = [
              ['Drupal\commissioner\Form\CommissionerImportUmpiresListForm', 'batch_run'],
              [$row, $c],
            ];
          }

          $batch = [
            'title' => t('Importing the umpires list...'),
            'operations' => $operations,
            'finished' => ['Drupal\commissioner\Form\CommissionerImportUmpiresListForm', 'batch_finished'],
            'init_message' => t('Importing is starting.'),
            'progress_message' => t('Processed @current out of @total.'),
            'error_message' => t('Importing has encountered an error.'),
          ];
          batch_set($batch);
          batch_process('admin/config/content/umpire_list');
        }
      }

      private function commissioner_read_file($file) {
        $sheetData = [];

        try {
          $real_path = \Drupal::service('file_system')->realpath($file);
          $inputFileType = IOFactory::identify($real_path);
          $reader = IOFactory::createReader($inputFileType);
          $spreadsheet = $reader->load($real_path);
          $sheetData = $spreadsheet->getActiveSheet()->toArray(NULL, TRUE, TRUE, TRUE);
        }
        catch (Exception $catch) {
          \Drupal::messenger()->addMessage($catch->getMessage(), \Drupal\Core\Messenger\MessengerInterface::TYPE_ERROR);
        }

        return $sheetData;
      }

      public static function batch_run($row, $count, &$context) {
        if (empty($context['sandbox'])) {
          $context['sandbox']['progress'] = 0;
          $context['sandbox']['max'] = $count;
        }

        $context['sandbox']['progress']++;
        $context['sandbox']['current_umpire'] = $row;

        // Do something with the row.
        $result = \Drupal ::database()
          ->insert('mytable')
          ->fields([
            'cognome' => $row['A'],
            'nome' => $row['B'],
            'categoria' => $row['Z'],
            'qualifica' => $row['AA'],
            'livello' => $row['AB'],
            'comitato' => $row['AC'],
            'email' => $row['T'],
            'cell' => $row['S'],
          ])->execute();

        $context['results'][] = $row;
      }

      public static function batch_finished($success, $results, $operations, $elapsed) {
        if ($success) {
          $message = \Drupal::translation()
            ->formatPlural(count($results), 'One umpire imported.', '@count umpires imported.');
        }
        else {
          $message = t('Finished with an error.');
        }

        \Drupal::messenger()->addMessage($message, \Drupal\Core\Messenger\MessengerInterface::TYPE_STATUS);
      }
    }

I tried executing the form, but after the initial XLSX reader, that created the array with the rows in the file, the batch process doesn't start.

What's wrong? Why doesn't the batch process start?


texts: AJAX callback issue when using 'Manage Form Display' and 'Manage Display'

texts:
Good day everyone,

So I have an issue that I haven't been able to google. The issue seems rather simple but I don't know what's causing it. When i'm managing field displays in either the form or a view, the ajax 'throbber' icon pops up and the ajax request is never completed. It will continue to show the throbber indefinitely. If I drag the field to another location, it will create another instance of the throbber icon and no ajax request is ever completed. I can do this any amount of times. When I save the form and a field is in the AJAX state, it just reverts back to whatever it was originally. The weird thing is, if I press the cog to change the settings of the field and that field was in the 'perpetual ajax request' state, it will then complete the ajax request as expected.

This leads me to believe that dragging and dropping the fields (and changing the formatter/widget) aren't actually sending any ajax requests. This is also confirmed by checking the Network tab in Chrome's tools. Nothing is sent when dragging fields but when pressing the cog "teaser?ajax_form=1&_wrapper_format=drupal_ajax" request is sent.

I'm at a loss as to what is happening. It only started recently (last couple hours of development) and I went through the changes I've made in that time to try and identify the problem and have come up with nothing. I checked for differences from the production site and nothing... I'm not sure what to do next. Has anyone experienced this problem and successfully fixed it?


texts:
I have a problem with my navigation menu which may be related to a duplicate url.  A view or or other module may be creating the same url and a different view/module.  At this point, I do not know what the duplicate url is.  How would I search my site for duplicate or conflicting urls?  is there a module for that?

Would XML sitemap list duplicate urls?


texts: menu-mini panels: removing anchor tag from menu item

texts:
I've used the menu-minipanel module to set-up some mega menus. The main menu items are set (using the module UI) to show a minipanel with my various menu blocks/nodes.

However I don't want the 1st level menu items themselves to point anywhere, and since I've used the Menu Minipanel option to allow for a click to reveal the minipanel I was forced to use the Special Menu Items module to generate a "#" as an href.

However the problem I'm having now is that when the user clicks on the menu items to open the megamenu, the '#' href takes them to the top of the page.

Can anyone suggest any options here?

Here's the site I'm working on presently as reference.


texts: Why are these filters producing different results?

texts:
I'm working on a view, and I'm trying to apply a global filter (based on a field known as School Year). I've set up the contextual filter and I've added the block used to set the filter, but after setup, I receive completely different results - they have very few similarities, and the contextual filter narrows the view down to about 20% of the expected results.

On the other hand, when I do a standard Views filter using School Year (this time, determined locally), it gives all the expected results.

Basically, my confusion stems from this: if I'm trying to use the same data, stored either globally in a block or locally in a standard filter, why does that give me different results? How can I fix that?  What might I be missing?

EDIT: Despite my answer below this seems to only be working on one of my views - but even though I replicated the steps on another view, it provides the same unexpected behavior, so it only applies to half the views I need it to work on.


texts: dev-test-prod staging workflow for drupal with transport of database changes

texts:
Hi I am looking for a best practice staging workflow for a four level staging environement for drupal:

dev->test->pre-prod->prod

I found this quite informative thread already Applying Updates to Multiple Drupal Sites

As the Teams will change especially on the test upwards it has to be pretty straight forward.

I guess we will move everting as far as posible through git or would rsync be better choice?
Is there some way to maintain some kind of central stage configuration where you just maintain the server adresses e.g. in on central place
How to move database changes without conflicting with productive content

Would be great if someone could share hints to some documentation of such a workflow.

Thanks in advance


texts: How to import an addressfield with Feeds?

texts:
Using Drupal 7.10 with Feeds 7.x-2.0-alpha4.  I'm trying to create a feeds importer to import node data stored in a csv file.  On the screen where you setup the mappings, my addressfield (that is part of my content type) doesn't appear in the drop down list of targets (whereas other fields of my content type do).

How can I get this to work?

I see some issues for this but being a Drupal newbie I can't really understand how to get this to work:

Mapping Address Fields using Feeds and Feeds JSONPath Parser

Mapper for Feeds importers

Do I need to switch to using the Dev release of feeds?


texts: How do I use a preprocess function for a node template?

texts:
I'm trying to preprocess my variable array in drupal 8, But it's not working well.I'm checked with the Bartik theme also, But getting the same error here. When I'm trying to print the variable array its giving a blank page result. How can I preprocess my variable array for a node template?

`function bartik_preprocess_node(&$variables) {
  // Remove the "Add new comment" link on teasers or when the comment form is
  // displayed on the page.
  if ($variables['teaser'] || !empty($variables['content']['comments']['comment_form'])) {
    unset($variables['content']['links']['comment']['#links']['comment-add']);
  }
  print_r($variables);
}`

This is the function I'm tried to checkout the issue in bartik theme.


texts: media library thumbnails missing for txt and pdf

texts:
The http://drupal.org/project/media module cannot display the thumbnails of txt and pdf files in my installation. I'm not expecting a thumbnail of the actual txt or pdf content of course but a generic placeholder.

Display as list:

Display as thumbnail:

Note that:

no missing file (404) requests are being tracked in firebug
this also affects the media popup file chooser from within content editing
changing the theme doesn't solve this problem
inspecting the "empty thumbnail" with firebug doesn't show anything useful, the <a /> is empty.


texts: Entity Reference create problem with REST server using Services

texts:
i'm building a web services and now i'm writing the documentation for the mobile developer.

When i want to create/modify an entity reference Services 3 ask a stucture like this

"field_organization": {
    "und":[{
        "target_id":"Organization name (69)"
    }]
  }

for a field like this

but, there is another way to give only the nid without the node title? It could be more handy.

I read something like

"field_organization":[{
     "target_id":{
                "target_id":"[nid:69]"
          }
   }]

or like

   "field_organization": {
       "und":[{
             "target_id":{
                 "target_id":"[nid:69]"
               }
           }]
     }

on the official documentation but it didn't work.

Can someone know a method to give only the nid of a Entity reference field?


texts: When I create a grid view, I can create groups of elements. However I have no control over the order of these groups. I can sort on the grouping variable, but that is not what I want. I want to specify the order, not sort alphabetically. The default is the order the groups were created which suggests reordering the database rows might work as a kludge. Anyone know how to do this?


texts: Status report for Commerce Kickstart 7.x-2.41 reads Not supported

texts:
Just upgraded from commerce_kickstart-7.x-2.38 to commerce_kickstart-7.x-2.41. When I view the status report it shows "Unsupported release" for module and theme update status. When I click on the list, it shows the following message:

  Distro Update Manager: libraries version 7.x-2.2 does not match .make
  file version 7.x-2.3 from commerce_kickstart.

Any ideas how to fix this?


texts: Unpublish node based on date field with Rules

texts:
I'm trying to unpublish a node based on a date field with Rules.
I've followed this tutorial but somehow it doesn't seem to work.

Here's my Component:

{ "rules_unpublish_termin" : {
    "LABEL" : "Unpublish Termin",
    "PLUGIN" : "action set",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "USES VARIABLES" : { "node" : { "label" : "node", "type" : "node" } },
    "ACTION SET" : [ { "node_unpublish" : { "node" : [ "node" ] } } ]
  }
}

And here's the Rule:

{ "rules_unpublish_termin_rule" : {
    "LABEL" : "Unpublish Termin Rule",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "rules_scheduler" ],
    "ON" : { "node_insert--termin" : { "bundle" : "termin" } },
    "IF" : [ { "node_is_published" : { "node" : [ "node" ] } } ],
    "DO" : [
      { "schedule" : {
          "component" : "rules_unpublish_termin",
          "date" : [ "node:field-termin-datum:value" ],
          "identifier" : "Unpublish content ID [node:nid] ([node:title]).",
          "param_node" : [ "node" ]
        }
      }
    ]
  }
}

I'm fairly new to Drupal and I've never used the Rules module so I'm not sure if there's something else I'm missing here.

edit:
I've been looking into it a bit more.
Currently I have 3 nodes in this bundle with the following dates:
2018-01-09 (which should have been unpublished today)
2018-05-12
2018-07-14

In the Tab Schudule under admin/config/workflow/rules/schedule I can see that the component rules_unpublish_termin has a Schedule Date for 2018-07-14 00:00 which would correlate with the very last date, this seems a bit odd..


texts:
I am building a Drupal 7 platform where users can share images. In a nutshell, people should be able to comment on images and like them.
The way I realized this is by creating a custom content type called "image" and adding an image field to it. And then I grant users the permission to create "image" nodes.
However, yesterday I came across this Drupal 6 article http://drupal.org/node/325688 and it's section 'Images as nodes'. It introduces the Image module, which lets you upload images as nodes automatically. Unfortunately, the Image module hasn't been ported to Drupal 7.

Is this the clean way to implement images?
The article also mentions the solution that I made use of:

For example, using Imagefield, you could create a custom content type that contains one CCK imagefield, and configure that field to "contain" (refer to) only a single file. However, note that this custom CCK node type would not be compatible with Image module or its add-ons, and should be named something other than "Image" to avoid confusion.

Is there any point in not naming your custom content type "image"? I mean, it would be a super suggestive name. And the Image module which would provide a content type with the same name will most likely never be ported to Drupal 7. So there should never be confusion.
Lastly, the article mentions that

It is theoretically possible that, for sites with lots (say hundreds of thousands) of images, storing them all as individual nodes could result in a performance hit from the extra database overhead.

Well, storing lots of images is exactly what image sharing platforms are aiming at, isn't it? Is there a better way (in terms of performance) to store images in Drupal 7 while still making it possible for people to comment on them?


texts: Get value from twig tweak without additional markup

texts:
I am using the following code to set a variable "tab1visibility" from the twig tweak value for field_hidden based on a block id.  {% set tab1visibility =  drupal_field('field_hidden', 'block_content', 7)  %}

This works perfectly but returns the value with the expected markup.

When I try to use |striptags on this newly created value it returns nothing.

So

{% set tab1visibility =  drupal_field('field_hidden', 'block_content', 7)  %}

{{tab1visibility}}

returns true or false wrapped in my typical field div templating.

{% set tab1visibility =  drupal_field('field_hidden', 'block_content', 7)  %}

{{tab1visibility|striptags}}

returns nothing no markup or the raw value.

How do I get just the value without the surrounding markup?


texts:
All sites on our server is currently getting spam users registering for new accounts.

Since none of the sites needs the option available for user to sign up, we would like to change the account setting "Who can register accounts?" being "Administrators only" for all sites.

The issue is we have around 800 sites, and i would rather not do this manually for all sites.

Is it possible to change this setting directly through the database?

Like one sql command that update alle databases and set the setting to being "Administrators only"?


texts: How to get map widget for location selection with Location / GMap

texts: I have GMap and Location modules set up and working. I have a working API key. The node with the location field can store long/lat or address data which I am using to populate a view. All of this works. The only problem I am facing is that I want the node creation form to use the GMap widget, so that users can click the map to populate the location field. I cannot, for the life of me, figure out how to enable this feature. I've checked everywhere that I can think of- any help is appreciated.


texts:
I built a few webforms on a Drupal 8 install. I see how to export the webform in YAML via the export tab on the webform.

How do I import that YAML into another site to re-create that webform?

Thanks in advance.


texts: create a copy of a field-collection for entity clone

texts:
I have a use case where I need to create a copy of an entity (commerce product) that is home to various field collections.

the entity is created by a simple load/save combo:

// load entity
$old_entity = commerce_product_load_by_sku($sku);

// copy
$new_entity = $old_entity;

// alter copy so it can be saved as a new entity
$new_entity->status = 0;
$new_entity->title = $old_entity->title . '(COPY)';
$new_entity->is_new = TRUE;
// [...] and a few more unsets (created, revision, copying translations...)

// ->>> missing field_collection clone / exchange of id references in the entity here <<<-

// save entity
commerce_product_save($new_entity);

As the field_collection id stored in the entity remains unchanged, both entities now share the field collection which leads to unwanted effects.

Can someone point me to a reference on how to create copies of field_collections and get their id's returned, so I can exchange them in the parent entity before saving it? ... or maybe there is an even better way to deal with this?


texts: New to Drupal and views, how do I change the order of my fields?

texts:
How do I change the order of these fields? See the image.
I want to be able to change the output order of these fields.


texts: How to hide webform Results tab in webform?

texts: On my Drupal 7  how hide webform Results tab?


texts:
I would like to display a view in one part of my page by code but i cannot figure it out why it doesn't work

In page.tpl.php i called the next function:

views_embed_view('name_of_view');

If i assigned it to a variable and execute this:

print render($x);

Then i get the html code of the view. Actually I would like to customize the view also. How could i do it ?


texts: How to create a redirection programmatically?

texts:
I try to create a redirection 301 with the redirect module. For example, I want to redirect an URL source to an internal URL through my custom module.

I want to create a redirection when I create a node. Import old content, create a new node and keep the old path.

Anyone have an idea?


texts: How do you edit the contextual links on a custom block in drupal 8?

texts: Currently the only link that shows on the contextual links for custom blocks is the "configure block" link. I want to add an edit link to get to the main content of the block, is this possible?